aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-07-23 12:57:31 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-07-29 08:27:48 -0400
commit0f7b2abd188089a44f60e2bf8521d1363ada9e12 (patch)
treeb03702e8aadcf265bb796c3ec31413ea081fb136
parent9d847950770da7102d4efc02d0939ce28e3a7dd0 (diff)
f2fs: add nobarrier mount option
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>
-rw-r--r--Documentation/filesystems/f2fs.txt5
-rw-r--r--fs/f2fs/data.c5
-rw-r--r--fs/f2fs/f2fs.h1
-rw-r--r--fs/f2fs/segment.c3
-rw-r--r--fs/f2fs/super.c7
5 files changed, 20 insertions, 1 deletions
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index 51afba17bbae..a2046a7d0a9d 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -126,6 +126,11 @@ flush_merge Merge concurrent cache_flush commands as much as possible
126 to eliminate redundant command issues. If the underlying 126 to eliminate redundant command issues. If the underlying
127 device handles the cache_flush command relatively slowly, 127 device handles the cache_flush command relatively slowly,
128 recommend to enable this option. 128 recommend to enable this option.
129nobarrier This option can be used if underlying storage guarantees
130 its cached data should be written to the novolatile area.
131 If this option is set, no cache_flush commands are issued
132 but f2fs still guarantees the write ordering of all the
133 data writes.
129 134
130================================================================================ 135================================================================================
131DEBUGFS ENTRIES 136DEBUGFS ENTRIES
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c77c66723d70..482313dd9e24 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -139,7 +139,10 @@ void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
139 /* change META to META_FLUSH in the checkpoint procedure */ 139 /* change META to META_FLUSH in the checkpoint procedure */
140 if (type >= META_FLUSH) { 140 if (type >= META_FLUSH) {
141 io->fio.type = META_FLUSH; 141 io->fio.type = META_FLUSH;
142 io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO; 142 if (test_opt(sbi, NOBARRIER))
143 io->fio.rw = WRITE_FLUSH | REQ_META | REQ_PRIO;
144 else
145 io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO;
143 } 146 }
144 __submit_merged_bio(io); 147 __submit_merged_bio(io);
145 up_write(&io->io_rwsem); 148 up_write(&io->io_rwsem);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 8f507d4c0f71..e999eec200b7 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -41,6 +41,7 @@
41#define F2FS_MOUNT_INLINE_XATTR 0x00000080 41#define F2FS_MOUNT_INLINE_XATTR 0x00000080
42#define F2FS_MOUNT_INLINE_DATA 0x00000100 42#define F2FS_MOUNT_INLINE_DATA 0x00000100
43#define F2FS_MOUNT_FLUSH_MERGE 0x00000200 43#define F2FS_MOUNT_FLUSH_MERGE 0x00000200
44#define F2FS_MOUNT_NOBARRIER 0x00000400
44 45
45#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) 46#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
46#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) 47#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8a6e57d83c79..9fce0f47eb35 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -239,6 +239,9 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi)
239 struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info; 239 struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info;
240 struct flush_cmd cmd; 240 struct flush_cmd cmd;
241 241
242 if (test_opt(sbi, NOBARRIER))
243 return 0;
244
242 if (!test_opt(sbi, FLUSH_MERGE)) 245 if (!test_opt(sbi, FLUSH_MERGE))
243 return blkdev_issue_flush(sbi->sb->s_bdev, GFP_KERNEL, NULL); 246 return blkdev_issue_flush(sbi->sb->s_bdev, GFP_KERNEL, NULL);
244 247
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 34649aa66e04..93593ceec175 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -52,6 +52,7 @@ enum {
52 Opt_inline_xattr, 52 Opt_inline_xattr,
53 Opt_inline_data, 53 Opt_inline_data,
54 Opt_flush_merge, 54 Opt_flush_merge,
55 Opt_nobarrier,
55 Opt_err, 56 Opt_err,
56}; 57};
57 58
@@ -69,6 +70,7 @@ static match_table_t f2fs_tokens = {
69 {Opt_inline_xattr, "inline_xattr"}, 70 {Opt_inline_xattr, "inline_xattr"},
70 {Opt_inline_data, "inline_data"}, 71 {Opt_inline_data, "inline_data"},
71 {Opt_flush_merge, "flush_merge"}, 72 {Opt_flush_merge, "flush_merge"},
73 {Opt_nobarrier, "nobarrier"},
72 {Opt_err, NULL}, 74 {Opt_err, NULL},
73}; 75};
74 76
@@ -339,6 +341,9 @@ static int parse_options(struct super_block *sb, char *options)
339 case Opt_flush_merge: 341 case Opt_flush_merge:
340 set_opt(sbi, FLUSH_MERGE); 342 set_opt(sbi, FLUSH_MERGE);
341 break; 343 break;
344 case Opt_nobarrier:
345 set_opt(sbi, NOBARRIER);
346 break;
342 default: 347 default:
343 f2fs_msg(sb, KERN_ERR, 348 f2fs_msg(sb, KERN_ERR,
344 "Unrecognized mount option \"%s\" or missing value", 349 "Unrecognized mount option \"%s\" or missing value",
@@ -544,6 +549,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
544 seq_puts(seq, ",inline_data"); 549 seq_puts(seq, ",inline_data");
545 if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE)) 550 if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE))
546 seq_puts(seq, ",flush_merge"); 551 seq_puts(seq, ",flush_merge");
552 if (test_opt(sbi, NOBARRIER))
553 seq_puts(seq, ",nobarrier");
547 seq_printf(seq, ",active_logs=%u", sbi->active_logs); 554 seq_printf(seq, ",active_logs=%u", sbi->active_logs);
548 555
549 return 0; 556 return 0;