diff options
author | Harshad Shirwadkar <harshadshirwadkar@gmail.com> | 2020-10-15 13:37:59 -0700 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-10-21 23:22:38 -0400 |
commit | 8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2 (patch) | |
tree | d34436d4b4826d877360171d7ab89945dc13a90f /fs/ext4/super.c | |
parent | 5b849b5f96b47d82b5a432d8b91a8ad260e1de46 (diff) | |
download | linux-8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2.tar.gz linux-8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2.tar.bz2 linux-8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2.zip |
ext4: fast commit recovery path
This patch adds fast commit recovery path support for Ext4 file
system. We add several helper functions that are similar in spirit to
e2fsprogs journal recovery path handlers. Example of such functions
include - a simple block allocator, idempotent block bitmap update
function etc. Using these routines and the fast commit log in the fast
commit area, the recovery path (ext4_fc_replay()) performs fast commit
log recovery.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20201015203802.3597742-8-harshadshirwadkar@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 10c4df26d257..9fcf1e3dfe76 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1718,6 +1718,9 @@ enum { 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_no_fc, +#ifdef CONFIG_EXT4_DEBUG + Opt_fc_debug_max_replay +#endif }; static const match_table_t tokens = { @@ -1805,6 +1808,9 @@ static const match_table_t tokens = { {Opt_init_itable, "init_itable"}, {Opt_noinit_itable, "noinit_itable"}, {Opt_no_fc, "no_fc"}, +#ifdef CONFIG_EXT4_DEBUG + {Opt_fc_debug_max_replay, "fc_debug_max_replay=%u"}, +#endif {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"}, @@ -2034,6 +2040,9 @@ static const struct mount_opts { MOPT_SET}, {Opt_no_fc, EXT4_MOUNT2_JOURNAL_FAST_COMMIT, MOPT_CLEAR | MOPT_2 | MOPT_EXT4_ONLY}, +#ifdef CONFIG_EXT4_DEBUG + {Opt_fc_debug_max_replay, 0, MOPT_GTE0}, +#endif {Opt_err, 0, 0} }; @@ -2242,6 +2251,10 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, sbi->s_li_wait_mult = arg; } else if (token == Opt_max_dir_size_kb) { sbi->s_max_dir_size_kb = arg; +#ifdef CONFIG_EXT4_DEBUG + } else if (token == Opt_fc_debug_max_replay) { + sbi->s_fc_debug_max_replay = arg; +#endif } else if (token == Opt_stripe) { sbi->s_stripe = arg; } else if (token == Opt_resuid) { @@ -4764,6 +4777,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) sbi->s_mount_state &= ~EXT4_FC_COMMITTING; spin_lock_init(&sbi->s_fc_lock); memset(&sbi->s_fc_stats, 0, sizeof(sbi->s_fc_stats)); + sbi->s_fc_replay_state.fc_regions = NULL; + sbi->s_fc_replay_state.fc_regions_size = 0; + sbi->s_fc_replay_state.fc_regions_used = 0; + sbi->s_fc_replay_state.fc_regions_valid = 0; + sbi->s_fc_replay_state.fc_modified_inodes = NULL; + sbi->s_fc_replay_state.fc_modified_inodes_size = 0; + sbi->s_fc_replay_state.fc_modified_inodes_used = 0; sb->s_root = NULL; @@ -4979,6 +4999,7 @@ no_journal: goto failed_mount4a; } } + ext4_fc_replay_cleanup(sb); ext4_ext_init(sb); err = ext4_mb_init(sb); |