Whamcloud - gitweb
LU-2072 ldiskfs: Leak of s_mb_prealloc_table in ldiskfs
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-misc-rhel6.patch
index 3ce5694..f84dda6 100644 (file)
@@ -1,20 +1,31 @@
-Index: linux-stage/fs/ext4/ext4_jbd2.h
+Index: linux-stage/fs/ext4/ext4.h
 ===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.h
-+++ linux-stage/fs/ext4/ext4_jbd2.h
-@@ -35,6 +35,8 @@
-       (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
-        ? 27U : 8U)
+--- linux-stage.orig/fs/ext4/ext4.h    2011-05-20 10:59:32.000000000 +0300
++++ linux-stage/fs/ext4/ext4.h 2011-05-20 11:01:06.000000000 +0300
+@@ -1191,6 +1191,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
  
-+#define ext4_journal_dirty_metadata(handle, bh)  \
-+              ext4_handle_dirty_metadata(handle, NULL, bh)
- /* Extended attribute operations touch at most two data buffers,
-  * two bitmap buffers, and two group summaries, in addition to the inode
-  * and the superblock, which are already accounted for. */
+ #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
++/* Has been moved to linux/magic.h but we need it for Lustre */
++#define EXT4_SUPER_MAGIC      0xEF53
++
+ /*
+  * Codes for operating systems
+  */
+@@ -1630,6 +1633,9 @@ extern void ext4_mb_put_buddy_cache_lock
+                                               ext4_group_t, int);
+ extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
++extern void ext4_mb_discard_inode_preallocations(struct inode *);
++
++
+ /* inode.c */
+ int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
+               struct buffer_head *bh, ext4_fsblk_t blocknr);
 Index: linux-stage/fs/ext4/ext4_extents.h
 ===================================================================
---- linux-stage.orig/fs/ext4/ext4_extents.h
-+++ linux-stage/fs/ext4/ext4_extents.h
+--- linux-stage.orig/fs/ext4/ext4_extents.h    2011-05-20 10:59:30.000000000 +0300
++++ linux-stage/fs/ext4/ext4_extents.h 2011-05-20 11:00:01.000000000 +0300
 @@ -58,6 +58,12 @@
   */
  #define EXT_STATS_
