Skip to content

Commit

Permalink
UBI: initialize static volumes with vol->used_bytes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Altenberg authored and Artem Bityutskiy committed Apr 17, 2008
1 parent 6e0c84e commit cbd8a9d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/mtd/ubi/gluebi.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,12 @@ int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol)
/*
* 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");
Expand Down

0 comments on commit cbd8a9d

Please sign in to comment.