UBI: initialize static volumes with vol->used_bytes

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Apr 23 05:59:02 EDT 2008


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=cbd8a9d2cd6f576ca41022599341bbd8be1b0b27
Commit:     cbd8a9d2cd6f576ca41022599341bbd8be1b0b27
Parent:     6e0c84e37e809e79313043385148020ceb760496
Author:     Jan Altenberg <jan.altenberg at linutronix.de>
AuthorDate: Fri Mar 28 16:13:53 2008 +0100
Committer:  Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
CommitDate: Thu Apr 17 11:32:02 2008 +0300

    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 at linutronix.de>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
---
 drivers/mtd/ubi/gluebi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c
index d397219..e909b39 100644
--- a/drivers/mtd/ubi/gluebi.c
+++ b/drivers/mtd/ubi/gluebi.c
@@ -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");



More information about the linux-mtd-cvs mailing list