Whamcloud - gitweb
LU-162 Export ext4_discard_preallocations for ldiskfs
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-misc-rhel5.patch
index b8b55ae..84b9ac2 100644 (file)
@@ -1,24 +1,21 @@
-Index: linux-2.6.18.i386/fs/ext4/ext4_jbd2.h
+Index: linux-stage/fs/ext4/ext4_jbd2.h
 ===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/ext4_jbd2.h
-+++ linux-2.6.18.i386/fs/ext4/ext4_jbd2.h
-@@ -35,6 +35,11 @@
-       (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
-               || test_opt(sb, EXTENTS) ? 27U : 8U)
+--- linux-stage.orig/fs/ext4/ext4_jbd2.h       2011-03-14 17:17:57.962614294 +0800
++++ linux-stage/fs/ext4/ext4_jbd2.h    2011-03-14 17:26:00.570661921 +0800
+@@ -35,6 +35,8 @@
+       (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
+        ? 27U : 8U)
  
-+/* Indicate that EXT4_SINGLEDATA_TRANS_BLOCKS takes the sb as argument */
-+#define EXT4_SINGLEDATA_TRANS_BLOCKS_HAS_SB
-+
 +#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-2.6.18.i386/fs/ext4/extents.c
+Index: linux-stage/fs/ext4/extents.c
 ===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/extents.c
