Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / jbd-journal-chksum-2.6-sles10.patch
index 4f4f069..f7b7892 100644 (file)
@@ -1,7 +1,7 @@
-Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
+Index: linux-2.6.16/fs/jbd/commit.c
 ===================================================================
---- linux-2.6.16.53-0.16.orig/fs/jbd/commit.c
-+++ linux-2.6.16.53-0.16/fs/jbd/commit.c
+--- linux-2.6.16.orig/fs/jbd/commit.c
++++ linux-2.6.16/fs/jbd/commit.c
 @@ -22,6 +22,7 @@
  #include <linux/pagemap.h>
  #include <linux/smp_lock.h>
@@ -38,7 +38,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
        int barrier_done = 0;
  
        if (is_journal_aborted(journal))
-@@ -118,21 +123,35 @@ static int journal_write_commit_record(j
+@@ -118,21 +123,34 @@ static int journal_write_commit_record(j
  
        bh = jh2bh(descriptor);
  
@@ -63,7 +63,6 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
 -      JBUFFER_TRACE(descriptor, "write commit block");
 +      JBUFFER_TRACE(descriptor, "submit commit block");
 +      lock_buffer(bh);
-+      get_bh(bh);
 +
        set_buffer_dirty(bh);
 -      if (journal->j_flags & JFS_BARRIER) {
@@ -80,11 +79,14 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
 -      ret = sync_dirty_buffer(bh);
 +      ret = submit_bh(WRITE, bh);
 +
-       /* is it possible for another commit to fail at roughly
-        * the same time as this one?  If so, we don't want to
-        * trust the barrier flag in the super, but instead want
-@@ -153,12 +172,84 @@ static int journal_write_commit_record(j
+       if (barrier_done)
                clear_buffer_ordered(bh);
+       /* is it possible for another commit to fail at roughly
+@@ -152,14 +170,87 @@ static int journal_write_commit_record(j
+               spin_unlock(&journal->j_state_lock);
+               /* And try again, without the barrier */
++              lock_buffer(bh);
                set_buffer_uptodate(bh);
                set_buffer_dirty(bh);
 -              ret = sync_dirty_buffer(bh);
@@ -171,8 +173,8 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
 +      return checksum;
  }
  
- /*
-@@ -184,6 +275,8 @@ void journal_commit_transaction(journal_
+ void journal_do_submit_data(struct buffer_head **wbuf, int bufs)
+@@ -296,6 +387,8 @@ void journal_commit_transaction(journal_
        int first_tag = 0;
        int tag_flag;
        int i;
@@ -181,14 +183,15 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
  
        /*
         * First job: lock down the current transaction and wait for
-@@ -395,37 +488,14 @@ write_out_data:
-       }
+@@ -439,38 +532,15 @@ void journal_commit_transaction(journal_
+       journal_submit_data_buffers(journal, commit_transaction);
  
        /*
 -       * Wait for all previously submitted IO to complete.
 +       * Wait for all previously submitted IO to complete if commit
 +       * record is to be written synchronously.
         */
+       spin_lock(&journal->j_list_lock);
 -      while (commit_transaction->t_locked_list) {
 -              struct buffer_head *bh;
 +      if (!JFS_HAS_INCOMPAT_FEATURE(journal,
@@ -225,7 +228,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
        spin_unlock(&journal->j_list_lock);
  
        if (err)
-@@ -598,6 +668,16 @@ write_out_data:
+@@ -643,6 +713,16 @@ void journal_commit_transaction(journal_
  start_journal_io:
                        for (i = 0; i < bufs; i++) {
                                struct buffer_head *bh = wbuf[i];
@@ -242,7 +245,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
                                lock_buffer(bh);
                                clear_buffer_dirty(bh);
                                set_buffer_uptodate(bh);
-@@ -614,6 +694,23 @@ start_journal_io:
+@@ -659,6 +739,23 @@ start_journal_io:
                }
        }
  
@@ -266,7 +269,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
        /* Lo and behold: we have just managed to send a transaction to
             the log.  Before we can commit it, wait for the IO so far to
             complete.  Control buffers being written are on the
-@@ -712,9 +809,15 @@ wait_for_iobuf:
+@@ -757,9 +854,15 @@ wait_for_iobuf:
        }
  
        jbd_debug(3, "JBD: commit phase 6\n");
@@ -285,73 +288,10 @@ Index: linux-2.6.16.53-0.16/fs/jbd/commit.c
  
        if (err)
                __journal_abort_hard(journal);
-Index: linux-2.6.16.53-0.16/include/linux/jbd.h
+Index: linux-2.6.16/fs/jbd/recovery.c
 ===================================================================
---- linux-2.6.16.53-0.16.orig/include/linux/jbd.h
-+++ linux-2.6.16.53-0.16/include/linux/jbd.h
-@@ -142,6 +142,29 @@ typedef struct journal_header_s
-       __be32          h_sequence;
- } journal_header_t;
-+/*
-+ * Checksum types.
-+ */
-+#define JFS_CRC32_CHKSUM   1
-+#define JFS_MD5_CHKSUM     2
-+#define JFS_SHA1_CHKSUM    3
-+
-+#define JFS_CRC32_CHKSUM_SIZE 4
-+
-+#define JFS_CHECKSUM_BYTES (32 / sizeof(u32))
-+/*
-+ * Commit block header for storing transactional checksums:
-+ */
-+struct commit_header
-+{
-+      __be32          h_magic;
-+      __be32          h_blocktype;
-+      __be32          h_sequence;
-+      unsigned char   h_chksum_type;
-+      unsigned char   h_chksum_size;
-+      unsigned char   h_padding[2];
-+      __be32          h_chksum[JFS_CHECKSUM_BYTES];
-+};
- /* 
-  * The block tag: used to describe a single buffer in the journal 
-@@ -228,12 +251,16 @@ typedef struct journal_superblock_s
-       ((j)->j_format_version >= 2 &&                                  \
-        ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
--#define JFS_FEATURE_INCOMPAT_REVOKE   0x00000001
-+#define JFS_FEATURE_COMPAT_CHECKSUM   0x00000001
-+
-+#define JFS_FEATURE_INCOMPAT_REVOKE           0x00000001
-+#define JFS_FEATURE_INCOMPAT_ASYNC_COMMIT     0x00000004
- /* Features known to this kernel version: */
--#define JFS_KNOWN_COMPAT_FEATURES     0
-+#define JFS_KNOWN_COMPAT_FEATURES     JFS_FEATURE_COMPAT_CHECKSUM
- #define JFS_KNOWN_ROCOMPAT_FEATURES   0
--#define JFS_KNOWN_INCOMPAT_FEATURES   JFS_FEATURE_INCOMPAT_REVOKE
-+#define JFS_KNOWN_INCOMPAT_FEATURES   (JFS_FEATURE_INCOMPAT_REVOKE | \
-+                                      JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)
- #ifdef __KERNEL__
-@@ -1041,6 +1068,8 @@ extern int          journal_check_available_fe
-                  (journal_t *, unsigned long, unsigned long, unsigned long);
- extern int       journal_set_features 
-                  (journal_t *, unsigned long, unsigned long, unsigned long);
-+extern int       journal_clear_features
-+                 (journal_t *, unsigned long, unsigned long, unsigned long);
- extern int       journal_create     (journal_t *);
- extern int       journal_load       (journal_t *journal);
- extern void      journal_destroy    (journal_t *);
-Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
-===================================================================
---- linux-2.6.16.53-0.16.orig/fs/jbd/recovery.c
-+++ linux-2.6.16.53-0.16/fs/jbd/recovery.c
+--- linux-2.6.16.orig/fs/jbd/recovery.c
++++ linux-2.6.16/fs/jbd/recovery.c
 @@ -21,6 +21,7 @@
  #include <linux/jbd.h>
  #include <linux/errno.h>
@@ -360,7 +300,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
  #endif
  
  /*
-@@ -307,6 +308,37 @@ int journal_skip_recovery(journal_t *jou
+@@ -307,6 +308,38 @@ int journal_skip_recovery(journal_t *jou
        return err;
  }
  
@@ -391,6 +331,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
 +                      *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data,
 +                                   obh->b_size);
 +              }
++              put_bh(obh);
 +      }
 +      return 0;
 +}
@@ -398,7 +339,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
  static int do_one_pass(journal_t *journal,
                        struct recovery_info *info, enum passtype pass)
  {
-@@ -318,6 +350,7 @@ static int do_one_pass(journal_t *journa
+@@ -318,6 +351,7 @@ static int do_one_pass(journal_t *journa
        struct buffer_head *    bh;
        unsigned int            sequence;
        int                     blocktype;
@@ -406,7 +347,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
  
        /* Precompute the maximum metadata descriptors in a descriptor block */
        int                     MAX_BLOCKS_PER_DESC;
-@@ -409,9 +442,24 @@ static int do_one_pass(journal_t *journa
+@@ -409,9 +443,24 @@ static int do_one_pass(journal_t *journa
                switch(blocktype) {
                case JFS_DESCRIPTOR_BLOCK:
                        /* If it is a valid descriptor block, replay it
@@ -433,7 +374,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
                                next_log_block +=
                                        count_tags(bh, journal->j_blocksize);
                                wrap(journal, next_log_block);
-@@ -506,9 +554,97 @@ static int do_one_pass(journal_t *journa
+@@ -506,9 +555,97 @@ static int do_one_pass(journal_t *journa
                        continue;
  
                case JFS_COMMIT_BLOCK:
@@ -533,7 +474,7 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
                        brelse(bh);
                        next_commit_ID++;
                        continue;
-@@ -543,9 +679,10 @@ static int do_one_pass(journal_t *journa
+@@ -543,9 +680,10 @@ static int do_one_pass(journal_t *journa
         * transaction marks the end of the valid log.
         */
  
@@ -547,10 +488,10 @@ Index: linux-2.6.16.53-0.16/fs/jbd/recovery.c
                /* It's really bad news if different passes end up at
                 * different places (but possible due to IO errors). */
                if (info->end_transaction != next_commit_ID) {
-Index: linux-2.6.16.53-0.16/fs/jbd/journal.c
+Index: linux-2.6.16/fs/jbd/journal.c
 ===================================================================
---- linux-2.6.16.53-0.16.orig/fs/jbd/journal.c
-+++ linux-2.6.16.53-0.16/fs/jbd/journal.c
+--- linux-2.6.16.orig/fs/jbd/journal.c
++++ linux-2.6.16/fs/jbd/journal.c
 @@ -64,6 +64,7 @@ EXPORT_SYMBOL(journal_update_format);
  EXPORT_SYMBOL(journal_check_used_features);
  EXPORT_SYMBOL(journal_check_available_features);
@@ -593,10 +534,10 @@ Index: linux-2.6.16.53-0.16/fs/jbd/journal.c
  
  /**
   * int journal_update_format () - Update on-disk journal structure.
-Index: linux-2.6.16.53-0.16/fs/Kconfig
+Index: linux-2.6.16/fs/Kconfig
 ===================================================================
---- linux-2.6.16.53-0.16.orig/fs/Kconfig
-+++ linux-2.6.16.53-0.16/fs/Kconfig
+--- linux-2.6.16.orig/fs/Kconfig
++++ linux-2.6.16/fs/Kconfig
 @@ -140,6 +140,7 @@ config EXT3_FS_SECURITY
  
  config JBD
@@ -605,10 +546,73 @@ Index: linux-2.6.16.53-0.16/fs/Kconfig
        help
          This is a generic journaling layer for block devices.  It is
          currently used by the ext3 and OCFS2 file systems, but it could
-Index: linux-2.6.16.53-0.16/Documentation/filesystems/ext3.txt
+Index: linux-2.6.16/include/linux/jbd.h
+===================================================================
+--- linux-2.6.16.orig/include/linux/jbd.h
++++ linux-2.6.16/include/linux/jbd.h
+@@ -142,6 +142,29 @@ typedef struct journal_header_s
+       __be32          h_sequence;
+ } journal_header_t;
++/*
++ * Checksum types.
++ */
++#define JFS_CRC32_CHKSUM   1
++#define JFS_MD5_CHKSUM     2
++#define JFS_SHA1_CHKSUM    3
++
++#define JFS_CRC32_CHKSUM_SIZE 4
++
++#define JFS_CHECKSUM_BYTES (32 / sizeof(u32))
++/*
++ * Commit block header for storing transactional checksums:
++ */
++struct commit_header
++{
++      __be32          h_magic;
++      __be32          h_blocktype;
++      __be32          h_sequence;
++      unsigned char   h_chksum_type;
++      unsigned char   h_chksum_size;
++      unsigned char   h_padding[2];
++      __be32          h_chksum[JFS_CHECKSUM_BYTES];
++};
+ /* 
+  * The block tag: used to describe a single buffer in the journal 
+@@ -228,12 +251,16 @@ typedef struct journal_superblock_s
+       ((j)->j_format_version >= 2 &&                                  \
+        ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
+-#define JFS_FEATURE_INCOMPAT_REVOKE   0x00000001
++#define JFS_FEATURE_COMPAT_CHECKSUM   0x00000001
++
++#define JFS_FEATURE_INCOMPAT_REVOKE           0x00000001
++#define JFS_FEATURE_INCOMPAT_ASYNC_COMMIT     0x00000004
+ /* Features known to this kernel version: */
+-#define JFS_KNOWN_COMPAT_FEATURES     0
++#define JFS_KNOWN_COMPAT_FEATURES     JFS_FEATURE_COMPAT_CHECKSUM
+ #define JFS_KNOWN_ROCOMPAT_FEATURES   0
+-#define JFS_KNOWN_INCOMPAT_FEATURES   JFS_FEATURE_INCOMPAT_REVOKE
++#define JFS_KNOWN_INCOMPAT_FEATURES   (JFS_FEATURE_INCOMPAT_REVOKE | \
++                                      JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)
+ #ifdef __KERNEL__
+@@ -1041,6 +1068,8 @@ extern int          journal_check_available_fe
+                  (journal_t *, unsigned long, unsigned long, unsigned long);
+ extern int       journal_set_features 
+                  (journal_t *, unsigned long, unsigned long, unsigned long);
++extern int       journal_clear_features
++                 (journal_t *, unsigned long, unsigned long, unsigned long);
+ extern int       journal_create     (journal_t *);
+ extern int       journal_load       (journal_t *journal);
+ extern void      journal_destroy    (journal_t *);
+Index: linux-2.6.16/Documentation/filesystems/ext3.txt
 ===================================================================
---- linux-2.6.16.53-0.16.orig/Documentation/filesystems/ext3.txt
-+++ linux-2.6.16.53-0.16/Documentation/filesystems/ext3.txt
+--- linux-2.6.16.orig/Documentation/filesystems/ext3.txt
++++ linux-2.6.16/Documentation/filesystems/ext3.txt
 @@ -14,6 +14,16 @@ Options
  When mounting an ext3 filesystem, the following option are accepted:
  (*) == default