1 ext4: Add EXT4_DEFM_BARRIER and EXT4_DEFM_I_VERSION default mount options
3 Allow the i_version and barrier mount options to be set by default via
4 flags in the ext4 superblock.
6 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
9 fs/ext4/super.c | 10 ++++++++--
10 2 files changed, 10 insertions(+), 2 deletions(-)
12 Index: linux-2.6.26-rc4/fs/ext4/ext4.h
13 ===================================================================
14 --- linux-2.6.26-rc4.orig/fs/ext4/ext4.h 2008-05-29 10:52:32.000000000 -0700
15 +++ linux-2.6.26-rc4/fs/ext4/ext4.h 2008-05-29 10:52:37.000000000 -0700
16 @@ -785,6 +785,8 @@ static inline int ext4_valid_inum(struct
17 #define EXT4_DEFM_JMODE_DATA 0x0020
18 #define EXT4_DEFM_JMODE_ORDERED 0x0040
19 #define EXT4_DEFM_JMODE_WBACK 0x0060
20 +#define EXT4_DEFM_BARRIER 0x0080
21 +#define EXT4_DEFM_I_VERSION 0x0100
24 * Structure of a directory entry
25 Index: linux-2.6.26-rc4/fs/ext4/super.c
26 ===================================================================
27 --- linux-2.6.26-rc4.orig/fs/ext4/super.c 2008-05-29 10:52:28.000000000 -0700
28 +++ linux-2.6.26-rc4/fs/ext4/super.c 2008-05-29 10:52:37.000000000 -0700
29 @@ -729,7 +729,7 @@ static int ext4_show_options(struct seq_
30 seq_printf(seq, ",commit=%u",
31 (unsigned) (sbi->s_commit_interval / HZ));
33 - if (test_opt(sb, BARRIER))
34 + if (test_opt(sb, BARRIER) && !(def_mount_opts & EXT4_DEFM_BARRIER))
35 seq_puts(seq, ",barrier=1");
36 if (test_opt(sb, NOBH))
37 seq_puts(seq, ",nobh");
38 @@ -737,7 +737,7 @@ static int ext4_show_options(struct seq_
39 seq_puts(seq, ",noextents");
40 if (!test_opt(sb, MBALLOC))
41 seq_puts(seq, ",nomballoc");
42 - if (test_opt(sb, I_VERSION))
43 + if (test_opt(sb, I_VERSION) && !(def_mount_opts & EXT4_DEFM_I_VERSION))
44 seq_puts(seq, ",i_version");
47 @@ -1896,6 +1896,12 @@ static int ext4_fill_super (struct super
48 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_WBACK)
49 sbi->s_mount_opt |= EXT4_MOUNT_WRITEBACK_DATA;
51 + if (def_mount_opts & EXT4_DEFM_BARRIER)
52 + set_opt(sbi->s_mount_opt, BARRIER);
54 + if (def_mount_opts & EXT4_DEFM_I_VERSION)
55 + sb->s_flags |= MS_I_VERSION;
57 if (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_PANIC)
58 set_opt(sbi->s_mount_opt, ERRORS_PANIC);
59 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_CONTINUE)