1 ext4: add debug_want_extra_isize mount option
3 In order to test the inode extra isize expansion code, it is useful to
4 be able to easily create file systems that have inodes with extra
5 isize values smaller than the current desired value.
7 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 fs/ext4/super.c | 9 +++++++--
10 1 file changed, 7 insertions(+), 2 deletions(-)
12 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
13 index 9d15a6293124..829e4a7b59e4 100644
16 @@ -1284,7 +1284,7 @@ enum {
17 Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err,
18 Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_i_version, Opt_dax,
19 Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_mblk_io_submit,
20 - Opt_lazytime, Opt_nolazytime,
21 + Opt_lazytime, Opt_nolazytime, Opt_debug_want_extra_isize,
22 Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
23 Opt_inode_readahead_blks, Opt_journal_ioprio,
24 Opt_dioread_nolock, Opt_dioread_lock,
25 @@ -1352,6 +1352,7 @@ static const match_table_t tokens = {
26 {Opt_delalloc, "delalloc"},
27 {Opt_lazytime, "lazytime"},
28 {Opt_nolazytime, "nolazytime"},
29 + {Opt_debug_want_extra_isize, "debug_want_extra_isize=%u"},
30 {Opt_nodelalloc, "nodelalloc"},
31 {Opt_removed, "mblk_io_submit"},
32 {Opt_removed, "nomblk_io_submit"},
33 @@ -1557,6 +1558,7 @@ static const struct mount_opts {
35 {Opt_nouid32, EXT4_MOUNT_NO_UID32, MOPT_SET},
36 {Opt_debug, EXT4_MOUNT_DEBUG, MOPT_SET},
37 + {Opt_debug_want_extra_isize, 0, MOPT_GTE0},
38 {Opt_quota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA, MOPT_SET | MOPT_Q},
39 {Opt_usrquota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA,
41 @@ -1670,6 +1672,8 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
43 arg = JBD2_DEFAULT_MAX_COMMIT_AGE;
44 sbi->s_commit_interval = HZ * arg;
45 + } else if (token == Opt_debug_want_extra_isize) {
46 + sbi->s_want_extra_isize = arg;
47 } else if (token == Opt_max_batch_time) {
48 sbi->s_max_batch_time = arg;
49 } else if (token == Opt_min_batch_time) {
50 @@ -4081,7 +4085,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
51 sb->s_flags |= MS_RDONLY;
53 /* determine the minimum size of new large inodes, if present */
54 - if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
55 + if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE &&
56 + sbi->s_want_extra_isize == 0) {
57 sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
58 EXT4_GOOD_OLD_INODE_SIZE;
59 if (ext4_has_feature_extra_isize(sb)) {