Skip to content
Snippets Groups Projects
Commit 9eac9c02 authored by girish's avatar girish
Browse files

Add ext3 part of Journal Checksum feature.

b=10657
i=adilger
i=kalpak
parent ab8e472f
No related branches found
No related tags found
No related merge requests found
......@@ -18,3 +18,16 @@ Details : This feature will protect the filesystem from being mounted more
to the filesystem if it is mounted. This assumes high importance
in a shared storage environment where multiple mounts can severely
corrupt the filesystem.
Severity : normal
Bugzilla : 10657
Description: Add journal checksum support. (ext3 part)
Details : The journal checksum feature adds two new flags i.e
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT and
JBD2_FEATURE_COMPAT_CHECKSUM. JBD2_FEATURE_CHECKSUM flag
indicates that the commit block contains the checksum for
the blocks described by the descriptor blocks. Now commit
record can be sent to disk without waiting for descriptor
blocks to be written to disk. This behavior is controlled
using JBD2_FEATURE_ASYNC_COMMIT flag.
Index: linux-2.6.18/fs/ext3/super.c
===================================================================
--- linux-2.6.18.orig/fs/ext3/super.c
+++ linux-2.6.18/fs/ext3/super.c
@@ -688,6 +688,9 @@ enum {
Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh,
Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev,
+#ifdef JFS_FEATURE_COMPAT_CHECKSUM
+ Opt_journal_checksum, Opt_journal_async_commit,
+#endif
Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
@@ -730,6 +733,10 @@ static match_table_t tokens = {
{Opt_journal_update, "journal=update"},
{Opt_journal_inum, "journal=%u"},
{Opt_journal_dev, "journal_dev=%u"},
+#ifdef JFS_FEATURE_COMPAT_CHECKSUM
+ {Opt_journal_checksum, "journal_checksum"},
+ {Opt_journal_async_commit, "journal_async_commit"},
+#endif
{Opt_abort, "abort"},
{Opt_data_journal, "data=journal"},
{Opt_data_ordered, "data=ordered"},
@@ -924,6 +931,15 @@ static int parse_options (char *options,
return 0;
*journal_devnum = option;
break;
+#ifdef JFS_FEATURE_COMPAT_CHECKSUM
+ case Opt_journal_checksum:
+ set_opt (sbi->s_mount_opt, JOURNAL_CHECKSUM);
+ break;
+ case Opt_journal_async_commit:
+ set_opt (sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT);
+ set_opt (sbi->s_mount_opt, JOURNAL_CHECKSUM);
+ break;
+#endif
case Opt_noload:
set_opt (sbi->s_mount_opt, NOLOAD);
break;
@@ -2180,6 +2196,23 @@ static int ext3_fill_super (struct super
goto failed_mount3;
}
+#ifdef JFS_FEATURE_COMPAT_CHECKSUM
+ if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
+ journal_set_features(sbi->s_journal,
+ JFS_FEATURE_COMPAT_CHECKSUM, 0,
+ JFS_FEATURE_INCOMPAT_ASYNC_COMMIT);
+ } else if (test_opt(sb, JOURNAL_CHECKSUM)) {
+ journal_set_features(sbi->s_journal,
+ JFS_FEATURE_COMPAT_CHECKSUM, 0, 0);
+ journal_clear_features(sbi->s_journal, 0, 0,
+ JFS_FEATURE_INCOMPAT_ASYNC_COMMIT);
+ } else {
+ journal_clear_features(sbi->s_journal,
+ JFS_FEATURE_COMPAT_CHECKSUM, 0,
+ JFS_FEATURE_INCOMPAT_ASYNC_COMMIT);
+ }
+#endif
+
/* We have now updated the journal if required, so we can
* validate the data journaling mode. */
switch (test_opt(sb, DATA_FLAGS)) {
Index: linux-2.6.18/include/linux/ext3_fs.h
===================================================================
--- linux-2.6.18.orig/include/linux/ext3_fs.h
+++ linux-2.6.18/include/linux/ext3_fs.h
@@ -476,6 +476,11 @@ do { \
#define EXT3_MOUNT_EXTDEBUG 0x4000000/* Extents debug */
#define EXT3_MOUNT_MBALLOC 0x8000000/* Buddy allocation support */
+#ifdef JFS_FEATURE_COMPAT_CHECKSUM
+#define EXT3_MOUNT_JOURNAL_CHECKSUM 0x10000000 /* Journal checksums */
+#define EXT3_MOUNT_JOURNAL_ASYNC_COMMIT 0x20000000 /* Journal Async Commit */
+#endif
+
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
#ifndef clear_opt
#define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
......@@ -15,3 +15,4 @@ ext3-nanosecond-2.6.18-vanilla.patch
ext3-inode-version-2.6.18-vanilla.patch
ext3-mmp-2.6.18-vanilla.patch
ext3-unlink-race.patch
ext3-journal-chksum-2.6.18-vanilla.patch
......@@ -19,3 +19,4 @@ ext3-uninit-2.6-sles10.patch
ext3-nanosecond-2.6-sles10.patch
ext3-inode-version-2.6-sles10.patch
ext3-mmp-2.6-sles10.patch
ext3-journal-chksum-2.6.18-vanilla.patch
......@@ -16,3 +16,4 @@ ext3-nanosecond-2.6.18-vanilla.patch
ext3-inode-version-2.6.18-vanilla.patch
ext3-mmp-2.6.18-vanilla.patch
ext3-handle-directory-corruption-better.patch
ext3-journal-chksum-2.6.18-vanilla.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment