Commit e029c5f2 authored by Harshad Shirwadkar's avatar Harshad Shirwadkar Committed by Theodore Ts'o

ext4: make num of fast commit blocks configurable

This patch reserves a field in the jbd2 superblock for number of fast
commit blocks. When this value is non-zero, Ext4 uses this field to
set the number of fast commit blocks.

Fixes: 6866d7b3 ("ext4/jbd2: add fast commit initialization")
Signed-off-by: default avatarHarshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20201027044915.2553163-2-harshadshirwadkar@gmail.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent d0520df7
...@@ -2077,6 +2077,8 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh, ...@@ -2077,6 +2077,8 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh,
void ext4_fc_init(struct super_block *sb, journal_t *journal) void ext4_fc_init(struct super_block *sb, journal_t *journal)
{ {
int num_fc_blocks;
/* /*
* We set replay callback even if fast commit disabled because we may * We set replay callback even if fast commit disabled because we may
* could still have fast commit blocks that need to be replayed even if * could still have fast commit blocks that need to be replayed even if
...@@ -2086,7 +2088,15 @@ void ext4_fc_init(struct super_block *sb, journal_t *journal) ...@@ -2086,7 +2088,15 @@ void ext4_fc_init(struct super_block *sb, journal_t *journal)
if (!test_opt2(sb, JOURNAL_FAST_COMMIT)) if (!test_opt2(sb, JOURNAL_FAST_COMMIT))
return; return;
journal->j_fc_cleanup_callback = ext4_fc_cleanup; journal->j_fc_cleanup_callback = ext4_fc_cleanup;
if (jbd2_fc_init(journal, EXT4_NUM_FC_BLKS)) { if (!buffer_uptodate(journal->j_sb_buffer)
&& ext4_read_bh_lock(journal->j_sb_buffer, REQ_META | REQ_PRIO,
true)) {
ext4_msg(sb, KERN_ERR, "I/O error on journal");
return;
}
num_fc_blocks = be32_to_cpu(journal->j_superblock->s_num_fc_blks);
if (jbd2_fc_init(journal, num_fc_blocks ? num_fc_blocks :
EXT4_NUM_FC_BLKS)) {
pr_warn("Error while enabling fast commits, turning off."); pr_warn("Error while enabling fast commits, turning off.");
ext4_clear_feature_fast_commit(sb); ext4_clear_feature_fast_commit(sb);
} }
......
...@@ -263,7 +263,10 @@ typedef struct journal_superblock_s ...@@ -263,7 +263,10 @@ typedef struct journal_superblock_s
/* 0x0050 */ /* 0x0050 */
__u8 s_checksum_type; /* checksum type */ __u8 s_checksum_type; /* checksum type */
__u8 s_padding2[3]; __u8 s_padding2[3];
__u32 s_padding[42]; /* 0x0054 */
__be32 s_num_fc_blks; /* Number of fast commit blocks */
/* 0x0058 */
__u32 s_padding[41];
__be32 s_checksum; /* crc32c(superblock) */ __be32 s_checksum; /* crc32c(superblock) */
/* 0x0100 */ /* 0x0100 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment