]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
UBI: Fastmap: Enhance fastmap checking
authorRichard Weinberger <richard@nod.at>
Mon, 6 Oct 2014 13:18:41 +0000 (15:18 +0200)
committerRichard Weinberger <richard@nod.at>
Thu, 26 Mar 2015 21:46:04 +0000 (22:46 +0100)
Don't update the fastmap upon detach if fastmap checking is enabled.
This is poor men's power cut testing feature. :-)

Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/build.c

index a7571508fdab3d6aca16ca462817f40f039a120d..e26fe12b1aae47a327feae54631f841e5a0ca2ad 100644 (file)
@@ -1114,8 +1114,11 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
        ubi_msg(ubi, "detaching mtd%d", ubi->mtd->index);
 #ifdef CONFIG_MTD_UBI_FASTMAP
        /* If we don't write a new fastmap at detach time we lose all
        ubi_msg(ubi, "detaching mtd%d", ubi->mtd->index);
 #ifdef CONFIG_MTD_UBI_FASTMAP
        /* If we don't write a new fastmap at detach time we lose all
-        * EC updates that have been made since the last written fastmap. */
-       ubi_update_fastmap(ubi);
+        * EC updates that have been made since the last written fastmap.
+        * In case of fastmap debugging we omit the update to simulate an
+        * unclean shutdown. */
+       if (!ubi_dbg_chk_fastmap(ubi))
+               ubi_update_fastmap(ubi);
 #endif
        /*
         * Before freeing anything, we have to stop the background thread to
 #endif
        /*
         * Before freeing anything, we have to stop the background thread to