[RFC PATCH 1/5] f2fs: add inline tail mount option
From: Wu Bo
Date: Tue Jul 09 2024 - 21:19:31 EST
Same as inline data, use mount option to control inline tail enable or
disable. And enable inline tail as default.
Signed-off-by: Wu Bo <bo.wu@xxxxxxxx>
---
fs/f2fs/f2fs.h | 1 +
fs/f2fs/super.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 1974b6aff397..a1d8d8e0a49a 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -116,6 +116,7 @@ extern const char *f2fs_fault_name[FAULT_MAX];
#define F2FS_MOUNT_GC_MERGE 0x02000000
#define F2FS_MOUNT_COMPRESS_CACHE 0x04000000
#define F2FS_MOUNT_AGE_EXTENT_CACHE 0x08000000
+#define F2FS_MOUNT_INLINE_TAIL 0x10000000
#define F2FS_OPTION(sbi) ((sbi)->mount_opt)
#define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 1f1b3647a998..5cd0466cb37f 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -136,6 +136,7 @@ enum {
Opt_inline_data,
Opt_inline_dentry,
Opt_noinline_dentry,
+ Opt_inline_tail,
Opt_flush_merge,
Opt_noflush_merge,
Opt_barrier,
@@ -144,6 +145,7 @@ enum {
Opt_extent_cache,
Opt_noextent_cache,
Opt_noinline_data,
+ Opt_noinline_tail,
Opt_data_flush,
Opt_reserve_root,
Opt_resgid,
@@ -214,6 +216,7 @@ static match_table_t f2fs_tokens = {
{Opt_inline_data, "inline_data"},
{Opt_inline_dentry, "inline_dentry"},
{Opt_noinline_dentry, "noinline_dentry"},
+ {Opt_inline_tail, "inline_tail"},
{Opt_flush_merge, "flush_merge"},
{Opt_noflush_merge, "noflush_merge"},
{Opt_barrier, "barrier"},
@@ -222,6 +225,7 @@ static match_table_t f2fs_tokens = {
{Opt_extent_cache, "extent_cache"},
{Opt_noextent_cache, "noextent_cache"},
{Opt_noinline_data, "noinline_data"},
+ {Opt_noinline_tail, "noinline_tail"},
{Opt_data_flush, "data_flush"},
{Opt_reserve_root, "reserve_root=%u"},
{Opt_resgid, "resgid=%u"},
@@ -815,6 +819,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
case Opt_noinline_dentry:
clear_opt(sbi, INLINE_DENTRY);
break;
+ case Opt_inline_tail:
+ set_opt(sbi, INLINE_TAIL);
+ break;
case Opt_flush_merge:
set_opt(sbi, FLUSH_MERGE);
break;
@@ -839,6 +846,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
case Opt_noinline_data:
clear_opt(sbi, INLINE_DATA);
break;
+ case Opt_noinline_tail:
+ clear_opt(sbi, INLINE_DATA);
+ break;
case Opt_data_flush:
set_opt(sbi, DATA_FLUSH);
break;
@@ -1999,6 +2009,10 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
seq_puts(seq, ",inline_data");
else
seq_puts(seq, ",noinline_data");
+ if (test_opt(sbi, INLINE_TAIL))
+ seq_puts(seq, ",inline_tail");
+ else
+ seq_puts(seq, ",noinline_tail");
if (test_opt(sbi, INLINE_DENTRY))
seq_puts(seq, ",inline_dentry");
else
@@ -2148,6 +2162,7 @@ static void default_options(struct f2fs_sb_info *sbi, bool remount)
set_opt(sbi, INLINE_XATTR);
set_opt(sbi, INLINE_DATA);
set_opt(sbi, INLINE_DENTRY);
+ set_opt(sbi, INLINE_TAIL);
set_opt(sbi, MERGE_CHECKPOINT);
F2FS_OPTION(sbi).unusable_cap = 0;
sbi->sb->s_flags |= SB_LAZYTIME;
--
2.35.3