From patchwork Fri Jun 1 15:16:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [04/23] UBI: Fastmap: Write a fastmap also at detaching Date: Fri, 01 Jun 2012 05:16:25 -0000 From: Richard Weinberger X-Patchwork-Id: 162329 Message-Id: <1338563804-85990-5-git-send-email-richard@nod.at> To: linux-mtd@lists.infradead.org Cc: dedekind1@gmail.com, Richard Weinberger , adrian.hunter@intel.com, Heinz.Egger@linutronix.de, shmulik.ladkani@gmail.com, tglx@linutronix.de, tim.bird@am.sony.com 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 --- 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);