1 ext4: automatically enable journal_async_commit on ext4 file systems
3 Now that we have cleaned up journal_async_commit, it's safe to enable
4 it all the time. But we only want to do so if ext4-specific INCOMPAT
5 features are enabled, since otherwise we will prevent the filesystem
6 from being mounted using ext3.
8 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 Documentation/filesystems/ext4.txt | 11 ++++++++---
12 fs/ext4/super.c | 29 ++++++++++++++++++++++++++---
13 2 files changed, 34 insertions(+), 6 deletions(-)
15 diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
16 index 6ab9442..713f5d5 100644
17 --- a/Documentation/filesystems/ext4.txt
18 +++ b/Documentation/filesystems/ext4.txt
19 @@ -140,9 +140,14 @@ journal_checksum Enable checksumming of the journal transactions.
20 compatible change and will be ignored by older kernels.
22 journal_async_commit Commit block can be written to disk without waiting
23 - for descriptor blocks. If enabled older kernels cannot
24 - mount the device. This will enable 'journal_checksum'
26 + for descriptor blocks. This will enable
27 + 'journal_checksum' internally. This mount
28 + option will be automatically enabled if
29 + ext4-specific INCOMPAT features are present in
32 +nojournal_async_commit Disable the journal_async_commit option, even
33 + for ext4 filesystems.
35 journal=update Update the ext4 file system's journal to the current
37 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
38 index 9706981..d719551 100644
41 @@ -203,6 +203,15 @@ void ext4_itable_unused_set(struct super_block *sb,
42 bg->bg_itable_unused_hi = cpu_to_le16(count >> 16);
46 + * If ext4 filesystem features are enabled, then enable async_commits
49 +#define ASYNC_COMMIT_DEFAULT(sb) (EXT4_HAS_INCOMPAT_FEATURE(sb, \
50 + (EXT4_FEATURE_INCOMPAT_EXTENTS| \
51 + EXT4_FEATURE_INCOMPAT_64BIT| \
52 + EXT4_FEATURE_INCOMPAT_FLEX_BG)))
55 /* Just increment the non-pointer handle value */
56 static handle_t *ext4_get_nojournal(void)
57 @@ -1020,9 +1029,15 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
59 seq_puts(seq, ",barrier=");
60 seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
61 - if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
62 - seq_puts(seq, ",journal_async_commit");
63 - else if (test_opt(sb, JOURNAL_CHECKSUM))
64 + if (ASYNC_COMMIT_DEFAULT(sb)) {
65 + if (!test_opt(sb, JOURNAL_ASYNC_COMMIT))
66 + seq_puts(seq, ",nojournal_async_commit");
68 + if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
69 + seq_puts(seq, ",journal_async_commit");
71 + if (test_opt(sb, JOURNAL_CHECKSUM) &&
72 + !test_opt(sb, JOURNAL_ASYNC_COMMIT))
73 seq_puts(seq, ",journal_checksum");
74 if (test_opt(sb, I_VERSION))
75 seq_puts(seq, ",i_version");
76 @@ -1239,6 +1254,7 @@ enum {
77 Opt_commit, Opt_min_batch_time, Opt_max_batch_time,
78 Opt_journal_update, Opt_journal_dev,
79 Opt_journal_checksum, Opt_journal_async_commit,
80 + Opt_nojournal_async_commit,
81 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
82 Opt_data_err_abort, Opt_data_err_ignore,
83 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
84 @@ -1285,6 +1301,7 @@ static const match_table_t tokens = {
85 {Opt_journal_dev, "journal_dev=%u"},
86 {Opt_journal_checksum, "journal_checksum"},
87 {Opt_journal_async_commit, "journal_async_commit"},
88 + {Opt_nojournal_async_commit, "nojournal_async_commit"},
90 {Opt_data_journal, "data=journal"},
91 {Opt_data_ordered, "data=ordered"},
92 @@ -1559,6 +1576,9 @@ static int parse_options(char *options, struct super_block *sb,
93 set_opt(sb, JOURNAL_ASYNC_COMMIT);
94 set_opt(sb, JOURNAL_CHECKSUM);
96 + case Opt_nojournal_async_commit:
97 + clear_opt(sb, JOURNAL_ASYNC_COMMIT);
102 @@ -3161,6 +3181,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
103 ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))
104 set_opt(sb, DELALLOC);
106 + if (ASYNC_COMMIT_DEFAULT(sb))
107 + set_opt(sb, JOURNAL_ASYNC_COMMIT);
109 if (!parse_options((char *) sbi->s_es->s_mount_opts, sb,
110 &journal_devnum, &journal_ioprio, NULL, 0)) {
111 ext4_msg(sb, KERN_WARNING,