aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jbd2.h
diff options
context:
space:
mode:
authorGirish Shilamkar <girish@clusterfs.com>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commit818d276ceb83aa9fdebb5e0a53188290312de987 (patch)
treede3fb4ffadd72caea2876c5232ce76cd14b3646e /include/linux/jbd2.h
parent8e85fb3f305b24b79c6d9cb7a56d22b062335ad3 (diff)
ext4: Add the journal checksum feature
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. Due to checksums, writing of the commit record no longer needs to be synchronous. 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. Older kernels/e2fsck should not be able to recover the journal with _ASYNC_COMMIT hence it is made incompat. The commit header has been extended to hold the checksum along with the type of the checksum. For recovery in pass scan checksums are verified to ensure the sanity and completeness(in case of _ASYNC_COMMIT) of every transaction. Signed-off-by: Andreas Dilger <adilger@clusterfs.com> Signed-off-by: Girish Shilamkar <girish@clusterfs.com> Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r--include/linux/jbd2.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 685640036e81..98a2bc5d3e3f 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -149,6 +149,28 @@ typedef struct journal_header_s
149 __be32 h_sequence; 149 __be32 h_sequence;
150} journal_header_t; 150} journal_header_t;
151 151
152/*
153 * Checksum types.
154 */
155#define JBD2_CRC32_CHKSUM 1
156#define JBD2_MD5_CHKSUM 2
157#define JBD2_SHA1_CHKSUM 3
158
159#define JBD2_CRC32_CHKSUM_SIZE 4
160
161#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
162/*
163 * Commit block header for storing transactional checksums:
164 */
165struct commit_header {
166 __be32 h_magic;
167 __be32 h_blocktype;
168 __be32 h_sequence;
169 unsigned char h_chksum_type;
170 unsigned char h_chksum_size;
171 unsigned char h_padding[2];
172 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
173};
152 174
153/* 175/*
154 * The block tag: used to describe a single buffer in the journal. 176 * The block tag: used to describe a single buffer in the journal.
@@ -242,14 +264,18 @@ typedef struct journal_superblock_s
242 ((j)->j_format_version >= 2 && \ 264 ((j)->j_format_version >= 2 && \
243 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) 265 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
244 266
245#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001 267#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
246#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 268
269#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
270#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
271#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
247 272
248/* Features known to this kernel version: */ 273/* Features known to this kernel version: */
249#define JBD2_KNOWN_COMPAT_FEATURES 0 274#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
250#define JBD2_KNOWN_ROCOMPAT_FEATURES 0 275#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
251#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ 276#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
252 JBD2_FEATURE_INCOMPAT_64BIT) 277 JBD2_FEATURE_INCOMPAT_64BIT | \
278 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
253 279
254#ifdef __KERNEL__ 280#ifdef __KERNEL__
255 281
@@ -997,6 +1023,8 @@ extern int jbd2_journal_check_available_features
997 (journal_t *, unsigned long, unsigned long, unsigned long); 1023 (journal_t *, unsigned long, unsigned long, unsigned long);
998extern int jbd2_journal_set_features 1024extern int jbd2_journal_set_features
999 (journal_t *, unsigned long, unsigned long, unsigned long); 1025 (journal_t *, unsigned long, unsigned long, unsigned long);
1026extern void jbd2_journal_clear_features
1027 (journal_t *, unsigned long, unsigned long, unsigned long);
1000extern int jbd2_journal_create (journal_t *); 1028extern int jbd2_journal_create (journal_t *);
1001extern int jbd2_journal_load (journal_t *journal); 1029extern int jbd2_journal_load (journal_t *journal);
1002extern void jbd2_journal_destroy (journal_t *); 1030extern void jbd2_journal_destroy (journal_t *);