ubiattach reserves too many BEBs for each volume attached

wodev at progra.biz.pl wodev at progra.biz.pl
Fri Feb 11 07:23:46 PST 2022


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.

---
  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ł



More information about the barebox mailing list