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