Commit cbd8a9d2cd6f576ca41022599341bbd8be1b0b27

Authored by Jan Altenberg
Committed by Artem Bityutskiy
1 parent 6e0c84e37e

UBI: initialize static volumes with vol->used_bytes

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.

Signed-off-by: Jan Altenberg <jan.altenberg@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

drivers/mtd/ubi/gluebi.c
... ... @@ -291,11 +291,12 @@
291 291 /*
292 292 * In case of dynamic volume, MTD device size is just volume size. In
293 293 * 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.
296 295 */
297 296 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
298 297 mtd->size = vol->usable_leb_size * vol->reserved_pebs;
  298 + else
  299 + mtd->size = vol->used_bytes;
299 300  
300 301 if (add_mtd_device(mtd)) {
301 302 ubi_err("cannot not add MTD device\n");