[04/23] UBI: Fastmap: Write a fastmap also at detaching

Message ID 1338563804-85990-5-git-send-email-richard@nod.at
State New, archived
Headers show

Commit Message

Richard Weinberger June 1, 2012, 3:16 p.m.
If we attach a UBI device and make no modifications we
end up with a device without a fastmap.
So UBI will fall back to scanning mode next time.
To avoid an unnecessary full scan we write a fastmap also
while detaching.

Signed-off-by: Richard Weinberger <richard@nod.at>
 drivers/mtd/ubi/build.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 51113cb..7cc2a37 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1044,6 +1044,7 @@  int ubi_detach_mtd_dev(int ubi_num, int anyway)
 	ubi_assert(ubi_num == ubi->ubi_num);
 	ubi_notify_all(ubi, UBI_VOLUME_REMOVED, NULL);
 	dbg_msg("detaching mtd%d from ubi%d", ubi->mtd->index, ubi_num);
+	ubi_update_fastmap(ubi);
 	 * Before freeing anything, we have to stop the background thread to
@@ -1060,6 +1061,7 @@  int ubi_detach_mtd_dev(int ubi_num, int anyway)