@@ -28,15 +39,7 @@ Index: linux-stage/fs/ext4/ext4_extents.h
  
  /*
   * ext4_inode has i_block array (60 bytes total).
-@@ -160,6 +166,7 @@ typedef int (*ext_prepare_callback)(stru
- #define EXT_INIT_MAX_LEN      (1UL << 15)
- #define EXT_UNINIT_MAX_LEN    (EXT_INIT_MAX_LEN - 1)
-+#define EXT4_EXT_HAS_NO_TREE  /* ext4_extents_tree struct is not used*/
- #define EXT_FIRST_EXTENT(__hdr__) \
-       ((struct ext4_extent *) (((char *) (__hdr__)) +         \
-@@ -239,6 +246,8 @@ extern int ext4_extent_tree_init(handle_
+@@ -239,6 +245,8 @@ extern int ext4_extent_tree_init(handle_
  extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
                                                   int num,
                                                   struct ext4_ext_path *path);
@@ -45,93 +48,10 @@ Index: linux-stage/fs/ext4/ext4_extents.h
  extern int ext4_can_extents_be_merged(struct inode *inode,
                                      struct ext4_extent *ex1,
                                      struct ext4_extent *ex2);
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
-@@ -4039,6 +4039,7 @@ repeat:
-       if (ac)
-               kmem_cache_free(ext4_ac_cachep, ac);
- }
-+EXPORT_SYMBOL(ext4_discard_preallocations);
- /*
-  * finds all preallocated spaces and return blocks being freed to them
-@@ -4831,3 +4832,6 @@ error_return:
-               kmem_cache_free(ext4_ac_cachep, ac);
-       return;
- }
-+
-+EXPORT_SYMBOL(ext4_free_blocks);
-+
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -127,6 +127,7 @@ __u32 ext4_itable_unused_count(struct su
-               (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
-                (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
- }
-+EXPORT_SYMBOL(ext4_itable_unused_count);
- void ext4_block_bitmap_set(struct super_block *sb,
-                          struct ext4_group_desc *bg, ext4_fsblk_t blk)
-@@ -1497,11 +1498,13 @@ enum {
-       Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
-       Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
-       Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
-+      Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
-       Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
-       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
-       Opt_block_validity, Opt_noblock_validity,
-       Opt_inode_readahead_blks, Opt_journal_ioprio,
-       Opt_discard, Opt_nodiscard,
-+      Opt_mballoc,
- };
- static const match_table_t tokens = {
-@@ -1553,6 +1556,9 @@ static const match_table_t tokens = {
-       {Opt_noquota, "noquota"},
-       {Opt_quota, "quota"},
-       {Opt_usrquota, "usrquota"},
-+      {Opt_iopen, "iopen"},
-+      {Opt_noiopen, "noiopen"},
-+      {Opt_iopen_nopriv, "iopen_nopriv"},
-       {Opt_barrier, "barrier=%u"},
-       {Opt_barrier, "barrier"},
-       {Opt_nobarrier, "nobarrier"},
-@@ -1568,6 +1574,7 @@ static const match_table_t tokens = {
-       {Opt_auto_da_alloc, "auto_da_alloc=%u"},
-       {Opt_auto_da_alloc, "auto_da_alloc"},
-       {Opt_noauto_da_alloc, "noauto_da_alloc"},
-+      {Opt_mballoc, "mballoc"},
-       {Opt_discard, "discard"},
-       {Opt_nodiscard, "nodiscard"},
-       {Opt_err, NULL},
-@@ -1925,6 +1932,10 @@ set_qf_format:
-                       else
-                               clear_opt(sbi->s_mount_opt, BARRIER);
-                       break;
-+              case Opt_iopen:
-+              case Opt_noiopen:
-+              case Opt_iopen_nopriv:
-+                      break;
-               case Opt_ignore:
-                       break;
-               case Opt_resize:
-@@ -2008,6 +2019,8 @@ set_qf_format:
-               case Opt_nodiscard:
-                       clear_opt(sbi->s_mount_opt, DISCARD);
-                       break;
-+              case Opt_mballoc:
-+                      break;
-               default:
-                       ext4_msg(sb, KERN_ERR,
-                              "Unrecognized mount option \"%s\" "
 Index: linux-stage/fs/ext4/ext4_jbd2.c
 ===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.c
-+++ linux-stage/fs/ext4/ext4_jbd2.c
+--- linux-stage.orig/fs/ext4/ext4_jbd2.c       2011-05-20 10:59:29.000000000 +0300
++++ linux-stage/fs/ext4/ext4_jbd2.c    2011-05-20 11:00:01.000000000 +0300
 @@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
        }
        return err;
@@ -145,41 +65,19 @@ Index: linux-stage/fs/ext4/ext4_jbd2.c
        return err;
  }
 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -1110,6 +1110,9 @@ static inline void ext4_clear_inode_stat
- #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
-+/* Has been moved to linux/magic.h but we need it for Lustre */
-+#define EXT4_SUPER_MAGIC      0xEF53
-+
- /*
-  * Codes for operating systems
-  */
-@@ -1539,6 +1542,8 @@ extern int ext4_mb_add_groupinfo(struct 
- extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t);
- extern void ext4_mb_put_buddy_cache_lock(struct super_block *,
-                                               ext4_group_t, int);
-+extern void ext4_mb_discard_inode_preallocations(struct inode *);
-+
- /* inode.c */
- int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
-               struct buffer_head *bh, ext4_fsblk_t blocknr);
-Index: linux-stage/fs/ext4/inode.c
+Index: linux-stage/fs/ext4/ext4_jbd2.h
 ===================================================================
---- linux-stage.orig/fs/ext4/inode.c
-+++ linux-stage/fs/ext4/inode.c
-@@ -5204,6 +5204,7 @@ bad_inode:
-       iget_failed(inode);
-       return ERR_PTR(ret);
- }
-+EXPORT_SYMBOL(ext4_iget);
+--- linux-stage.orig/fs/ext4/ext4_jbd2.h       2011-05-20 10:59:29.000000000 +0300
++++ linux-stage/fs/ext4/ext4_jbd2.h    2011-05-20 11:00:01.000000000 +0300
+@@ -35,6 +35,8 @@
+       (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
+        ? 27U : 8U)
  
