ext4: add fast_commit feature and handling for extended mount options
We are running out of mount option bits. Add handling for using s_mount_opt2. Add ext4 and jbd2 fast commit feature flag and also add ability to turn off the fast commit feature in Ext4. Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Link: https://lore.kernel.org/r/20201015203802.3597742-3-harshadshirwadkar@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:

committed by
Theodore Ts'o

parent
f5b8b297b0
commit
995a3ed67f
@@ -1709,7 +1709,7 @@ enum {
|
||||
Opt_dioread_nolock, Opt_dioread_lock,
|
||||
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
|
||||
Opt_max_dir_size_kb, Opt_nojournal_checksum, Opt_nombcache,
|
||||
Opt_prefetch_block_bitmaps,
|
||||
Opt_prefetch_block_bitmaps, Opt_no_fc,
|
||||
};
|
||||
|
||||
static const match_table_t tokens = {
|
||||
@@ -1796,6 +1796,7 @@ static const match_table_t tokens = {
|
||||
{Opt_init_itable, "init_itable=%u"},
|
||||
{Opt_init_itable, "init_itable"},
|
||||
{Opt_noinit_itable, "noinit_itable"},
|
||||
{Opt_no_fc, "no_fc"},
|
||||
{Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
|
||||
{Opt_test_dummy_encryption, "test_dummy_encryption=%s"},
|
||||
{Opt_test_dummy_encryption, "test_dummy_encryption"},
|
||||
@@ -1922,6 +1923,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
|
||||
#define MOPT_EXT4_ONLY (MOPT_NO_EXT2 | MOPT_NO_EXT3)
|
||||
#define MOPT_STRING 0x0400
|
||||
#define MOPT_SKIP 0x0800
|
||||
#define MOPT_2 0x1000
|
||||
|
||||
static const struct mount_opts {
|
||||
int token;
|
||||
@@ -2022,6 +2024,8 @@ static const struct mount_opts {
|
||||
{Opt_nombcache, EXT4_MOUNT_NO_MBCACHE, MOPT_SET},
|
||||
{Opt_prefetch_block_bitmaps, EXT4_MOUNT_PREFETCH_BLOCK_BITMAPS,
|
||||
MOPT_SET},
|
||||
{Opt_no_fc, EXT4_MOUNT2_JOURNAL_FAST_COMMIT,
|
||||
MOPT_CLEAR | MOPT_2 | MOPT_EXT4_ONLY},
|
||||
{Opt_err, 0, 0}
|
||||
};
|
||||
|
||||
@@ -2398,10 +2402,17 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
|
||||
WARN_ON(1);
|
||||
return -1;
|
||||
}
|
||||
if (arg != 0)
|
||||
sbi->s_mount_opt |= m->mount_opt;
|
||||
else
|
||||
sbi->s_mount_opt &= ~m->mount_opt;
|
||||
if (m->flags & MOPT_2) {
|
||||
if (arg != 0)
|
||||
sbi->s_mount_opt2 |= m->mount_opt;
|
||||
else
|
||||
sbi->s_mount_opt2 &= ~m->mount_opt;
|
||||
} else {
|
||||
if (arg != 0)
|
||||
sbi->s_mount_opt |= m->mount_opt;
|
||||
else
|
||||
sbi->s_mount_opt &= ~m->mount_opt;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -2618,6 +2629,9 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
|
||||
SEQ_OPTS_PUTS("dax=inode");
|
||||
}
|
||||
|
||||
if (test_opt2(sb, JOURNAL_FAST_COMMIT))
|
||||
SEQ_OPTS_PUTS("fast_commit");
|
||||
|
||||
ext4_show_quota_options(seq, sb);
|
||||
return 0;
|
||||
}
|
||||
@@ -4121,6 +4135,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||
#ifdef CONFIG_EXT4_FS_POSIX_ACL
|
||||
set_opt(sb, POSIX_ACL);
|
||||
#endif
|
||||
if (ext4_has_feature_fast_commit(sb))
|
||||
set_opt2(sb, JOURNAL_FAST_COMMIT);
|
||||
/* don't forget to enable journal_csum when metadata_csum is enabled. */
|
||||
if (ext4_has_metadata_csum(sb))
|
||||
set_opt(sb, JOURNAL_CHECKSUM);
|
||||
@@ -4777,6 +4793,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||
sbi->s_def_mount_opt &= ~EXT4_MOUNT_JOURNAL_CHECKSUM;
|
||||
clear_opt(sb, JOURNAL_CHECKSUM);
|
||||
clear_opt(sb, DATA_FLAGS);
|
||||
clear_opt2(sb, JOURNAL_FAST_COMMIT);
|
||||
sbi->s_journal = NULL;
|
||||
needs_recovery = 0;
|
||||
goto no_journal;
|
||||
|
Reference in New Issue
Block a user