提交 cbd8a9d2 编写于 作者: J Jan Altenberg 提交者: Artem Bityutskiy

UBI: initialize static volumes with vol->used_bytes

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

commit 941dfb07
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: NJan Altenberg <jan.altenberg@linutronix.de>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 6e0c84e3
...@@ -291,11 +291,12 @@ int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol) ...@@ -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 * 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 * 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 * bytes.
* update.
*/ */
if (vol->vol_type == UBI_DYNAMIC_VOLUME) if (vol->vol_type == UBI_DYNAMIC_VOLUME)
mtd->size = vol->usable_leb_size * vol->reserved_pebs; mtd->size = vol->usable_leb_size * vol->reserved_pebs;
else
mtd->size = vol->used_bytes;
if (add_mtd_device(mtd)) { if (add_mtd_device(mtd)) {
ubi_err("cannot not add MTD device\n"); ubi_err("cannot not add MTD device\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册