f2fs: add nobarrier mount option
Jaegeuk Kim [Wed, 23 Jul 2014 16:57:31 +0000 (09:57 -0700)]
This patch adds a mount option, nobarrier, in f2fs.
The assumption in here is that file system keeps the IO ordering, but
doesn't care about cache flushes inside the storages.

Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Conflicts:
fs/f2fs/f2fs.h
fs/f2fs/super.c

Change-Id: I52b65987a3353135cbc029221203fdfb65d26212

fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/segment.c
fs/f2fs/super.c

index bf1d859..084b3c8 100644 (file)
@@ -146,7 +146,10 @@ void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
        /* change META to META_FLUSH in the checkpoint procedure */
        if (type >= META_FLUSH) {
                io->fio.type = META_FLUSH;
-               io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO;
+               if (test_opt(sbi, NOBARRIER))
+                       io->fio.rw = WRITE_FLUSH | REQ_META | REQ_PRIO;
+               else
+                       io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO;
        }
        __submit_merged_bio(io);
        up_write(&io->io_rwsem);
index e29a58a..30c2920 100644 (file)
@@ -41,6 +41,7 @@
 #define F2FS_MOUNT_INLINE_XATTR                0x00000080
 #define F2FS_MOUNT_INLINE_DATA         0x00000100
 #define F2FS_MOUNT_FLUSH_MERGE         0x00000200
+#define F2FS_MOUNT_NOBARRIER           0x00000400
 #define F2FS_MOUNT_ANDROID_EMU         0x00001000
 #define F2FS_MOUNT_ERRORS_PANIC                0x00002000
 #define F2FS_MOUNT_ERRORS_RECOVER      0x00004000
index bc63965..a9b49a4 100644 (file)
@@ -239,6 +239,9 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi)
        struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info;
        struct flush_cmd cmd;
 
+       if (test_opt(sbi, NOBARRIER))
+               return 0;
+
        if (!test_opt(sbi, FLUSH_MERGE))
                return blkdev_issue_flush(sbi->sb->s_bdev, GFP_KERNEL, NULL);
 
index 3d10034..1460d6f 100644 (file)
@@ -52,6 +52,7 @@ enum {
        Opt_inline_xattr,
        Opt_inline_data,
        Opt_flush_merge,
+       Opt_nobarrier,
        Opt_android_emu,
        Opt_err_continue,
        Opt_err_panic,
@@ -73,6 +74,7 @@ static match_table_t f2fs_tokens = {
        {Opt_inline_xattr, "inline_xattr"},
        {Opt_inline_data, "inline_data"},
        {Opt_flush_merge, "flush_merge"},
+       {Opt_nobarrier, "nobarrier"},
        {Opt_android_emu, "android_emu=%s"},
        {Opt_err_continue, "errors=continue"},
        {Opt_err_panic, "errors=panic"},
@@ -381,6 +383,9 @@ static int parse_options(struct super_block *sb, char *options)
                case Opt_flush_merge:
                        set_opt(sbi, FLUSH_MERGE);
                        break;
+               case Opt_nobarrier:
+                       set_opt(sbi, NOBARRIER);
+                       break;
                case Opt_err_continue:
                        clear_opt(sbi, ERRORS_RECOVER);
                        clear_opt(sbi, ERRORS_PANIC);
@@ -619,6 +624,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
                seq_puts(seq, ",inline_data");
        if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE))
                seq_puts(seq, ",flush_merge");
+       if (test_opt(sbi, NOBARRIER))
+               seq_puts(seq, ",nobarrier");
 
        if (test_opt(sbi, ANDROID_EMU))
                seq_printf(seq, ",android_emu=%u:%u:%ho%s",