Update crypto patches
[ext4-patch-queue.git] / create-nojournal_checksum-mount-option
blob40aeab3937fbfd73f0c16d3c60d92c85ba78258d
1 ext4: create nojournal_checksum mount option
3 From: "Darrick J. Wong" <darrick.wong@oracle.com>
5 Create a mount option to disable journal checksumming (because the
6 metadata_csum feature turns it on by default now), and fix remount not
7 to allow changing the journal checksumming option, since changing the
8 mount options has no effect on the journal.
10 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/super.c |   13 ++++++++++++-
14  1 file changed, 12 insertions(+), 1 deletion(-)
17 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
18 index 5d51dbf..bf46927 100644
19 --- a/fs/ext4/super.c
20 +++ b/fs/ext4/super.c
21 @@ -1166,7 +1166,7 @@ enum {
22         Opt_inode_readahead_blks, Opt_journal_ioprio,
23         Opt_dioread_nolock, Opt_dioread_lock,
24         Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
25 -       Opt_max_dir_size_kb,
26 +       Opt_max_dir_size_kb, Opt_nojournal_checksum,
27  };
29  static const match_table_t tokens = {
30 @@ -1200,6 +1200,7 @@ static const match_table_t tokens = {
31         {Opt_journal_dev, "journal_dev=%u"},
32         {Opt_journal_path, "journal_path=%s"},
33         {Opt_journal_checksum, "journal_checksum"},
34 +       {Opt_nojournal_checksum, "nojournal_checksum"},
35         {Opt_journal_async_commit, "journal_async_commit"},
36         {Opt_abort, "abort"},
37         {Opt_data_journal, "data=journal"},
38 @@ -1381,6 +1382,8 @@ static const struct mount_opts {
39          MOPT_EXT4_ONLY | MOPT_SET | MOPT_EXPLICIT},
40         {Opt_nodelalloc, EXT4_MOUNT_DELALLOC,
41          MOPT_EXT4_ONLY | MOPT_CLEAR},
42 +       {Opt_nojournal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
43 +        MOPT_EXT4_ONLY | MOPT_CLEAR},
44         {Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
45          MOPT_EXT4_ONLY | MOPT_SET},
46         {Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT |
47 @@ -4837,6 +4840,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
48                 goto restore_opts;
49         }
51 +       if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^
52 +           test_opt(sb, JOURNAL_CHECKSUM)) {
53 +               ext4_msg(sb, KERN_ERR, "changing journal_checksum "
54 +                        "during remount not supported");
55 +               err = -EINVAL;
56 +               goto restore_opts;
57 +       }
59         if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
60                 if (test_opt2(sb, EXPLICIT_DELALLOC)) {
61                         ext4_msg(sb, KERN_ERR, "can't mount with "