Skip to contentSkip to conversation

f2fs: introduce new option for controlling data flush

PATCH In review Chao Yu 3 participants 7 messages Dec 15, 2015 – Dec 16, 2015

Subsystems (2)
lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 7/8 f2fs: introduce new option for controlling data flush

Add a new option 'data_flush' to enable/disable data flush functionality in checkpoint.

---
 Documentation/filesystems/f2fs.txt | 2 ++
 fs/f2fs/checkpoint.c               | 2 +-
 fs/f2fs/f2fs.h                     | 1 +
 fs/f2fs/super.c                    | 7 +++++++
 4 files changed, 11 insertions(+), 1 deletion(-)
Documentation/filesystems/f2fs.txt +2 -0
index 8088bd9..727373e 100644
@@ -151,6 +151,8 @@ noextent_cache         Disable an extent cache based on rb-tree explicitly, see
                        the above extent_cache mount option.
 noinline_data          Disable the inline data feature, inline data feature is
                        enabled by default.
+data_flush             Enable data flushing during checkpoint in order to
+                       persist data of regular and symlink.
 
 ================================================================================
 DEBUGFS ENTRIES
fs/f2fs/checkpoint.c +1 -1
index a73909c..2fdf271 100644
@@ -855,7 +855,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
 
 retry_flush_datas:
 	/* write all the dirty data pages */
-	if (get_pages(sbi, F2FS_DIRTY_DATAS)) {
+	if (test_opt(sbi, DATA_FLUSH) && get_pages(sbi, F2FS_DIRTY_DATAS)) {
 		sync_dirty_inodes(sbi, FILE_INODE);
 		if (unlikely(f2fs_cp_error(sbi))) {
 			err = -EIO;
fs/f2fs/f2fs.h +1 -0
index 4d44732..ee1f0a8 100644
@@ -54,6 +54,7 @@
 #define F2FS_MOUNT_FASTBOOT		0x00001000
 #define F2FS_MOUNT_EXTENT_CACHE		0x00002000
 #define F2FS_MOUNT_FORCE_FG_GC		0x00004000
+#define F2FS_MOUNT_DATA_FLUSH		0x00008000
 
 #define clear_opt(sbi, option)	(sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)	(sbi->mount_opt.opt |= F2FS_MOUNT_##option)
fs/f2fs/super.c +7 -0
index 051bce6..694e092 100644
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
Signature · 1 line
2.6.3
maintainer
#1 lore raw

Hi Jaegeuk,

The 7, 8 patches could not be merged on current dev-test branch due to I generate them on incorrect base line. I will rebase and resent them tomorrow, sorry for the noisy.

Thanks,

Quoted 89 lines · Chao Yu

Add a new option 'data_flush' to enable/disable data flush functionality in checkpoint.

---
 Documentation/filesystems/f2fs.txt | 2 ++
 fs/f2fs/checkpoint.c               | 2 +-
 fs/f2fs/f2fs.h                     | 1 +
 fs/f2fs/super.c                    | 7 +++++++
 4 files changed, 11 insertions(+), 1 deletion(-)
Documentation/filesystems/f2fs.txt +2 -0
index 8088bd9..727373e 100644
@@ -151,6 +151,8 @@ noextent_cache         Disable an extent cache based on rb-tree explicitly, see
                        the above extent_cache mount option.
 noinline_data          Disable the inline data feature, inline data feature is
                        enabled by default.
+data_flush             Enable data flushing during checkpoint in order to
+                       persist data of regular and symlink.
 
 ================================================================================
 DEBUGFS ENTRIES
fs/f2fs/checkpoint.c +1 -1
index a73909c..2fdf271 100644
@@ -855,7 +855,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
 
 retry_flush_datas:
 	/* write all the dirty data pages */
-	if (get_pages(sbi, F2FS_DIRTY_DATAS)) {
+	if (test_opt(sbi, DATA_FLUSH) && get_pages(sbi, F2FS_DIRTY_DATAS)) {
 		sync_dirty_inodes(sbi, FILE_INODE);
 		if (unlikely(f2fs_cp_error(sbi))) {
 			err = -EIO;
fs/f2fs/f2fs.h +1 -0
index 4d44732..ee1f0a8 100644
@@ -54,6 +54,7 @@
 #define F2FS_MOUNT_FASTBOOT		0x00001000
 #define F2FS_MOUNT_EXTENT_CACHE		0x00002000
 #define F2FS_MOUNT_FORCE_FG_GC		0x00004000
+#define F2FS_MOUNT_DATA_FLUSH		0x00008000
 
 #define clear_opt(sbi, option)	(sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)	(sbi->mount_opt.opt |= F2FS_MOUNT_##option)
fs/f2fs/super.c +7 -0
index 051bce6..694e092 100644
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
maintainer
#2 lore raw
In reply to Chao Yu

Hi,

Quoted 54 lines · Chao Yu

Add a new option 'data_flush' to enable/disable data flush functionality in checkpoint.

---
 Documentation/filesystems/f2fs.txt | 2 ++
 fs/f2fs/checkpoint.c               | 2 +-
 fs/f2fs/f2fs.h                     | 1 +
 fs/f2fs/super.c                    | 7 +++++++
 4 files changed, 11 insertions(+), 1 deletion(-)
Documentation/filesystems/f2fs.txt +2 -0
index 8088bd9..727373e 100644
@@ -151,6 +151,8 @@ noextent_cache         Disable an extent cache based on rb-tree explicitly, see
                        the above extent_cache mount option.
 noinline_data          Disable the inline data feature, inline data feature is
                        enabled by default.
+data_flush             Enable data flushing during checkpoint in order to
+                       persist data of regular and symlink.
 
 ================================================================================
 DEBUGFS ENTRIES
fs/f2fs/checkpoint.c +1 -1
index a73909c..2fdf271 100644
@@ -855,7 +855,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
 
 retry_flush_datas:
 	/* write all the dirty data pages */
-	if (get_pages(sbi, F2FS_DIRTY_DATAS)) {
+	if (test_opt(sbi, DATA_FLUSH) && get_pages(sbi, F2FS_DIRTY_DATAS)) {
 		sync_dirty_inodes(sbi, FILE_INODE);
 		if (unlikely(f2fs_cp_error(sbi))) {
 			err = -EIO;
fs/f2fs/f2fs.h +1 -0
index 4d44732..ee1f0a8 100644
@@ -54,6 +54,7 @@
 #define F2FS_MOUNT_FASTBOOT		0x00001000
 #define F2FS_MOUNT_EXTENT_CACHE		0x00002000
 #define F2FS_MOUNT_FORCE_FG_GC		0x00004000
+#define F2FS_MOUNT_DATA_FLUSH		0x00008000
 
 #define clear_opt(sbi, option)	(sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)	(sbi->mount_opt.opt |= F2FS_MOUNT_##option)
fs/f2fs/super.c +0 -0
index 051bce6..694e092 100644

fs/f2fs/super.c enum { · line 70

Quoted 4 lines
fs/f2fs/super.c +1 -0
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,

Need Opt_nodata_flush too.

Thanks,

Quoted 33 lines
fs/f2fs/super.c +6 -0
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
Signature · 1 line
2.6.3
author
#3 lore raw

Hi Jaegeuk,

Quoted 58 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, December 16, 2015 6:03 AM
To: Chao Yu
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 7/8] f2fs: introduce new option for controlling data flush

Hi,

Documentation/filesystems/f2fs.txt noextent_cache Disable an extent cache based on rb-tree explicitly,

Quoted 16 lines · Chao Yu

Add a new option 'data_flush' to enable/disable data flush functionality in checkpoint.

---
 Documentation/filesystems/f2fs.txt | 2 ++
 fs/f2fs/checkpoint.c               | 2 +-
 fs/f2fs/f2fs.h                     | 1 +
 fs/f2fs/super.c                    | 7 +++++++
 4 files changed, 11 insertions(+), 1 deletion(-)
Documentation/filesystems/f2fs.txt +0 -0
index 8088bd9..727373e 100644
@@ -151,6 +151,8 @@ noextent_cache         Disable an extent cache based on rb-tree explicitly,

see

Quoted 31 lines
Documentation/filesystems/f2fs.txt +2 -0
                        the above extent_cache mount option.
 noinline_data          Disable the inline data feature, inline data feature is
                        enabled by default.
+data_flush             Enable data flushing during checkpoint in order to
+                       persist data of regular and symlink.
 
 ================================================================================
 DEBUGFS ENTRIES
fs/f2fs/checkpoint.c +1 -1
index a73909c..2fdf271 100644
@@ -855,7 +855,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
 
 retry_flush_datas:
 	/* write all the dirty data pages */
-	if (get_pages(sbi, F2FS_DIRTY_DATAS)) {
+	if (test_opt(sbi, DATA_FLUSH) && get_pages(sbi, F2FS_DIRTY_DATAS)) {
 		sync_dirty_inodes(sbi, FILE_INODE);
 		if (unlikely(f2fs_cp_error(sbi))) {
 			err = -EIO;
fs/f2fs/f2fs.h +1 -0
index 4d44732..ee1f0a8 100644
@@ -54,6 +54,7 @@
 #define F2FS_MOUNT_FASTBOOT		0x00001000
 #define F2FS_MOUNT_EXTENT_CACHE		0x00002000
 #define F2FS_MOUNT_FORCE_FG_GC		0x00004000
+#define F2FS_MOUNT_DATA_FLUSH		0x00008000
 
Quoted 13 lines

fs/f2fs/super.c enum { · line 70

Quoted 11 lines
fs/f2fs/f2fs.h +0 -0
 #define clear_opt(sbi, option)	(sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)	(sbi->mount_opt.opt |= F2FS_MOUNT_##option)
fs/f2fs/super.c +1 -0
index 051bce6..694e092 100644
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,

Need Opt_nodata_flush too.

We need this unless we set data_flush as a default option. Is that right?

Thanks,

Quoted 36 lines

Thanks,

Quoted 33 lines
fs/f2fs/super.c +6 -1
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
--

2.6.3

maintainer
#4 lore raw

Hi Chao,

On Wed, Dec 16, 2015 at 10:38:27AM +0800, Chao Yu wrote:

...

Quoted 10 lines
Quoted 8 lines

fs/f2fs/super.c enum { · line 70

Quoted 6 lines

+++ b/fs/f2fs/super.c

fs/f2fs/super.c +1 -0
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,

Need Opt_nodata_flush too.

We need this unless we set data_flush as a default option. Is that right?

I meant both of them.

Thanks,

Quoted 39 lines

Thanks,

Quoted 36 lines

Thanks,

Quoted 33 lines
fs/f2fs/super.c +6 -1
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
--

2.6.3

author
#5 lore raw

Hi Jaegeuk,

Quoted 22 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, December 16, 2015 10:49 AM
To: Chao Yu
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 7/8] f2fs: introduce new option for controlling data flush

Hi Chao,

On Wed, Dec 16, 2015 at 10:38:27AM +0800, Chao Yu wrote:

...

Quoted 9 lines
Quoted 8 lines

fs/f2fs/super.c enum { · line 70

Quoted 6 lines

+++ b/fs/f2fs/super.c

fs/f2fs/super.c +1 -0
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,

Need Opt_nodata_flush too.

Quoted 3 lines
Quoted 1 line

We need this unless we set data_flush as a default option. Is that right?

I meant both of them.

Yeah, I know that. But the point I meant was:
Normally we can detect user's mount option by test_opt(DATA_FLUSH), but if data_flush option was set as a default option in f2fs, we need to introduce nodata_flush to indicate whether user want to disable it or not, because we can't disable data_flush option by mount without it since f2fs will set data_flush by itself.

So it seems nodata_flush is redundant unless data_flush is set by default.

How do you think of it?

Thanks,

Quoted 42 lines

Thanks,

Quoted 39 lines

Thanks,

Quoted 36 lines

Thanks,

Quoted 33 lines
fs/f2fs/super.c +6 -1
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
--

2.6.3

maintainer
#6 lore raw
Quoted 35 lines · Chao Yu

Hi Jaegeuk,

Quoted 22 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, December 16, 2015 10:49 AM
To: Chao Yu
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 7/8] f2fs: introduce new option for controlling data flush

Hi Chao,

On Wed, Dec 16, 2015 at 10:38:27AM +0800, Chao Yu wrote:

...

Quoted 9 lines
Quoted 8 lines

fs/f2fs/super.c enum { · line 70

Quoted 6 lines

+++ b/fs/f2fs/super.c

fs/f2fs/super.c +1 -0
@@ -67,6 +67,7 @@ enum {
 	Opt_extent_cache,
 	Opt_noextent_cache,
 	Opt_noinline_data,
+	Opt_data_flush,

Need Opt_nodata_flush too.

Quoted 3 lines
Quoted 1 line

We need this unless we set data_flush as a default option. Is that right?

I meant both of them.

Yeah, I know that. But the point I meant was:
Normally we can detect user's mount option by test_opt(DATA_FLUSH), but if data_flush option was set as a default option in f2fs, we need to introduce nodata_flush to indicate whether user want to disable it or not, because we can't disable data_flush option by mount without it since f2fs will set data_flush by itself.

Quoted 3 lines

So it seems nodata_flush is redundant unless data_flush is set by default.

How do you think of it?

Ah, right. I simply thought the remount case, but indeed it always starts with default options. Default is off and turn on by user occasionally.

Thanks,

Quoted 45 lines

Thanks,

Quoted 42 lines

Thanks,

Quoted 39 lines

Thanks,

Quoted 36 lines

Thanks,

Quoted 33 lines
fs/f2fs/super.c +6 -1
 	Opt_nodiscard,
 	Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
 	{Opt_extent_cache, "extent_cache"},
 	{Opt_noextent_cache, "noextent_cache"},
 	{Opt_noinline_data, "noinline_data"},
+	{Opt_data_flush, "data_flush"},
 	{Opt_nodiscard, "nodiscard"},
 	{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_noinline_data:
 			clear_opt(sbi, INLINE_DATA);
 			break;
+		case Opt_data_flush:
+			clear_opt(sbi, DATA_FLUSH);
+			break;
 		default:
 			f2fs_msg(sb, KERN_ERR,
 				"Unrecognized mount option \"%s\" or missing value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",extent_cache");
 	else
 		seq_puts(seq, ",noextent_cache");
+	if (test_opt(sbi, DATA_FLUSH))
+		seq_puts(seq, ",data_flush");
 	seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
 	return 0;
--

2.6.3