Skip to content

Commit cbd8a9d

Browse files
tb10aljArtem Bityutskiy
authored andcommitted
UBI: initialize static volumes with vol->used_bytes
I came across a problem which seems to be present since: commit 941dfb0 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. Signed-off-by: Jan Altenberg <jan.altenberg@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
1 parent 6e0c84e commit cbd8a9d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎drivers/mtd/ubi/gluebi.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,12 @@ int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol)
291291
/*
292292
* In case of dynamic volume, MTD device size is just volume size. In
293293
* case of a static volume the size is equivalent to the amount of data
294-
* bytes, which is zero at this moment and will be changed after volume
295-
* update.
294+
* bytes.
296295
*/
297296
if (vol->vol_type == UBI_DYNAMIC_VOLUME)
298297
mtd->size = vol->usable_leb_size * vol->reserved_pebs;
298+
else
299+
mtd->size = vol->used_bytes;
299300

300301
if (add_mtd_device(mtd)) {
301302
ubi_err("cannot not add MTD device\n");

0 commit comments

Comments
 (0)