mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: wodev@progra.biz.pl
Cc: barebox@lists.infradead.org
Subject: Re: ubiattach reserves too many BEBs for each volume attached
Date: Fri, 11 Feb 2022 16:36:30 +0100	[thread overview]
Message-ID: <20220211153630.GJ18637@pengutronix.de> (raw)
In-Reply-To: <1bee39a15fd98b399a28fbf8fed363da@progra.biz.pl>

On Fri, Feb 11, 2022 at 04:23:46PM +0100, wodev@progra.biz.pl wrote:
> If there is more than one volume on the device, ubiattach reserves amount of
> BEBs as for the whole device, each time. Small volumes can be covered mainly
> by reserved blocks on big devices.
> With this the amount of BEBs is proportional to the volume size.

This is done on purpose, see the comment above the place you changed:

	/*
	 * Here we are using size of the entire flash chip and
	 * not just the MTD partition size because the maximum
	 * number of bad eraseblocks is a percentage of the
	 * whole device and bad eraseblocks are not fairly
	 * distributed over the flash chip. So the worst case
	 * is that all the bad eraseblocks of the chip are in
	 * the MTD partition we are attaching (ubi->mtd).
	 */

Sascha

> 
> ---
>  drivers/mtd/ubi/build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 94b4231..54e16f1 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -237,7 +237,7 @@ static int get_bad_peb_limit(const struct ubi_device
> *ubi, int max_beb_per1024)
>  	else
>  		device_size = ubi->mtd->size;
> 
> -	device_pebs = mtd_div_by_eb(device_size, ubi->mtd);
> +	device_pebs = mtd_div_by_eb(ubi->mtd->size, ubi->mtd);
>  	limit = mult_frac(device_pebs, max_beb_per1024, 1024);
> 
>  	/* Round it up */
> -- 
> 2.35.1
> 
> Regards,
> Michał
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2022-02-11 15:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 15:23 wodev
2022-02-11 15:36 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220211153630.GJ18637@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=wodev@progra.biz.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox