Whamcloud - gitweb
Add ext3 part of Journal Checksum feature.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-journal-chksum-2.6.18-vanilla.patch
1 Index: linux-2.6.18/fs/ext3/super.c
2 ===================================================================
3 --- linux-2.6.18.orig/fs/ext3/super.c
4 +++ linux-2.6.18/fs/ext3/super.c
5 @@ -688,6 +688,9 @@ enum {
6         Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
7         Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh,
8         Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev,
9 +#ifdef JFS_FEATURE_COMPAT_CHECKSUM
10 +       Opt_journal_checksum, Opt_journal_async_commit,
11 +#endif
12         Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
13         Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
14         Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
15 @@ -730,6 +733,10 @@ static match_table_t tokens = {
16         {Opt_journal_update, "journal=update"},
17         {Opt_journal_inum, "journal=%u"},
18         {Opt_journal_dev, "journal_dev=%u"},
19 +#ifdef JFS_FEATURE_COMPAT_CHECKSUM
20 +       {Opt_journal_checksum, "journal_checksum"},
21 +       {Opt_journal_async_commit, "journal_async_commit"},
22 +#endif
23         {Opt_abort, "abort"},
24         {Opt_data_journal, "data=journal"},
25         {Opt_data_ordered, "data=ordered"},
26 @@ -924,6 +931,15 @@ static int parse_options (char *options,
27                                 return 0;
28                         *journal_devnum = option;
29                         break;
30 +#ifdef JFS_FEATURE_COMPAT_CHECKSUM
31 +               case Opt_journal_checksum:
32 +                       set_opt (sbi->s_mount_opt, JOURNAL_CHECKSUM);
33 +                       break;
34 +               case Opt_journal_async_commit:
35 +                       set_opt (sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT);
36 +                       set_opt (sbi->s_mount_opt, JOURNAL_CHECKSUM);
37 +                       break;
38 +#endif
39                 case Opt_noload:
40                         set_opt (sbi->s_mount_opt, NOLOAD);
41                         break;
42 @@ -2180,6 +2196,23 @@ static int ext3_fill_super (struct super
43                 goto failed_mount3;
44         }
45  
46 +#ifdef JFS_FEATURE_COMPAT_CHECKSUM
47 +       if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
48 +               journal_set_features(sbi->s_journal,
49 +                               JFS_FEATURE_COMPAT_CHECKSUM, 0,
50 +                               JFS_FEATURE_INCOMPAT_ASYNC_COMMIT);
51 +       } else if (test_opt(sb, JOURNAL_CHECKSUM)) {
52 +               journal_set_features(sbi->s_journal,
53 +                               JFS_FEATURE_COMPAT_CHECKSUM, 0, 0);
54 +               journal_clear_features(sbi->s_journal, 0, 0,
55 +                               JFS_FEATURE_INCOMPAT_ASYNC_COMMIT);
56 +       } else {
57 +               journal_clear_features(sbi->s_journal,
58 +                               JFS_FEATURE_COMPAT_CHECKSUM, 0,
59 +                               JFS_FEATURE_INCOMPAT_ASYNC_COMMIT);
60 +       }
61 +#endif
62 +
63         /* We have now updated the journal if required, so we can
64          * validate the data journaling mode. */
65         switch (test_opt(sb, DATA_FLAGS)) {
66 Index: linux-2.6.18/include/linux/ext3_fs.h
67 ===================================================================
68 --- linux-2.6.18.orig/include/linux/ext3_fs.h
69 +++ linux-2.6.18/include/linux/ext3_fs.h
70 @@ -476,6 +476,11 @@ do {                                                                              \
71  #define EXT3_MOUNT_EXTDEBUG             0x4000000/* Extents debug */
72  #define EXT3_MOUNT_MBALLOC             0x8000000/* Buddy allocation support */
73  
74 +#ifdef JFS_FEATURE_COMPAT_CHECKSUM
75 +#define EXT3_MOUNT_JOURNAL_CHECKSUM     0x10000000 /* Journal checksums */
76 +#define EXT3_MOUNT_JOURNAL_ASYNC_COMMIT 0x20000000 /* Journal Async Commit */
77 +#endif
78 +
79  /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
80  #ifndef clear_opt
81  #define clear_opt(o, opt)              o &= ~EXT3_MOUNT_##opt