-+++ linux-2.6.18.i386/fs/ext4/extents.c
-@@ -60,6 +60,17 @@ static ext4_fsblk_t ext_pblock(struct ex
+--- linux-stage.orig/fs/ext4/extents.c 2011-03-14 17:17:57.491605523 +0800
++++ linux-stage/fs/ext4/extents.c      2011-03-14 17:25:23.230957562 +0800
+@@ -59,6 +59,17 @@ static ext4_fsblk_t ext_pblock(struct ex
  }
  
  /*
@@ -36,7 +33,7 @@ Index: linux-2.6.18.i386/fs/ext4/extents.c
   * idx_pblock:
   * combine low and high parts of a leaf physical block number into ext4_fsblk_t
   */
-@@ -73,17 +84,6 @@ ext4_fsblk_t idx_pblock(struct ext4_exte
+@@ -72,17 +83,6 @@ ext4_fsblk_t idx_pblock(struct ext4_exte
  }
  
  /*
@@ -54,7 +51,7 @@ Index: linux-2.6.18.i386/fs/ext4/extents.c
   * ext4_idx_store_pblock:
   * stores a large physical block number into an index struct,
   * breaking it into parts
-@@ -1826,6 +1826,56 @@ static int ext4_ext_rm_idx(handle_t *han
+@@ -1980,6 +1980,56 @@ static int ext4_ext_rm_idx(handle_t *han
  }
  
  /*
@@ -111,11 +108,10 @@ Index: linux-2.6.18.i386/fs/ext4/extents.c
   * ext4_ext_calc_credits_for_single_extent:
   * This routine returns max. credits that needed to insert an extent
   * to the extent tree.
-@@ -3157,4 +3207,14 @@ int ext4_fiemap(struct inode *inode, str
+@@ -3731,3 +3781,13 @@ int ext4_fiemap(struct inode *inode, str
        return error;
  }
-+
 +EXPORT_SYMBOL(ext4_ext_store_pblock);
 +EXPORT_SYMBOL(ext4_ext_search_right);
 +EXPORT_SYMBOL(ext4_ext_search_left);
@@ -125,12 +121,12 @@ Index: linux-2.6.18.i386/fs/ext4/extents.c
 +EXPORT_SYMBOL(ext4_ext_walk_space);
 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
-Index: linux-2.6.18.i386/fs/ext4/ext4_extents.h
++
+Index: linux-stage/fs/ext4/ext4_extents.h
 ===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/ext4_extents.h
-+++ linux-2.6.18.i386/fs/ext4/ext4_extents.h
-@@ -59,6 +59,12 @@
+--- linux-stage.orig/fs/ext4/ext4_extents.h    2011-03-14 17:17:57.928613657 +0800
++++ linux-stage/fs/ext4/ext4_extents.h 2011-03-14 17:27:23.673232962 +0800
+@@ -58,6 +58,12 @@
   */
  #define EXT_STATS_
  
@@ -143,16 +139,15 @@ Index: linux-2.6.18.i386/fs/ext4/ext4_extents.h
  
  /*
   * ext4_inode has i_block array (60 bytes total).
-@@ -124,6 +129,8 @@ struct ext4_ext_path {
- #define EXT4_EXT_CACHE_GAP    1
- #define EXT4_EXT_CACHE_EXTENT 2
+@@ -160,6 +166,7 @@ struct ext4_ext_path {
+ #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_INSERT_EXTENT_WITH_5ARGS
- #define EXT_MAX_BLOCK 0xffffffff
  
-@@ -228,6 +234,8 @@ static inline int ext4_ext_get_actual_le
+ #define EXT_FIRST_EXTENT(__hdr__) \
+       ((struct ext4_extent *) (((char *) (__hdr__)) +         \
+@@ -230,6 +237,8 @@
  extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
  extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
  extern int ext4_extent_tree_init(handle_t *, struct inode *);
@@ -161,53 +156,47 @@ Index: linux-2.6.18.i386/fs/ext4/ext4_extents.h
  extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
                                                   int num,
                                                   struct ext4_ext_path *path);
-Index: linux-2.6.18.i386/fs/ext4/mballoc.c
+Index: linux-stage/fs/ext4/mballoc.c
 ===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/mballoc.c
-+++ linux-2.6.18.i386/fs/ext4/mballoc.c
-@@ -4355,6 +4355,13 @@
+--- linux-stage.orig/fs/ext4/mballoc.c 2011-03-14 17:17:59.872649833 +0800
++++ linux-stage/fs/ext4/mballoc.c      2011-03-14 17:25:20.373903681 +0800
+@@ -4302,6 +4302,7 @@
                kmem_cache_free(ext4_ac_cachep, ac);
  }
++EXPORT_SYMBOL(ext4_discard_preallocations); 
  
-+/* For backward compatibility, since Lustre uses this symbol */
-+void ext4_mb_discard_inode_preallocations(struct inode *inode)
-+{
-+      ext4_discard_preallocations(inode);
-+}
-+EXPORT_SYMBOL(ext4_mb_discard_inode_preallocations);
-+
  /*
   * finds all preallocated spaces and return blocks being freed to them
   * if preallocated space becomes full (no block is used from the space)
-@@ -4965,3 +4965,6 @@ error_return:
+@@ -5111,3 +5118,6 @@ error_return:
                kmem_cache_free(ext4_ac_cachep, ac);
        return;
  }
 +
 +EXPORT_SYMBOL(ext4_free_blocks);
 +
-Index: linux-2.6.18.i386/fs/ext4/ext4_jbd2.c
+Index: linux-stage/fs/ext4/ext4_jbd2.c
 ===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/ext4_jbd2.c
-+++ linux-2.6.18.i386/fs/ext4/ext4_jbd2.c
-@@ -21,6 +21,7 @@ int __ext4_journal_get_write_access(cons
-               ext4_journal_abort_handle(where, __func__, bh, handle, err);
+--- linux-stage.orig/fs/ext4/ext4_jbd2.c       2011-03-14 17:17:57.463605024 +0800
++++ linux-stage/fs/ext4/ext4_jbd2.c    2011-03-14 17:18:00.157655139 +0800
+@@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
+       }
        return err;
  }
 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
  
  int __ext4_journal_forget(const char *where, handle_t *handle,
                                struct buffer_head *bh)
-@@ -57,3 +58,4 @@ int __ext4_journal_dirty_metadata(const 
-               ext4_journal_abort_handle(where, __func__, bh, handle, err);
+@@ -107,3 +108,4 @@ int __ext4_journal_dirty_metadata(const
+       }
        return err;
  }
 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
+Index: linux-stage/fs/ext4/ext4.h
 ===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h    2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4.h 2009-07-07 14:47:22.000000000 +0530
-@@ -1123,6 +1128,8 @@
+--- linux-stage.orig/fs/ext4/ext4.h    2011-03-14 17:17:59.916650654 +0800
++++ linux-stage/fs/ext4/ext4.h 2011-03-14 17:25:30.236089694 +0800
+@@ -1448,6 +1448,8 @@
  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);
@@ -216,11 +205,11 @@ Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
  /* inode.c */
  int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
                struct buffer_head *bh, ext4_fsblk_t blocknr);
-Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
+Index: linux-stage/fs/ext4/inode.c
 ===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c   2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/inode.c        2009-07-07 14:47:22.000000000 +0530
-@@ -4240,6 +4240,7 @@
+--- linux-stage.orig/fs/ext4/inode.c   2011-03-14 17:17:59.745647471 +0800
++++ linux-stage/fs/ext4/inode.c        2011-03-14 17:18:00.219656294 +0800
+@@ -4882,6 +4882,7 @@
        iget_failed(inode);
        return ERR_PTR(ret);
  }
