Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / jbd-journal-chksum-2.6.18-vanilla.patch
1 Index: linux-2.6.18-8.1.8/fs/jbd/commit.c
2 ===================================================================
3 --- linux-2.6.18-8.1.8.orig/fs/jbd/commit.c
4 +++ linux-2.6.18-8.1.8/fs/jbd/commit.c
5 @@ -21,6 +21,7 @@
6  #include <linux/mm.h>
7  #include <linux/pagemap.h>
8  #include <linux/smp_lock.h>
9 +#include <linux/crc32.h>
10  
11  /*
12   * Default IO end handler for temporary BJ_IO buffer_heads.
13 @@ -93,19 +94,23 @@ static int inverted_lock(journal_t *jour
14         return 1;
15  }
16  
17 -/* Done it all: now write the commit record.  We should have
18 +/*
19 + * Done it all: now submit the commit record.  We should have
20   * cleaned up our previous buffers by now, so if we are in abort
21   * mode we can now just skip the rest of the journal write
22   * entirely.
23   *
24   * Returns 1 if the journal needs to be aborted or 0 on success
25   */
26 -static int journal_write_commit_record(journal_t *journal,
27 -                                       transaction_t *commit_transaction)
28 +static int journal_submit_commit_record(journal_t *journal,
29 +                                       transaction_t *commit_transaction,
30 +                                       struct buffer_head **cbh,
31 +                                       __u32 crc32_sum)
32  {
33         struct journal_head *descriptor;
34 +       struct commit_header *tmp;
35         struct buffer_head *bh;
36 -       int i, ret;
37 +       int ret;
38         int barrier_done = 0;
39  
40         if (is_journal_aborted(journal))
41 @@ -117,21 +122,34 @@ static int journal_write_commit_record(j
42  
43         bh = jh2bh(descriptor);
44  
45 -       /* AKPM: buglet - add `i' to tmp! */
46 -       for (i = 0; i < bh->b_size; i += 512) {
47 -               journal_header_t *tmp = (journal_header_t*)bh->b_data;
48 -               tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
49 -               tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
50 -               tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
51 +       tmp = (struct commit_header *)bh->b_data;
52 +       tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
53 +       tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
54 +       tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
55 +                               
56 +       if (JFS_HAS_COMPAT_FEATURE(journal,
57 +                               JFS_FEATURE_COMPAT_CHECKSUM)) {
58 +               tmp->h_chksum_type      = JFS_CRC32_CHKSUM;
59 +               tmp->h_chksum_size      = JFS_CRC32_CHKSUM_SIZE;
60 +               tmp->h_chksum[0]        = cpu_to_be32(crc32_sum);
61         }
62  
63 -       JBUFFER_TRACE(descriptor, "write commit block");
64 +       JBUFFER_TRACE(descriptor, "submit commit block");
65 +       lock_buffer(bh);
66 +
67         set_buffer_dirty(bh);
68 -       if (journal->j_flags & JFS_BARRIER) {
69 +       set_buffer_uptodate(bh);
70 +       bh->b_end_io = journal_end_buffer_io_sync;
71 +
72 +       if (journal->j_flags & JFS_BARRIER &&
73 +               !JFS_HAS_COMPAT_FEATURE(journal,
74 +                                        JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
75 +
76                 set_buffer_ordered(bh);
77                 barrier_done = 1;
78         }
79 -       ret = sync_dirty_buffer(bh);
80 +       ret = submit_bh(WRITE, bh);
81 +
82         /* is it possible for another commit to fail at roughly
83          * the same time as this one?  If so, we don't want to
84          * trust the barrier flag in the super, but instead want
85 @@ -152,14 +170,72 @@ static int journal_write_commit_record(j
86                 clear_buffer_ordered(bh);
87                 set_buffer_uptodate(bh);
88                 set_buffer_dirty(bh);
89 -               ret = sync_dirty_buffer(bh);
90 +               ret = submit_bh(WRITE, bh);
91         }
92 -       put_bh(bh);             /* One for getblk() */
93 -       journal_put_journal_head(descriptor);
94 +       *cbh = bh;
95 +       return ret;
96 +}
97  
98 -       return (ret == -EIO);
99 +/*
100 + * This function along with journal_submit_commit_record
101 + * allows to write the commit record asynchronously.
102 + */
103 +static int journal_wait_on_commit_record(struct buffer_head *bh)
104 +{
105 +       int ret = 0;
106 +
107 +       clear_buffer_dirty(bh);
108 +       wait_on_buffer(bh);
109 +       
110 +       if (unlikely(!buffer_uptodate(bh)))
111 +               ret = -EIO;
112 +       put_bh(bh);            /* One for getblk() */
113 +       journal_put_journal_head(bh2jh(bh));
114 +       
115 +       return ret;
116  }
117  
118 +/*
119 + * Wait for all submitted IO to complete.
120 + */
121 +static int journal_wait_on_locked_list(journal_t *journal,
122 +                                      transaction_t *commit_transaction)
123 +{
124 +       int ret = 0;
125 +       struct journal_head *jh;
126 +
127 +       while (commit_transaction->t_locked_list) {
128 +               struct buffer_head *bh;
129 +
130 +               jh = commit_transaction->t_locked_list->b_tprev;
131 +               bh = jh2bh(jh);
132 +               get_bh(bh);
133 +               if (buffer_locked(bh)) {
134 +                       spin_unlock(&journal->j_list_lock);
135 +                       wait_on_buffer(bh);
136 +                       if (unlikely(!buffer_uptodate(bh)))
137 +                               ret = -EIO;
138 +                       spin_lock(&journal->j_list_lock);
139 +               }
140 +               if (!inverted_lock(journal, bh)) {
141 +                       put_bh(bh);
142 +                       spin_lock(&journal->j_list_lock);
143 +                       continue;
144 +               }
145 +               if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) {
146 +                       __journal_unfile_buffer(jh);
147 +                       jbd_unlock_bh_state(bh);
148 +                       journal_remove_journal_head(bh);
149 +                       put_bh(bh);
150 +               } else {
151 +                       jbd_unlock_bh_state(bh);
152 +               }
153 +               put_bh(bh);
154 +               cond_resched_lock(&journal->j_list_lock);
155 +       }
156 +       return ret;
157 +}
158 +
159  void journal_do_submit_data(struct buffer_head **wbuf, int bufs)
160  {
161         int i;
162 @@ -293,6 +369,8 @@ void journal_commit_transaction(journal_
163         int first_tag = 0;
164         int tag_flag;
165         int i;
166 +       struct buffer_head *cbh = NULL; /* For transactional checksums */
167 +       __u32 crc32_sum = ~0;
168  
169         /*
170          * First job: lock down the current transaction and wait for
171 @@ -428,38 +506,14 @@ void journal_commit_transaction(journal_
172         journal_submit_data_buffers(journal, commit_transaction);
173  
174         /*
175 -        * Wait for all previously submitted IO to complete.
176 +        * Wait for all previously submitted IO to complete if commit
177 +        * record is to be written synchronously.
178          */
179         spin_lock(&journal->j_list_lock);
180 -       while (commit_transaction->t_locked_list) {
181 -               struct buffer_head *bh;
182 -
183 -               jh = commit_transaction->t_locked_list->b_tprev;
184 -               bh = jh2bh(jh);
185 -               get_bh(bh);
186 -               if (buffer_locked(bh)) {
187 -                       spin_unlock(&journal->j_list_lock);
188 -                       wait_on_buffer(bh);
189 -                       if (unlikely(!buffer_uptodate(bh)))
190 -                               err = -EIO;
191 -                       spin_lock(&journal->j_list_lock);
192 -               }
193 -               if (!inverted_lock(journal, bh)) {
194 -                       put_bh(bh);
195 -                       spin_lock(&journal->j_list_lock);
196 -                       continue;
197 -               }
198 -               if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) {
199 -                       __journal_unfile_buffer(jh);
200 -                       jbd_unlock_bh_state(bh);
201 -                       journal_remove_journal_head(bh);
202 -                       put_bh(bh);
203 -               } else {
204 -                       jbd_unlock_bh_state(bh);
205 -               }
206 -               put_bh(bh);
207 -               cond_resched_lock(&journal->j_list_lock);
208 -       }
209 +       if (!JFS_HAS_INCOMPAT_FEATURE(journal,
210 +               JFS_FEATURE_INCOMPAT_ASYNC_COMMIT))
211 +               err = journal_wait_on_locked_list(journal,
212 +                                                 commit_transaction);
213         spin_unlock(&journal->j_list_lock);
214  
215         if (err)
216 @@ -627,6 +681,16 @@ void journal_commit_transaction(journal_
217  start_journal_io:
218                         for (i = 0; i < bufs; i++) {
219                                 struct buffer_head *bh = wbuf[i];
220 +                               /*
221 +                                * Compute checksum.
222 +                                */
223 +                               if (JFS_HAS_COMPAT_FEATURE(journal,
224 +                                       JFS_FEATURE_COMPAT_CHECKSUM)) {
225 +                                       crc32_sum = crc32_be(crc32_sum,
226 +                                                       (void *)bh->b_data,
227 +                                                       bh->b_size);
228 +                               }
229 +
230                                 lock_buffer(bh);
231                                 clear_buffer_dirty(bh);
232                                 set_buffer_uptodate(bh);
233 @@ -642,6 +706,23 @@ start_journal_io:
234                 }
235         }
236  
237 +       /* Done it all: now write the commit record asynchronously. */
238 +
239 +       if (JFS_HAS_INCOMPAT_FEATURE(journal,
240 +               JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
241 +               err = journal_submit_commit_record(journal, commit_transaction,
242 +                                                &cbh, crc32_sum);
243 +               if (err)
244 +                       __journal_abort_hard(journal);
245 +
246 +               spin_lock(&journal->j_list_lock);
247 +               err = journal_wait_on_locked_list(journal,
248 +                                               commit_transaction);
249 +               spin_unlock(&journal->j_list_lock);
250 +               if (err)
251 +                       __journal_abort_hard(journal);
252 +       }
253 +
254         /* Lo and behold: we have just managed to send a transaction to
255             the log.  Before we can commit it, wait for the IO so far to
256             complete.  Control buffers being written are on the
257 @@ -740,9 +821,15 @@ wait_for_iobuf:
258         }
259  
260         jbd_debug(3, "JBD: commit phase 6\n");
261 -
262 -       if (journal_write_commit_record(journal, commit_transaction))
263 -               err = -EIO;
264 +               
265 +       if (!JFS_HAS_INCOMPAT_FEATURE(journal,
266 +               JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
267 +               err = journal_submit_commit_record(journal, commit_transaction,
268 +                                               &cbh, crc32_sum);
269 +               if (err)
270 +                       __journal_abort_hard(journal);
271 +       }
272 +       err = journal_wait_on_commit_record(cbh);
273  
274         if (err)
275                 __journal_abort_hard(journal);
276 Index: linux-2.6.18-8.1.8/include/linux/jbd.h
277 ===================================================================
278 --- linux-2.6.18-8.1.8.orig/include/linux/jbd.h
279 +++ linux-2.6.18-8.1.8/include/linux/jbd.h
280 @@ -148,6 +148,29 @@ typedef struct journal_header_s
281         __be32          h_sequence;
282  } journal_header_t;
283  
284 +/*
285 + * Checksum types.
286 + */
287 +#define JFS_CRC32_CHKSUM   1
288 +#define JFS_MD5_CHKSUM     2
289 +#define JFS_SHA1_CHKSUM    3
290 +
291 +#define JFS_CRC32_CHKSUM_SIZE 4
292 +
293 +#define JFS_CHECKSUM_BYTES (32 / sizeof(u32))
294 +/*
295 + * Commit block header for storing transactional checksums:
296 + */
297 +struct commit_header
298 +{
299 +       __be32          h_magic;
300 +       __be32          h_blocktype;
301 +       __be32          h_sequence;
302 +       unsigned char   h_chksum_type;
303 +       unsigned char   h_chksum_size;
304 +       unsigned char   h_padding[2];
305 +       __be32          h_chksum[JFS_CHECKSUM_BYTES];
306 +};
307  
308  /* 
309   * The block tag: used to describe a single buffer in the journal 
310 @@ -234,12 +257,16 @@ typedef struct journal_superblock_s
311         ((j)->j_format_version >= 2 &&                                  \
312          ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
313  
314 -#define JFS_FEATURE_INCOMPAT_REVOKE    0x00000001
315 +#define JFS_FEATURE_COMPAT_CHECKSUM    0x00000001
316 +
317 +#define JFS_FEATURE_INCOMPAT_REVOKE            0x00000001
318 +#define JFS_FEATURE_INCOMPAT_ASYNC_COMMIT      0x00000004
319  
320  /* Features known to this kernel version: */
321 -#define JFS_KNOWN_COMPAT_FEATURES      0
322 +#define JFS_KNOWN_COMPAT_FEATURES      JFS_FEATURE_COMPAT_CHECKSUM
323  #define JFS_KNOWN_ROCOMPAT_FEATURES    0
324 -#define JFS_KNOWN_INCOMPAT_FEATURES    JFS_FEATURE_INCOMPAT_REVOKE
325 +#define JFS_KNOWN_INCOMPAT_FEATURES    JFS_FEATURE_INCOMPAT_REVOKE | \
326 +                                       JFS_FEATURE_INCOMPAT_ASYNC_COMMIT
327  
328  #ifdef __KERNEL__
329  
330 @@ -967,6 +994,8 @@ extern int     journal_check_available_fe
331                    (journal_t *, unsigned long, unsigned long, unsigned long);
332  extern int        journal_set_features 
333                    (journal_t *, unsigned long, unsigned long, unsigned long);
334 +extern int        journal_clear_features
335 +                  (journal_t *, unsigned long, unsigned long, unsigned long);
336  extern int        journal_create     (journal_t *);
337  extern int        journal_load       (journal_t *journal);
338  extern void       journal_destroy    (journal_t *);
339 Index: linux-2.6.18-8.1.8/fs/jbd/recovery.c
340 ===================================================================
341 --- linux-2.6.18-8.1.8.orig/fs/jbd/recovery.c
342 +++ linux-2.6.18-8.1.8/fs/jbd/recovery.c
343 @@ -21,6 +21,7 @@
344  #include <linux/jbd.h>
345  #include <linux/errno.h>
346  #include <linux/slab.h>
347 +#include <linux/crc32.h>
348  #endif
349  
350  /*
351 @@ -307,6 +308,37 @@ int journal_skip_recovery(journal_t *jou
352         return err;
353  }
354  
355 +/*
356 + * calc_chksums calculates the checksums for the blocks described in the
357 + * descriptor block.
358 + */
359 +static int calc_chksums(journal_t *journal, struct buffer_head *bh,
360 +                      unsigned long *next_log_block, __u32 *crc32_sum)
361 +{
362 +       int i, num_blks, err;
363 +       unsigned io_block;
364 +       struct buffer_head *obh;
365 +
366 +       num_blks = count_tags(bh, journal->j_blocksize);
367 +       /* Calculate checksum of the descriptor block. */
368 +       *crc32_sum = crc32_be(*crc32_sum, (void *)bh->b_data, bh->b_size);
369 +
370 +       for (i = 0; i < num_blks; i++) {
371 +               io_block = (*next_log_block)++;
372 +               wrap(journal, *next_log_block);
373 +               err = jread(&obh, journal, io_block);
374 +               if (err) {
375 +                       printk(KERN_ERR "JBD: IO error %d recovering block "
376 +                               "%u in log\n", err, io_block);
377 +                       return 1;
378 +               } else {
379 +                       *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data,
380 +                                    obh->b_size);
381 +               }
382 +       }
383 +       return 0;
384 +}
385 +
386  static int do_one_pass(journal_t *journal,
387                         struct recovery_info *info, enum passtype pass)
388  {
389 @@ -318,6 +350,7 @@ static int do_one_pass(journal_t *journa
390         struct buffer_head *    bh;
391         unsigned int            sequence;
392         int                     blocktype;
393 +       __u32                   crc32_sum = ~0; /* Transactional Checksums */
394  
395         /* Precompute the maximum metadata descriptors in a descriptor block */
396         int                     MAX_BLOCKS_PER_DESC;
397 @@ -409,9 +442,24 @@ static int do_one_pass(journal_t *journa
398                 switch(blocktype) {
399                 case JFS_DESCRIPTOR_BLOCK:
400                         /* If it is a valid descriptor block, replay it
401 -                        * in pass REPLAY; otherwise, just skip over the
402 -                        * blocks it describes. */
403 +                        * in pass REPLAY; if journal_checksums enabled, then
404 +                        * calculate checksums in PASS_SCAN, otherwise,
405 +                        * just skip over the blocks it describes. */
406                         if (pass != PASS_REPLAY) {
407 +                               if (pass == PASS_SCAN &&
408 +                                   JFS_HAS_COMPAT_FEATURE(journal,
409 +                                           JFS_FEATURE_COMPAT_CHECKSUM) &&
410 +                                   !info->end_transaction) {
411 +                                       if (calc_chksums(journal, bh,
412 +                                                       &next_log_block,
413 +                                                       &crc32_sum)) {
414 +                                               brelse(bh);
415 +                                               break;
416 +                                       }
417 +                                       brelse(bh);
418 +                                       continue;
419 +                               }
420 +
421                                 next_log_block +=
422                                         count_tags(bh, journal->j_blocksize);
423                                 wrap(journal, next_log_block);
424 @@ -506,9 +554,97 @@ static int do_one_pass(journal_t *journa
425                         continue;
426  
427                 case JFS_COMMIT_BLOCK:
428 -                       /* Found an expected commit block: not much to
429 -                        * do other than move on to the next sequence
430 +                       /*     How to differentiate between interrupted commit
431 +                        *               and journal corruption ?
432 +                        *
433 +                        * {nth transaction}
434 +                        *        Checksum Verification Failed
435 +                        *                       |
436 +                        *               ____________________
437 +                        *              |                    |
438 +                        *      async_commit             sync_commit
439 +                        *              |                    |
440 +                        *              | GO TO NEXT    "Journal Corruption"
441 +                        *              | TRANSACTION
442 +                        *              |
443 +                        * {(n+1)th transanction}
444 +                        *              |
445 +                        *       _______|______________
446 +                        *      |                     |
447 +                        * Commit block found   Commit block not found
448 +                        *      |                     |
449 +                        * "Journal Corruption"       |
450 +                        *               _____________|__________
451 +                        *              |                       |
452 +                        *      nth trans corrupt       OR   nth trans
453 +                        *      and (n+1)th interrupted     interrupted 
454 +                        *      before commit block
455 +                        *      could reach the disk.
456 +                        *      (Cannot find the difference in above
457 +                        *       mentioned conditions. Hence assume
458 +                        *       "Interrupted Commit".)
459 +                        */
460 +
461 +                       /* Found an expected commit block: if checksums
462 +                        * are present verify them in PASS_SCAN; else not
463 +                        * much to do other than move on to the next sequence
464                          * number. */
465 +                       if (pass == PASS_SCAN &&
466 +                           JFS_HAS_COMPAT_FEATURE(journal,
467 +                                   JFS_FEATURE_COMPAT_CHECKSUM)) {
468 +                               int chksum_err, chksum_seen;
469 +                               struct commit_header *cbh =
470 +                                       (struct commit_header *)bh->b_data;
471 +                               unsigned found_chksum =
472 +                                               be32_to_cpu(cbh->h_chksum[0]);
473 +
474 +                               chksum_err = chksum_seen = 0;
475 +
476 +                               if (info->end_transaction) {
477 +                                       printk(KERN_ERR "JBD: Transaction %u "
478 +                                               "found to be corrupt.\n",
479 +                                               next_commit_ID - 1);
480 +                                       brelse(bh);
481 +                                       break;
482 +                               }
483 +
484 +                               if (crc32_sum == found_chksum &&
485 +                                   cbh->h_chksum_type == JFS_CRC32_CHKSUM &&
486 +                                   cbh->h_chksum_size ==
487 +                                               JFS_CRC32_CHKSUM_SIZE) {
488 +                                      chksum_seen = 1;
489 +                               } else if (!(cbh->h_chksum_type == 0 &&
490 +                                            cbh->h_chksum_size == 0 &&
491 +                                            found_chksum == 0 &&
492 +                                            !chksum_seen)) {
493 +                               /*
494 +                                * If fs is mounted using an old kernel and then
495 +                                * kernel with journal_chksum is used then we
496 +                                * get a situation where the journal flag has
497 +                                * checksum flag set but checksums are not
498 +                                * present i.e chksum = 0, in the individual
499 +                                * commit blocks.
500 +                                * Hence to avoid checksum failures, in this
501 +                                * situation, this extra check is added.
502 +                                */
503 +                                               chksum_err = 1;
504 +                               }
505 +
506 +                               if (chksum_err) {
507 +                                       info->end_transaction = next_commit_ID;
508 +
509 +                                       if (!JFS_HAS_COMPAT_FEATURE(journal,
510 +                                           JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)){
511 +                                               printk(KERN_ERR
512 +                                                      "JBD: Transaction %u "
513 +                                                      "found to be corrupt.\n",
514 +                                                      next_commit_ID);
515 +                                               brelse(bh);
516 +                                               break;
517 +                                       }
518 +                               }
519 +                               crc32_sum = ~0;
520 +                       }
521                         brelse(bh);
522                         next_commit_ID++;
523                         continue;
524 @@ -544,9 +680,10 @@ static int do_one_pass(journal_t *journa
525          * transaction marks the end of the valid log.
526          */
527  
528 -       if (pass == PASS_SCAN)
529 -               info->end_transaction = next_commit_ID;
530 -       else {
531 +       if (pass == PASS_SCAN) {
532 +               if (!info->end_transaction)
533 +                       info->end_transaction = next_commit_ID;
534 +       } else {
535                 /* It's really bad news if different passes end up at
536                  * different places (but possible due to IO errors). */
537                 if (info->end_transaction != next_commit_ID) {
538 Index: linux-2.6.18-8.1.8/fs/jbd/journal.c
539 ===================================================================
540 --- linux-2.6.18-8.1.8.orig/fs/jbd/journal.c
541 +++ linux-2.6.18-8.1.8/fs/jbd/journal.c
542 @@ -66,6 +66,7 @@ EXPORT_SYMBOL(journal_update_format);
543  EXPORT_SYMBOL(journal_check_used_features);
544  EXPORT_SYMBOL(journal_check_available_features);
545  EXPORT_SYMBOL(journal_set_features);
546 +EXPORT_SYMBOL(journal_clear_features);
547  EXPORT_SYMBOL(journal_create);
548  EXPORT_SYMBOL(journal_load);
549  EXPORT_SYMBOL(journal_destroy);
550 @@ -1271,6 +1272,33 @@ int journal_set_features (journal_t *jou
551         return 1;
552  }
553  
554 +/**
555 + * int journal_clear_features () - Clear a given journal feature in the superblock
556 + * @journal: Journal to act on.
557 + * @compat: bitmask of compatible features
558 + * @ro: bitmask of features that force read-only mount
559 + * @incompat: bitmask of incompatible features
560 + *
561 + * Clear a given journal feature as present on the
562 + * superblock.  Returns true if the requested features could be reset.
563 + *
564 + */
565 +int journal_clear_features (journal_t *journal, unsigned long compat,
566 +                         unsigned long ro, unsigned long incompat)
567 +{
568 +       journal_superblock_t *sb;
569 +
570 +       jbd_debug(1, "Clear features 0x%lx/0x%lx/0x%lx\n",
571 +                 compat, ro, incompat);
572 +
573 +       sb = journal->j_superblock;
574 +
575 +       sb->s_feature_compat    &= ~cpu_to_be32(compat);
576 +       sb->s_feature_ro_compat &= ~cpu_to_be32(ro);
577 +       sb->s_feature_incompat  &= ~cpu_to_be32(incompat);
578 +
579 +       return 1;
580 +}
581  
582  /**
583   * int journal_update_format () - Update on-disk journal structure.
584 Index: linux-2.6.18-8.1.8/fs/Kconfig
585 ===================================================================
586 --- linux-2.6.18-8.1.8.orig/fs/Kconfig
587 +++ linux-2.6.18-8.1.8/fs/Kconfig
588 @@ -140,6 +140,7 @@ config EXT3_FS_SECURITY
589  
590  config JBD
591         tristate
592 +       select CRC32
593         help
594           This is a generic journaling layer for block devices.  It is
595           currently used by the ext3 and OCFS2 file systems, but it could
596 Index: linux-2.6.18-8.1.8/Documentation/filesystems/ext3.txt
597 ===================================================================
598 --- linux-2.6.18-8.1.8.orig/Documentation/filesystems/ext3.txt
599 +++ linux-2.6.18-8.1.8/Documentation/filesystems/ext3.txt
600 @@ -14,6 +14,16 @@ Options
601  When mounting an ext3 filesystem, the following option are accepted:
602  (*) == default
603  
604 +journal_checksum       Enable checksumming of the journal transactions.
605 +                       This will allow the recovery code in e2fsck and the
606 +                       kernel to detect corruption in the kernel.  It is a
607 +                       compatible change and will be ignored by older kernels.
608 +
609 +journal_async_commit   Commit block can be written to disk without waiting
610 +                       for descriptor blocks. If enabled older kernels cannot
611 +                       mount the device. This will enable 'journal_checksum'
612 +                       internally.
613 +
614  journal=update         Update the ext3 file system's journal to the current
615                         format.
616