Skip to contentSkip to conversation

ubi_create_gluebi: Initialize static volumes with vol->used_bytes

PATCH In review Jan Altenberg 2 participants 2 messages Mar 28, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubi_create_gluebi: Initialize static volumes with vol->used_bytes

Hi all,

I came across a problem which seems to be present since:

commit 941dfb07ed91451b1c58626a0d258dfdf468b593
UBI: set correct gluebi device size

ubi_create_gluebi() leaves mtd->size = 0 for static volumes. So even existing static volumes are initialized with a size of 0. See attached patch (applies on top of latest git).

---
 drivers/mtd/ubi/gluebi.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/ubi/gluebi.c +3 -2
Index: linux-2.6/drivers/mtd/ubi/gluebi.c
===================================================================
@@ -291,11 +291,12 @@ int ubi_create_gluebi(struct ubi_device 
 	/*
 	 * In case of dynamic volume, MTD device size is just volume size. In
 	 * case of a static volume the size is equivalent to the amount of data
-	 * bytes, which is zero at this moment and will be changed after volume
-	 * update.
+	 * bytes.
 	 */
 	if (vol->vol_type == UBI_DYNAMIC_VOLUME)
 		mtd->size = vol->usable_leb_size * vol->reserved_pebs;
+	else
+		mtd->size = vol->used_bytes;
 
 	if (add_mtd_device(mtd)) {
 		ubi_err("cannot not add MTD device\n");
#1 lore raw
Quoted 10 lines · Jan Altenberg

Hi all,

I came across a problem which seems to be present since:

commit 941dfb07ed91451b1c58626a0d258dfdf468b593
UBI: set correct gluebi device size

ubi_create_gluebi() leaves mtd->size = 0 for static volumes. So even existing static volumes are initialized with a size of 0. See attached patch (applies on top of latest git).

Fair enough, applied, thank you!

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)