@@ -228,109 +217,120 @@ Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
  
  static int ext4_inode_blocks_set(handle_t *handle,
                                struct ext4_inode *raw_inode,
-Index: linux-2.6.27.21-0.1/fs/ext4/super.c
+Index: linux-stage/fs/ext4/super.c
 ===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/super.c   2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/super.c        2009-07-07 14:48:53.000000000 +0530
-@@ -91,6 +91,7 @@ ext4_fsblk_t ext4_inode_bitmap(struct su
+--- linux-stage.orig/fs/ext4/super.c   2011-03-14 17:17:59.659645870 +0800
++++ linux-stage/fs/ext4/super.c        2011-03-14 17:25:31.027104616 +0800
+@@ -90,6 +90,7 @@ ext4_fsblk_t ext4_inode_bitmap(struct su
                (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
-               (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
+                (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
  }
 +EXPORT_SYMBOL(ext4_inode_bitmap);
  
  ext4_fsblk_t ext4_inode_table(struct super_block *sb,
                              struct ext4_group_desc *bg)
-@@ -113,6 +118,7 @@
-               (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
-               (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
+@@ -114,6 +115,7 @@
+               (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
+                (__u32)le16_to_cpu(bg->bg_free_inodes_count_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)
-@@ -1286,6 +1287,7 @@
-       Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
-       Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err, Opt_resize,
-       Opt_usrquota, Opt_grpquota, Opt_i_version,
__u32 ext4_used_dirs_count(struct super_block *sb,
+                             struct ext4_group_desc *bg)
+@@ -1434,9 +1436,11 @@
+       Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
+       Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err, Opt_resize,
+       Opt_usrquota, Opt_grpquota, Opt_i_version,
 +      Opt_mballoc, Opt_extents,
-       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
-       Opt_inode_readahead_blks, Opt_journal_ioprio,
-       Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents,
-@@ -1346,6 +1348,8 @@
-       {Opt_barrier, "barrier"},
-       {Opt_nobarrier, "nobarrier"},
-       {Opt_i_version, "i_version"},
+       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
+       Opt_block_validity, Opt_noblock_validity,
+-      Opt_inode_readahead_blks, Opt_journal_ioprio
++      Opt_inode_readahead_blks, Opt_journal_ioprio,
++      Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
+ };
+ static match_table_t tokens = {
+@@ -1491,6 +1495,11 @@
+       {Opt_barrier, "barrier"},
+       {Opt_nobarrier, "nobarrier"},
+       {Opt_i_version, "i_version"},
 +      {Opt_mballoc, "mballoc"},
 +      {Opt_extents, "extents"},
-       {Opt_stripe, "stripe=%u"},
-       {Opt_resize, "resize"},
-       {Opt_delalloc, "delalloc"},
-@@ -1768,6 +1771,9 @@
-               case Opt_bigendian_extents:
-                       bigendian_extents = 1;
++      {Opt_iopen, "iopen"},
++      {Opt_noiopen, "noiopen"},
++      {Opt_iopen_nopriv, "iopen_nopriv"},
+       {Opt_stripe, "stripe=%u"},
+       {Opt_resize, "resize"},
+       {Opt_delalloc, "delalloc"},
+@@ -1930,6 +1939,12 @@
+                       else
+                               set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC);
                        break;
 +              case Opt_mballoc:
 +              case Opt_extents:
++              case Opt_iopen:
++              case Opt_noiopen:
++              case Opt_iopen_nopriv:
 +                      break;
                default:
-                       printk(KERN_ERR
-                              "EXT4-fs: Unrecognized mount option \"%s\" "
-@@ -2768,7 +2771,7 @@
-                                             char *buf)
+                       ext4_msg(sb, KERN_ERR,
+                              "Unrecognized mount option \"%s\" "
+@@ -2480,7 +2495,7 @@
+                                             char *buf)
  {
-       return snprintf(buf, PAGE_SIZE, "%llu\n",
+       return snprintf(buf, PAGE_SIZE, "%llu\n",
 -                      (s64) percpu_counter_sum(&sbi->s_dirtyblocks_counter));
 +                      (unsigned long long) percpu_counter_sum(&sbi->s_dirtyblocks_counter));
  }
  
  static ssize_t session_write_kbytes_show(struct ext4_attr *a,
-@@ -2868,11 +2871,11 @@
-       struct super_block *sb = sbi->s_buddy_cache->i_sb;
-
-       return snprintf(buf, PAGE_SIZE, "%llu\n",
+@@ -2501,11 +2516,11 @@
+       struct super_block *sb = sbi->s_buddy_cache->i_sb;
+       return snprintf(buf, PAGE_SIZE, "%llu\n",
 -                      sbi->s_kbytes_written + 
 +                      (unsigned long long)(sbi->s_kbytes_written + 
-                       (sb->s_bdev->bd_part ?
-                       (part_stat_read(sb->s_bdev->bd_part, sectors[1]) -
-                         EXT4_SB(sb)->s_sectors_written_start) >> 1
+                       (sb->s_bdev->bd_part ?
+                       (part_stat_read(sb->s_bdev->bd_part, sectors[1]) -
+                         EXT4_SB(sb)->s_sectors_written_start) >> 1
 -                      : 0));
 +                      : 0)));
  }
  
  static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
-@@ -3868,7 +3871,7 @@
-       if (blocks_count && ext4_blocks_count(es) > blocks_count) {
-               ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
-                      "exceeds size of device (%llu blocks)",
+@@ -2972,7 +2987,7 @@
+       if (blocks_count && ext4_blocks_count(es) > blocks_count) {
+               ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
+                      "exceeds size of device (%llu blocks)",
 -                     ext4_blocks_count(es), blocks_count);
 +                     ext4_blocks_count(es), (unsigned long long)blocks_count);
-               goto failed_mount;
-       }
-
-Index: linux-2.6.27.21-0.1/fs/ext4/fsync.c
+               goto failed_mount;
+       }
+Index: linux-stage/fs/ext4/fsync.c
 ===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/fsync.c   2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/fsync.c        2009-07-07 14:48:53.000000000 +0530
-@@ -1768,7 +1771,7 @@
+--- linux-stage.orig/fs/ext4/fsync.c   2011-03-14 17:17:57.533606303 +0800
++++ linux-stage/fs/ext4/fsync.c        2011-03-14 17:18:00.266657168 +0800
+@@ -56,7 +56,7 @@
  
-       trace_mark(ext4_sync_file, "dev %s datasync %d ino %ld parent %ld",
-                  inode->i_sb->s_id, datasync, inode->i_ino,
+       trace_mark(ext4_sync_file, "dev %s datasync %d ino %ld parent %ld",
+                  inode->i_sb->s_id, datasync, inode->i_ino,
 -                 dentry->d_parent->d_inode->i_ino);
 +                 0L);
-
-       /*
-        * data=writeback:
-Index: linux-2.6.27.21-0.1/fs/ext4/move_extent.c
+       ret = flush_aio_dio_completed_IO(inode);
+       if (ret < 0)
+Index: linux-stage/fs/ext4/move_extent.c
 ===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/move_extent.c     2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/move_extent.c  2009-07-07 14:48:53.000000000 +0530
-@@ -1768,7 +1771,8 @@
-                               ext4_error(orig_inode->i_sb, __func__,
-                                       "We replaced blocks too much! "
-                                       "sum of replaced: %llu requested: %llu",
+--- linux-stage.orig/fs/ext4/move_extent.c     2011-03-14 17:17:57.742610199 +0800
++++ linux-stage/fs/ext4/move_extent.c  2011-03-14 17:18:00.284657501 +0800
+@@ -1388,7 +1388,8 @@
+                               ext4_error(orig_inode->i_sb, __func__,
+                                       "We replaced blocks too much! "
+                                       "sum of replaced: %llu requested: %llu",
 -                                      *moved_len, len);
 +                                      (unsigned long long)(*moved_len),
 +                                      (unsigned long long)(len));
-                               ret1 = -EIO;
-                               goto out;
-                       }
+                               ret1 = -EIO;
+                               goto out;
+                       }