f2fs: support norecovery mount option
authorJaegeuk Kim <jaegeuk@kernel.org>
Sat, 24 Jan 2015 02:33:46 +0000 (18:33 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 12 Feb 2015 01:04:40 +0000 (17:04 -0800)
This patch adds a mount option, norecovery, which is mostly same as
disable_roll_forward. The only difference is that norecovery should be activated
with read-only mount option.

This can be used when user wants to check whether f2fs is mountable or not
without any recovery process. (e.g., xfstests/200)

Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Documentation/filesystems/f2fs.txt
fs/f2fs/super.c

index e0950c483c2244e2fb5bdbe978130f71e37a227e..6758aa358475218ea9f2157b937175069320f120 100644 (file)
@@ -106,6 +106,8 @@ background_gc=%s       Turn on/off cleaning operations, namely garbage
                        Default value for this option is on. So garbage
                        collection is on by default.
 disable_roll_forward   Disable the roll-forward recovery routine
+norecovery             Disable the roll-forward recovery routine, mounted read-
+                       only (i.e., -o ro,disable_roll_forward)
 discard                Issue discard/TRIM commands when a segment is cleaned.
 no_heap                Disable heap-style segment allocation which finds free
                        segments for data from the beginning of main area, while
index 146e310fbf047637b59cc56dd0fc9fb72bc5837c..06d903b5d6c8b138b4a7208648fdc56fdf6cecfc 100644 (file)
@@ -42,6 +42,7 @@ static struct kset *f2fs_kset;
 enum {
        Opt_gc_background,
        Opt_disable_roll_forward,
+       Opt_norecovery,
        Opt_discard,
        Opt_noheap,
        Opt_user_xattr,
@@ -62,6 +63,7 @@ enum {
 static match_table_t f2fs_tokens = {
        {Opt_gc_background, "background_gc=%s"},
        {Opt_disable_roll_forward, "disable_roll_forward"},
+       {Opt_norecovery, "norecovery"},
        {Opt_discard, "discard"},
        {Opt_noheap, "no_heap"},
        {Opt_user_xattr, "user_xattr"},
@@ -287,6 +289,12 @@ static int parse_options(struct super_block *sb, char *options)
                case Opt_disable_roll_forward:
                        set_opt(sbi, DISABLE_ROLL_FORWARD);
                        break;
+               case Opt_norecovery:
+                       /* this option mounts f2fs with ro */
+                       set_opt(sbi, DISABLE_ROLL_FORWARD);
+                       if (!f2fs_readonly(sb))
+                               return -EINVAL;
+                       break;
                case Opt_discard:
                        set_opt(sbi, DISCARD);
                        break;
This page took 0.033043 seconds and 5 git commands to generate.