[PATCH v2 01/13] f2fs: add inline tail mount option

From: Wu Bo
Date: Tue Sep 10 2024 - 23:43:48 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 ac19c61f0c3e..3956740ca7e2 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 3959fd137cc9..d4ec32ba6cad 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,
@@ -212,6 +214,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"},
@@ -220,6 +223,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"},
@@ -811,6 +815,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;
@@ -835,6 +842,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;
@@ -1989,6 +1999,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
@@ -2138,6 +2152,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