- static int ext4_inode_blocks_set(handle_t *handle,
-                               struct ext4_inode *raw_inode,
++#define ext4_journal_dirty_metadata(handle, bh)  \
++              ext4_handle_dirty_metadata(handle, NULL, bh)
+ /* Extended attribute operations touch at most two data buffers,
+  * two bitmap buffers, and two group summaries, in addition to the inode
+  * and the superblock, which are already accounted for. */
 Index: linux-stage/fs/ext4/extents.c
 ===================================================================
 --- linux-stage.orig/fs/ext4/extents.c
@@ -201,7 +99,7 @@ Index: linux-stage/fs/ext4/extents.c
 +
 +      if (path) {
 +              /* probably there is space in leaf? */
-+              depth = ext_depth(inode);
++              depth = path->p_depth;
 +              if (le16_to_cpu(path[depth].p_hdr->eh_entries)
 +                              < le16_to_cpu(path[depth].p_hdr->eh_max))
 +                      return 1;
@@ -240,7 +138,7 @@ Index: linux-stage/fs/ext4/extents.c
   * How many index/leaf blocks need to change/allocate to modify nrblocks?
   *
   * if nrblocks are fit in a single extent (chunk flag is 1), then
-@@ -3941,3 +3990,14 @@ int ext4_fiemap(struct inode *inode, str
+@@ -4029,3 +4079,14 @@ int ext4_fiemap(struct inode *inode, str
        return error;
  }
  
@@ -255,3 +153,98 @@ Index: linux-stage/fs/ext4/extents.c
 +EXPORT_SYMBOL(ext4_ext_walk_space);
 +EXPORT_SYMBOL(ext4_ext_find_extent);
 +EXPORT_SYMBOL(ext4_ext_drop_refs);
++
+Index: linux-stage/fs/ext4/inode.c
+===================================================================
+--- linux-stage.orig/fs/ext4/inode.c   2011-05-20 10:59:31.000000000 +0300
++++ linux-stage/fs/ext4/inode.c        2011-05-20 11:00:01.000000000 +0300
+@@ -5249,6 +5249,7 @@ bad_inode:
+       iget_failed(inode);
+       return ERR_PTR(ret);
+ }
++EXPORT_SYMBOL(ext4_iget);
+ static int ext4_inode_blocks_set(handle_t *handle,
+                               struct ext4_inode *raw_inode,
+Index: linux-stage/fs/ext4/mballoc.c
+===================================================================
+--- linux-stage.orig/fs/ext4/mballoc.c 2011-05-20 10:59:32.000000000 +0300
++++ linux-stage/fs/ext4/mballoc.c      2011-05-20 11:00:01.000000000 +0300
+@@ -4044,6 +4044,7 @@ repeat:
+       if (ac)
+               kmem_cache_free(ext4_ac_cachep, ac);
+ }
++EXPORT_SYMBOL(ext4_discard_preallocations);
+ /*
+  * finds all preallocated spaces and return blocks being freed to them
+@@ -5029,3 +5030,6 @@ int ext4_trim_fs(struct super_block *sb,
+       return ret;
+ }
++
++EXPORT_SYMBOL(ext4_free_blocks);
++
+Index: linux-stage/fs/ext4/super.c
+===================================================================
+--- linux-stage.orig/fs/ext4/super.c   2011-05-20 10:59:31.000000000 +0300
++++ linux-stage/fs/ext4/super.c        2011-05-20 11:00:01.000000000 +0300
+@@ -128,6 +128,7 @@ __u32 ext4_itable_unused_count(struct su
+               (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
+                (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
+ }
++EXPORT_SYMBOL(ext4_itable_unused_count);
+ void ext4_block_bitmap_set(struct super_block *sb,
+                          struct ext4_group_desc *bg, ext4_fsblk_t blk)
+@@ -1500,10 +1501,12 @@ enum {
+        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
+       Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
+       Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
++      Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
+       Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
+       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
+       Opt_block_validity, Opt_noblock_validity,
+       Opt_inode_readahead_blks, Opt_journal_ioprio,
++      Opt_mballoc,
+       Opt_discard, Opt_nodiscard,
+       Opt_init_inode_table, Opt_noinit_inode_table,
+ };
+@@ -1556,6 +1559,9 @@ static const match_table_t tokens = {             
+       {Opt_noquota, "noquota"},
+       {Opt_quota, "quota"},
+       {Opt_usrquota, "usrquota"},
++      {Opt_iopen, "iopen"},
++      {Opt_noiopen, "noiopen"},
++      {Opt_iopen_nopriv, "iopen_nopriv"},
+       {Opt_barrier, "barrier=%u"},
+       {Opt_barrier, "barrier"},
+       {Opt_nobarrier, "nobarrier"},
+@@ -1571,6 +1577,7 @@ static const match_table_t tokens = {
+       {Opt_auto_da_alloc, "auto_da_alloc=%u"},
+       {Opt_auto_da_alloc, "auto_da_alloc"},
+       {Opt_noauto_da_alloc, "noauto_da_alloc"},
++      {Opt_mballoc, "mballoc"},
+       {Opt_discard, "discard"},
+       {Opt_nodiscard, "nodiscard"},
+       {Opt_err, NULL},
+@@ -1928,6 +1935,10 @@ set_qf_format:           
+                       else
+                               clear_opt(sbi->s_mount_opt, BARRIER);
+                       break;
++              case Opt_iopen:
++              case Opt_noiopen:
++              case Opt_iopen_nopriv:
++                      break;
+               case Opt_ignore:
+                       break;
+               case Opt_resize:
+@@ -2011,6 +2022,8 @@ set_qf_format:
+               case Opt_nodiscard:
+                       clear_opt(sbi->s_mount_opt, DISCARD);
+                       break;
++              case Opt_mballoc:
++                      break;
+               default:
+                       ext4_msg(sb, KERN_ERR,
+                              "Unrecognized mount option \"%s\" "