aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/jbd2.h
diff options
context:
space:
mode:
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>2020-11-20 12:22:32 -0800
committerTheodore Ts'o <tytso@mit.edu>2020-12-17 13:30:45 -0500
commit9bd23c31f392bda88618008f27fd52ee9e0fac38 (patch)
treef49df76debd74e9dac011a19cc59e0668b5247c5 /include/linux/jbd2.h
parentext4: make fast_commit.h byte identical with e2fsprogs/fast_commit.h (diff)
downloadwireguard-linux-9bd23c31f392bda88618008f27fd52ee9e0fac38.tar.xz
wireguard-linux-9bd23c31f392bda88618008f27fd52ee9e0fac38.zip
jbd2: add a helper to find out number of fast commit blocks
Add a helper to read number of fast commit blocks from jbd2 superblock and also rename the JBD2_MIN_FC_BLKS to JBD2_DEFAULT_FAST_COMMIT_BLOCKS since this constant is just the default number of fast commit blocks to use in case number of fast commit blocks isn't set in jbd2 superblock. Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Link: https://lore.kernel.org/r/20201120202232.2240293-2-harshadshirwadkar@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r--include/linux/jbd2.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d2a4860feb72..99d3cd051ac3 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -68,7 +68,7 @@ extern void *jbd2_alloc(size_t size, gfp_t flags);
extern void jbd2_free(void *ptr, size_t size);
#define JBD2_MIN_JOURNAL_BLOCKS 1024
-#define JBD2_MIN_FC_BLOCKS 256
+#define JBD2_DEFAULT_FAST_COMMIT_BLOCKS 256
#ifdef __KERNEL__
@@ -1692,6 +1692,13 @@ static inline int jbd2_journal_has_csum_v2or3(journal_t *journal)
return journal->j_chksum_driver != NULL;
}
+static inline int jbd2_journal_get_num_fc_blks(journal_superblock_t *jsb)
+{
+ int num_fc_blocks = be32_to_cpu(jsb->s_num_fc_blks);
+
+ return num_fc_blocks ? num_fc_blocks : JBD2_DEFAULT_FAST_COMMIT_BLOCKS;
+}
+
/*
* Return number of free blocks in the log. Must be called under j_state_lock.
*/