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

Richard Weinberger richard at nod.at
Fri Jun 1 11:16:25 EDT 2012


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 at 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)
 
 	ubi_debugfs_exit_dev(ubi);
 	uif_close(ubi);
+
 	ubi_wl_close(ubi);
 	ubi_free_internal_volumes(ubi);
 	vfree(ubi->vtbl);
-- 
1.7.6.5




More information about the linux-mtd mailing list