Whamcloud - gitweb
LU-335 ldiskfs: SuSE 11 SP1 update for Lustre 2.X
authorJames Simmons <uja.ornl@gmail.com>
Thu, 16 Feb 2012 14:39:29 +0000 (09:39 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 2 Mar 2012 16:54:54 +0000 (11:54 -0500)
The ext4 code difference between SuSE and RHEL6 is very small.
Because of to this ldiskfs support for SuSE servers is mostly
based the RHEL6 ldisk work. Recently Lustre support migrated
to RHEL6.2 support which required the SuSE port to be updated.
This patch provides this update which works for the SuSE
2.6.32.45 kernel as well as remove some no longer needed
ldsiskfs patches for older SuSE releases.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Ia6763e8a35698018bc84c95564ec9ea63d5f2c33
Reviewed-on: http://review.whamcloud.com/2138
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
13 files changed:
ldiskfs/kernel_patches/patches/export-ext4-2.6-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-convert-group-lock-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-disable-delalloc-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-dynlocks-common-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-fiemap-2.6-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-lookup-dotdot-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-map_inode_page-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-max-dir-size-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-misc-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-prealloc-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-print-inum-in-htree-warning-sles11.patch [deleted file]
ldiskfs/kernel_patches/patches/ext4-update-sles11-rhel6.patch
ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series

diff --git a/ldiskfs/kernel_patches/patches/export-ext4-2.6-sles11.patch b/ldiskfs/kernel_patches/patches/export-ext4-2.6-sles11.patch
deleted file mode 100644 (file)
index aa288b9..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -124,6 +124,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)
-@@ -253,6 +254,8 @@ void ext4_journal_abort_handle(const cha
-       jbd2_journal_abort_handle(handle);
- }
-+EXPORT_SYMBOL(ext4_journal_abort_handle);
-+
- /* Deal with the reporting of failure conditions on a filesystem such as
-  * inconsistencies detected or read IO failures.
-  *
-@@ -2590,6 +2593,8 @@ out_fail:
-       return ret;
- }
-+EXPORT_SYMBOL(ext4_force_commit);
-+
- /*
-  * Setup any per-fs journal parameters now.  We'll do this both on
-  * initial mount, once the journal has been initialised but before we've
-@@ -3728,6 +3733,12 @@ int ext4_map_inode_page(struct inode *in
-                       unsigned long *blocks, int *created, int create);
- EXPORT_SYMBOL(ext4_map_inode_page);
-+EXPORT_SYMBOL(ext4_xattr_get);
-+EXPORT_SYMBOL(ext4_xattr_set_handle);
-+EXPORT_SYMBOL(ext4_bread);
-+EXPORT_SYMBOL(ext4_journal_start_sb);
-+EXPORT_SYMBOL(__ext4_journal_stop);
-+
- MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
- MODULE_DESCRIPTION("Fourth Extended Filesystem with extents");
- MODULE_LICENSE("GPL");
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -1047,6 +1047,8 @@ extern struct inode * ext4_orphan_get(st
- extern unsigned long ext4_count_free_inodes(struct super_block *);
- extern unsigned long ext4_count_dirs(struct super_block *);
- extern void ext4_check_inodes_bitmap(struct super_block *);
-+extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
-+                                                  ext4_group_t block_group);
- /* mballoc.c */
- extern long ext4_mb_stats;
-Index: linux-stage/fs/ext4/ialloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/ialloc.c
-+++ linux-stage/fs/ext4/ialloc.c
-@@ -96,7 +96,7 @@ unsigned ext4_init_inode_bitmap(struct s
-  *
-  * Return buffer_head of bitmap on success or NULL.
-  */
--static struct buffer_head *
-+struct buffer_head *
- ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
- {
-       struct ext4_group_desc *desc;
-@@ -159,6 +159,7 @@ ext4_read_inode_bitmap(struct super_bloc
-       }
-       return bh;
- }
-+EXPORT_SYMBOL(ext4_read_inode_bitmap);
- /*
-  * NOTE! When we get the inode, we're the only people
-Index: linux-stage/fs/ext4/balloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/balloc.c
-+++ linux-stage/fs/ext4/balloc.c
-@@ -238,6 +238,7 @@ struct ext4_group_desc * ext4_get_group_
-               *bh = sbi->s_group_desc[group_desc];
-       return desc;
- }
-+EXPORT_SYMBOL(ext4_get_group_desc);
- static int ext4_valid_block_bitmap(struct super_block *sb,
-                                       struct ext4_group_desc *desc,
diff --git a/ldiskfs/kernel_patches/patches/ext4-convert-group-lock-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-convert-group-lock-sles11.patch
deleted file mode 100644 (file)
index b7d08bf..0000000
+++ /dev/null
@@ -1,509 +0,0 @@
-Index: linux-stage/fs/ext4/balloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/balloc.c
-+++ linux-stage/fs/ext4/balloc.c
-@@ -329,16 +329,16 @@ ext4_read_block_bitmap(struct super_bloc
-               unlock_buffer(bh);
-               return bh;
-       }
--      spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group));
-+      ext4_lock_group(sb, block_group);
-       if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
-               ext4_init_block_bitmap(sb, bh, block_group, desc);
-               set_bitmap_uptodate(bh);
-               set_buffer_uptodate(bh);
--              spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
-+              ext4_unlock_group(sb, block_group);
-               unlock_buffer(bh);
-               return bh;
-       }
--      spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
-+      ext4_unlock_group(sb, block_group);
-       if (buffer_uptodate(bh)) {
-               /*
-                * if not uninit if bh is uptodate,
-@@ -454,7 +454,7 @@ void ext4_add_groupblocks(handle_t *hand
-       down_write(&grp->alloc_sem);
-       for (i = 0, blocks_freed = 0; i < count; i++) {
-               BUFFER_TRACE(bitmap_bh, "clear bit");
--              if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
-+              if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group),
-                                               bit + i, bitmap_bh->b_data)) {
-                       ext4_error(sb, __func__,
-                                  "bit already cleared for block %llu",
-@@ -464,18 +464,18 @@ void ext4_add_groupblocks(handle_t *hand
-                       blocks_freed++;
-               }
-       }
--      spin_lock(sb_bgl_lock(sbi, block_group));
-+      ext4_lock_group(sb, block_group);
-       blk_free_count = blocks_freed + ext4_free_blks_count(sb, desc);
-       ext4_free_blks_set(sb, desc, blk_free_count);
-       desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc);
--      spin_unlock(sb_bgl_lock(sbi, block_group));
-+      ext4_unlock_group(sb, block_group);
-       percpu_counter_add(&sbi->s_freeblocks_counter, blocks_freed);
-       if (sbi->s_log_groups_per_flex) {
-               ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
--              spin_lock(sb_bgl_lock(sbi, flex_group));
-+              ext4_lock_group(sb, flex_group);
-               sbi->s_flex_groups[flex_group].free_blocks += blocks_freed;
--              spin_unlock(sb_bgl_lock(sbi, flex_group));
-+              ext4_unlock_group(sb, flex_group);
-       }
-       /*
-        * request to reload the buddy with the
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -1342,33 +1342,32 @@ struct ext4_group_info {
- };
- #define EXT4_GROUP_INFO_NEED_INIT_BIT 0
--#define EXT4_GROUP_INFO_LOCKED_BIT    1
- #define EXT4_MB_GRP_NEED_INIT(grp)    \
-       (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state)))
--static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group)
-+static inline spinlock_t *ext4_group_lock_ptr(struct super_block *sb,
-+                                            ext4_group_t group)
- {
--      struct ext4_group_info *grinfo = ext4_get_group_info(sb, group);
-+      struct blockgroup_lock *bgl = &EXT4_SB(sb)->s_blockgroup_lock;
-+      return &bgl->locks[group & (NR_BG_LOCKS-1)].lock;
-+}
--      bit_spin_lock(EXT4_GROUP_INFO_LOCKED_BIT, &(grinfo->bb_state));
-+static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group)
-+{
-+      spin_lock(ext4_group_lock_ptr(sb, group));
- }
- static inline void ext4_unlock_group(struct super_block *sb,
-                                       ext4_group_t group)
- {
--      struct ext4_group_info *grinfo = ext4_get_group_info(sb, group);
--
--      bit_spin_unlock(EXT4_GROUP_INFO_LOCKED_BIT, &(grinfo->bb_state));
-+      spin_unlock(ext4_group_lock_ptr(sb, group));
- }
- static inline int ext4_is_group_locked(struct super_block *sb,
-                                       ext4_group_t group)
- {
--      struct ext4_group_info *grinfo = ext4_get_group_info(sb, group);
--
--      return bit_spin_is_locked(EXT4_GROUP_INFO_LOCKED_BIT,
--                                              &(grinfo->bb_state));
-+      return spin_is_locked(ext4_group_lock_ptr(sb, group));
- }
- /*
-Index: linux-stage/fs/ext4/ialloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/ialloc.c
-+++ linux-stage/fs/ext4/ialloc.c
-@@ -123,16 +123,16 @@ ext4_read_inode_bitmap(struct super_bloc
-               unlock_buffer(bh);
-               return bh;
-       }
--      spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group));
-+      ext4_lock_group(sb, block_group);
-       if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
-               ext4_init_inode_bitmap(sb, bh, block_group, desc);
-               set_bitmap_uptodate(bh);
-               set_buffer_uptodate(bh);
--              spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
-+              ext4_unlock_group(sb, block_group);
-               unlock_buffer(bh);
-               return bh;
-       }
--      spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
-+      ext4_unlock_group(sb, block_group);
-       if (buffer_uptodate(bh)) {
-               /*
-                * if not uninit if bh is uptodate,
-@@ -244,8 +244,8 @@ void ext4_free_inode(handle_t *handle, s
-               goto error_return;
-       /* Ok, now we can actually update the inode bitmaps.. */
--      if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
--                                      bit, bitmap_bh->b_data))
-+      if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group),
-+                                 bit, bitmap_bh->b_data))
-               ext4_error(sb, "ext4_free_inode",
-                          "bit already cleared for inode %lu", ino);
-       else {
-@@ -256,7 +256,7 @@ void ext4_free_inode(handle_t *handle, s
-               if (fatal) goto error_return;
-               if (gdp) {
--                      spin_lock(sb_bgl_lock(sbi, block_group));
-+                      ext4_lock_group(sb, block_group);
-                       count = ext4_free_inodes_count(sb, gdp) + 1;
-                       ext4_free_inodes_set(sb, gdp, count);
-                       if (is_directory) {
-@@ -265,16 +265,16 @@ void ext4_free_inode(handle_t *handle, s
-                       }
-                       gdp->bg_checksum = ext4_group_desc_csum(sbi,
-                                                       block_group, gdp);
--                      spin_unlock(sb_bgl_lock(sbi, block_group));
-+                      ext4_unlock_group(sb, block_group);
-                       percpu_counter_inc(&sbi->s_freeinodes_counter);
-                       if (is_directory)
-                               percpu_counter_dec(&sbi->s_dirs_counter);
-                       if (sbi->s_log_groups_per_flex) {
-                               flex_group = ext4_flex_group(sbi, block_group);
--                              spin_lock(sb_bgl_lock(sbi, flex_group));
-+                              ext4_lock_group(sb, flex_group);
-                               sbi->s_flex_groups[flex_group].free_inodes++;
--                              spin_unlock(sb_bgl_lock(sbi, flex_group));
-+                              ext4_unlock_group(sb, flex_group);
-                       }
-               }
-               BUFFER_TRACE(bh2, "call ext4_journal_dirty_metadata");
-@@ -595,10 +595,10 @@ static int find_group_other(struct super
- /*
-  * claim the inode from the inode bitmap. If the group
-- * is uninit we need to take the groups's sb_bgl_lock
-+ * is uninit we need to take the groups's ext4_group_lock
-  * and clear the uninit flag. The inode bitmap update
-  * and group desc uninit flag clear should be done
-- * after holding sb_bgl_lock so that ext4_read_inode_bitmap
-+ * after holding ext4_group_lock so that ext4_read_inode_bitmap
-  * doesn't race with the ext4_claim_inode
-  */
- static int ext4_claim_inode(struct super_block *sb,
-@@ -609,7 +609,7 @@ static int ext4_claim_inode(struct super
-       struct ext4_sb_info *sbi = EXT4_SB(sb);
-       struct ext4_group_desc *gdp = ext4_get_group_desc(sb, group, NULL);
--      spin_lock(sb_bgl_lock(sbi, group));
-+      ext4_lock_group(sb, group);
-       if (ext4_set_bit(ino, inode_bitmap_bh->b_data)) {
-               /* not a free inode */
-               retval = 1;
-@@ -618,7 +618,7 @@ static int ext4_claim_inode(struct super
-       ino++;
-       if ((group == 0 && ino < EXT4_FIRST_INO(sb)) ||
-                       ino > EXT4_INODES_PER_GROUP(sb)) {
--              spin_unlock(sb_bgl_lock(sbi, group));
-+              ext4_unlock_group(sb, group);
-               ext4_error(sb, __func__,
-                          "reserved inode or inode > inodes count - "
-                          "block_group = %u, inode=%lu", group,
-@@ -662,7 +662,7 @@ static int ext4_claim_inode(struct super
-       }
-       gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp);
- err_ret:
--      spin_unlock(sb_bgl_lock(sbi, group));
-+      ext4_unlock_group(sb, group);
-       return retval;
- }
-@@ -854,7 +854,7 @@ got:
-               }
-               free = 0;
--              spin_lock(sb_bgl_lock(sbi, group));
-+              ext4_lock_group(sb, group);
-               /* recheck and clear flag under lock if we still need to */
-               if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
-                       free = ext4_free_blocks_after_init(sb, group, gdp);
-@@ -863,7 +863,7 @@ got:
-                       gdp->bg_checksum = ext4_group_desc_csum(sbi, group,
-                                                               gdp);
-               }
--              spin_unlock(sb_bgl_lock(sbi, group));
-+              ext4_unlock_group(sb, group);
-               /* Don't need to dirty bitmap block if we didn't change it */
-               if (free) {
-@@ -888,9 +888,9 @@ got:
-       if (sbi->s_log_groups_per_flex) {
-               flex_group = ext4_flex_group(sbi, group);
--              spin_lock(sb_bgl_lock(sbi, flex_group));
-+              ext4_lock_group(sb, flex_group);
-               sbi->s_flex_groups[flex_group].free_inodes--;
--              spin_unlock(sb_bgl_lock(sbi, flex_group));
-+              ext4_unlock_group(sb, flex_group);
-       }
-       inode->i_uid = current_fsuid();
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
-@@ -375,24 +375,12 @@ static inline void mb_set_bit(int bit, v
-       ext4_set_bit(bit, addr);
- }
--static inline void mb_set_bit_atomic(spinlock_t *lock, int bit, void *addr)
--{
--      addr = mb_correct_addr_and_bit(&bit, addr);
--      ext4_set_bit_atomic(lock, bit, addr);
--}
--
- static inline void mb_clear_bit(int bit, void *addr)
- {
-       addr = mb_correct_addr_and_bit(&bit, addr);
-       ext4_clear_bit(bit, addr);
- }
--static inline void mb_clear_bit_atomic(spinlock_t *lock, int bit, void *addr)
--{
--      addr = mb_correct_addr_and_bit(&bit, addr);
--      ext4_clear_bit_atomic(lock, bit, addr);
--}
--
- static inline int mb_find_next_zero_bit(void *addr, int max, int start)
- {
-       int fix = 0, ret, tmpmax;
-@@ -805,17 +793,17 @@ static int ext4_mb_init_cache(struct pag
-                       unlock_buffer(bh[i]);
-                       continue;
-               }
--              spin_lock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
-+              ext4_lock_group(sb, first_group + i);
-               if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
-                       ext4_init_block_bitmap(sb, bh[i],
-                                               first_group + i, desc);
-                       set_bitmap_uptodate(bh[i]);
-                       set_buffer_uptodate(bh[i]);
--                      spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
-+                      ext4_unlock_group(sb, first_group + i);
-                       unlock_buffer(bh[i]);
-                       continue;
-               }
--              spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
-+              ext4_unlock_group(sb, first_group + i);
-               if (buffer_uptodate(bh[i])) {
-                       /*
-                        * if not uninit if bh is uptodate,
-@@ -1087,7 +1075,7 @@ static int mb_find_order_for_block(struc
-       return 0;
- }
--static void mb_clear_bits(spinlock_t *lock, void *bm, int cur, int len)
-+static void mb_clear_bits(void *bm, int cur, int len)
- {
-       __u32 *addr;
-@@ -1100,15 +1088,12 @@ static void mb_clear_bits(spinlock_t *lo
-                       cur += 32;
-                       continue;
-               }
--              if (lock)
--                      mb_clear_bit_atomic(lock, cur, bm);
--              else
--                      mb_clear_bit(cur, bm);
-+              mb_clear_bit(cur, bm);
-               cur++;
-       }
- }
--static void mb_set_bits(spinlock_t *lock, void *bm, int cur, int len)
-+static void mb_set_bits(void *bm, int cur, int len)
- {
-       __u32 *addr;
-@@ -1121,10 +1106,7 @@ static void mb_set_bits(spinlock_t *lock
-                       cur += 32;
-                       continue;
-               }
--              if (lock)
--                      mb_set_bit_atomic(lock, cur, bm);
--              else
--                      mb_set_bit(cur, bm);
-+              mb_set_bit(cur, bm);
-               cur++;
-       }
- }
-@@ -1339,8 +1321,7 @@ static int mb_mark_used(struct ext4_budd
-               e4b->bd_info->bb_counters[ord]++;
-       }
--      mb_set_bits(sb_bgl_lock(EXT4_SB(e4b->bd_sb), ex->fe_group),
--                      EXT4_MB_BITMAP(e4b), ex->fe_start, len0);
-+      mb_set_bits(EXT4_MB_BITMAP(e4b), ex->fe_start, len0);
-       mb_check_buddy(e4b);
-       return ret;
-@@ -2841,7 +2822,7 @@ int ext4_mb_init(struct super_block *sb,
-       return 0;
- }
--/* need to called with ext4 group lock (ext4_lock_group) */
-+/* need to called with the ext4 group lock held */
- static void ext4_mb_cleanup_pa(struct ext4_group_info *grp)
- {
-       struct ext4_prealloc_space *pa;
-@@ -3240,14 +3221,17 @@ ext4_mb_mark_diskspace_used(struct ext4_
-                * Fix the bitmap and repeat the block allocation
-                * We leak some of the blocks here.
-                */
--              mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group),
--                              bitmap_bh->b_data, ac->ac_b_ex.fe_start,
--                              ac->ac_b_ex.fe_len);
-+              ext4_lock_group(sb, ac->ac_b_ex.fe_group);
-+              mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start,
-+                          ac->ac_b_ex.fe_len);
-+              ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
-               err = ext4_journal_dirty_metadata(handle, bitmap_bh);
-               if (!err)
-                       err = -EAGAIN;
-               goto out_err;
-       }
-+
-+      ext4_lock_group(sb, ac->ac_b_ex.fe_group);
- #ifdef AGGRESSIVE_CHECK
-       {
-               int i;
-@@ -3257,9 +3241,7 @@ ext4_mb_mark_diskspace_used(struct ext4_
-               }
-       }
- #endif
--      spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
--      mb_set_bits(NULL, bitmap_bh->b_data,
--                              ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
-+      mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start,ac->ac_b_ex.fe_len);
-       if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
-               gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
-               ext4_free_blks_set(sb, gdp,
-@@ -3269,7 +3251,8 @@ ext4_mb_mark_diskspace_used(struct ext4_
-       len = ext4_free_blks_count(sb, gdp) - ac->ac_b_ex.fe_len;
-       ext4_free_blks_set(sb, gdp, len);
-       gdp->bg_checksum = ext4_group_desc_csum(sbi, ac->ac_b_ex.fe_group, gdp);
--      spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
-+
-+      ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
-       percpu_counter_sub(&sbi->s_freeblocks_counter, ac->ac_b_ex.fe_len);
-       /*
-        * Now reduce the dirty block count also. Should not go negative
-@@ -3284,9 +3267,9 @@ ext4_mb_mark_diskspace_used(struct ext4_
-       if (sbi->s_log_groups_per_flex) {
-               ext4_group_t flex_group = ext4_flex_group(sbi,
-                                                         ac->ac_b_ex.fe_group);
--              spin_lock(sb_bgl_lock(sbi, flex_group));
-+              ext4_lock_group(sb, flex_group);
-               sbi->s_flex_groups[flex_group].free_blocks -= ac->ac_b_ex.fe_len;
--              spin_unlock(sb_bgl_lock(sbi, flex_group));
-+              ext4_unlock_group(sb, flex_group);
-       }
-       err = ext4_journal_dirty_metadata(handle, bitmap_bh);
-@@ -3686,7 +3669,7 @@ ext4_mb_use_preallocated(struct ext4_all
-  * the function goes through all block freed in the group
-  * but not yet committed and marks them used in in-core bitmap.
-  * buddy must be generated from this bitmap
-- * Need to be called with ext4 group lock (ext4_lock_group)
-+ * Need to be called with the ext4 group lock held
-  */
- static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap,
-                                               ext4_group_t group)
-@@ -3700,9 +3683,7 @@ static void ext4_mb_generate_from_freeli
-       while (n) {
-               entry = rb_entry(n, struct ext4_free_data, node);
--              mb_set_bits(sb_bgl_lock(EXT4_SB(sb), group),
--                              bitmap, entry->start_blk,
--                              entry->count);
-+              mb_set_bits(bitmap, entry->start_blk, entry->count);
-               n = rb_next(n);
-       }
-       return;
-@@ -3744,7 +3725,7 @@ int ext4_mb_check_ondisk_bitmap(struct s
- /*
-  * the function goes through all preallocation in this group and marks them
-  * used in in-core bitmap. buddy must be generated from this bitmap
-- * Need to be called with ext4 group lock (ext4_lock_group)
-+ * Need to be called with ext4 group lock held.
-  */
- static int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-                                       ext4_group_t group)
-@@ -3790,8 +3771,7 @@ static int ext4_mb_generate_from_pa(stru
-                       continue;
-               }
-               BUG_ON(groupnr != group);
--              mb_set_bits(sb_bgl_lock(EXT4_SB(sb), group),
--                                              bitmap, start, len);
-+              mb_set_bits(bitmap, start, len);
-               preallocated += len;
-               count++;
-       }
-@@ -5124,36 +5104,32 @@ do_more:
-               new_entry->group  = block_group;
-               new_entry->count = count;
-               new_entry->t_tid = handle->h_transaction->t_tid;
-+
-               ext4_lock_group(sb, block_group);
--              mb_clear_bits(sb_bgl_lock(sbi, block_group), bitmap_bh->b_data,
--                              bit, count);
-+              mb_clear_bits(bitmap_bh->b_data, bit, count);
-               ext4_mb_free_metadata(handle, &e4b, new_entry);
--              ext4_unlock_group(sb, block_group);
-       } else {
--              ext4_lock_group(sb, block_group);
-               /* need to update group_info->bb_free and bitmap
-                * with group lock held. generate_buddy look at
-                * them with group lock_held
-                */
--              mb_clear_bits(sb_bgl_lock(sbi, block_group), bitmap_bh->b_data,
--                              bit, count);
-+              ext4_lock_group(sb, block_group);
-+              mb_clear_bits(bitmap_bh->b_data, bit, count);
-               mb_free_blocks(inode, &e4b, bit, count);
-               ext4_mb_return_to_preallocation(inode, &e4b, block, count);
--              ext4_unlock_group(sb, block_group);
-       }
--      spin_lock(sb_bgl_lock(sbi, block_group));
-       ret = ext4_free_blks_count(sb, gdp) + count;
-       ext4_free_blks_set(sb, gdp, ret);
-       gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp);
--      spin_unlock(sb_bgl_lock(sbi, block_group));
-+      ext4_unlock_group(sb, block_group);
-       percpu_counter_add(&sbi->s_freeblocks_counter, count);
-       if (sbi->s_log_groups_per_flex) {
-               ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
--              spin_lock(sb_bgl_lock(sbi, flex_group));
-+              ext4_lock_group(sb, flex_group);
-               sbi->s_flex_groups[flex_group].free_blocks += count;
--              spin_unlock(sb_bgl_lock(sbi, flex_group));
-+              ext4_unlock_group(sb, flex_group);
-       }
-       ext4_mb_release_desc(&e4b);
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -2020,18 +2020,18 @@ static int ext4_check_descriptors(struct
-                              "(block %llu)!\n", i, inode_table);
-                       return 0;
-               }
--              spin_lock(sb_bgl_lock(sbi, i));
-+              ext4_lock_group(sb, i);
-               if (!ext4_group_desc_csum_verify(sbi, i, gdp)) {
-                       printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
-                              "Checksum for group %u failed (%u!=%u)\n",
-                              i, le16_to_cpu(ext4_group_desc_csum(sbi, i,
-                              gdp)), le16_to_cpu(gdp->bg_checksum));
-                       if (!(sb->s_flags & MS_RDONLY)) {
--                              spin_unlock(sb_bgl_lock(sbi, i));
-+                              ext4_unlock_group(sb, i);
-                               return 0;
-                       }
-               }
--              spin_unlock(sb_bgl_lock(sbi, i));
-+              ext4_unlock_group(sb, i);
-               if (!flexbg_flag)
-                       first_block += EXT4_BLOCKS_PER_GROUP(sb);
-       }
diff --git a/ldiskfs/kernel_patches/patches/ext4-disable-delalloc-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-disable-delalloc-sles11.patch
deleted file mode 100644 (file)
index c62b953..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-Disable the DELALLOC feature because it is not robust in ext4 versions < 2.6.31.
-
---
-Index: linux-2.6.27.21-0.1/fs/ext4/super.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/super.c   2009-06-15 05:36:44.000000000 -0400
-+++ linux-2.6.27.21-0.1/fs/ext4/super.c        2009-06-15 05:40:38.000000000 -0400
-@@ -2462,13 +2462,6 @@ static int ext4_fill_super(struct super_
-                       "extents feature not enabled on this filesystem, "
-                       "use tune2fs.\n");
--      /*
--       * enable delayed allocation by default
--       * Use -o nodelalloc to turn it off
--       */
--      set_opt(sbi->s_mount_opt, DELALLOC);
--
--
-       if (!parse_options((char *) data, sb, &journal_inum, &journal_devnum,
-                          NULL, 0))
-               goto failed_mount;
diff --git a/ldiskfs/kernel_patches/patches/ext4-dynlocks-common-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-dynlocks-common-sles11.patch
deleted file mode 100644 (file)
index a5c39e6..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-diff -rupN 2.6.27.21/fs/ext4/dynlocks.c 2.6.27.21_1//fs/ext4/dynlocks.c
---- 2.6.27.21/fs/ext4/dynlocks.c       1970-01-01 05:30:00.000000000 +0530
-+++ 2.6.27.21_1//fs/ext4/dynlocks.c    2009-08-23 10:39:59.000000000 +0530
-@@ -0,0 +1,238 @@
-+/*
-+ * Dynamic Locks
-+ *
-+ * struct dynlock is lockspace
-+ * one may request lock (exclusive or shared) for some value
-+ * in that lockspace
-+ *
-+ */
-+
-+#include <linux/dynlocks.h>
-+#include <linux/module.h>
-+#include <linux/slab_def.h>
-+#include <linux/sched.h>
-+
-+#define DYNLOCK_HANDLE_MAGIC  0xd19a10c
-+#define DYNLOCK_HANDLE_DEAD   0xd1956ee
-+#define DYNLOCK_LIST_MAGIC    0x11ee91e6
-+
-+typedef struct kmem_cache kmem_cache_t;
-+
-+static kmem_cache_t * dynlock_cachep = NULL;
-+
-+struct dynlock_handle {
-+      unsigned                dh_magic;
-+      struct list_head        dh_list;
-+      unsigned long           dh_value;       /* lock value */
-+      int                     dh_refcount;    /* number of users */
-+      int                     dh_readers;
-+      int                     dh_writers;
-+      int                     dh_pid;         /* holder of the lock */
-+      wait_queue_head_t       dh_wait;
-+};
-+
-+int __init dynlock_cache_init(void)
-+{
-+      int rc = 0;
-+
-+      /* printk(KERN_INFO "init dynlocks cache\n"); */
-+      dynlock_cachep = kmem_cache_create("dynlock_cache",
-+                                       sizeof(struct dynlock_handle),
-+                                       0,
-+                                       SLAB_HWCACHE_ALIGN,
-+                                       NULL);
-+      if (dynlock_cachep == NULL) {
-+              printk(KERN_ERR "Not able to create dynlock cache");
-+              rc = -ENOMEM;
-+      }
-+      return rc;
-+}
-+
-+void dynlock_cache_exit(void)
-+{
-+      /* printk(KERN_INFO "exit dynlocks cache\n"); */
-+      kmem_cache_destroy(dynlock_cachep);
-+}
-+
-+/*
-+ * dynlock_init
-+ *
-+ * initialize lockspace
-+ *
-+ */
-+void dynlock_init(struct dynlock *dl)
-+{
-+      spin_lock_init(&dl->dl_list_lock);
-+      INIT_LIST_HEAD(&dl->dl_list);
-+      dl->dl_magic = DYNLOCK_LIST_MAGIC;
-+}
-+EXPORT_SYMBOL(dynlock_init);
-+
-+/*
-+ * dynlock_lock
-+ *
-+ * acquires lock (exclusive or shared) in specified lockspace
-+ * each lock in lockspace is allocated separately, so user have
-+ * to specify GFP flags.
-+ * routine returns pointer to lock. this pointer is intended to
-+ * be passed to dynlock_unlock
-+ *
-+ */
-+struct dynlock_handle *dynlock_lock(struct dynlock *dl, unsigned long value,
-+                                  enum dynlock_type lt, gfp_t gfp)
-+{
-+      struct dynlock_handle *nhl = NULL;
-+      struct dynlock_handle *hl;
-+
-+      BUG_ON(dl == NULL);
-+      BUG_ON(dl->dl_magic != DYNLOCK_LIST_MAGIC);
-+
-+repeat:
-+      /* find requested lock in lockspace */
-+      spin_lock(&dl->dl_list_lock);
-+      BUG_ON(dl->dl_list.next == NULL);
-+      BUG_ON(dl->dl_list.prev == NULL);
-+      list_for_each_entry(hl, &dl->dl_list, dh_list) {
-+              BUG_ON(hl->dh_list.next == NULL);
-+              BUG_ON(hl->dh_list.prev == NULL);
-+              BUG_ON(hl->dh_magic != DYNLOCK_HANDLE_MAGIC);
-+              if (hl->dh_value == value) {
-+                      /* lock is found */
-+                      if (nhl) {
-+                              /* someone else just allocated
-+                               * lock we didn't find and just created
-+                               * so, we drop our lock
-+                               */
-+                              kmem_cache_free(dynlock_cachep, nhl);
-+                              nhl = NULL;
-+                      }
-+                      hl->dh_refcount++;
-+                      goto found;
-+              }
-+      }
-+      /* lock not found */
-+      if (nhl) {
-+              /* we already have allocated lock. use it */
-+              hl = nhl;
-+              nhl = NULL;
-+              list_add(&hl->dh_list, &dl->dl_list);
-+              goto found;
-+      }
-+      spin_unlock(&dl->dl_list_lock);
-+      
-+      /* lock not found and we haven't allocated lock yet. allocate it */
-+      nhl = kmem_cache_alloc(dynlock_cachep, gfp);
-+      if (nhl == NULL)
-+              return NULL;
-+      nhl->dh_refcount = 1;
-+      nhl->dh_value = value;
-+      nhl->dh_readers = 0;
-+      nhl->dh_writers = 0;
-+      nhl->dh_magic = DYNLOCK_HANDLE_MAGIC;
-+      init_waitqueue_head(&nhl->dh_wait);
-+
-+      /* while lock is being allocated, someone else may allocate it
-+       * and put onto to list. check this situation
-+       */
-+      goto repeat;
-+
-+found:
-+      if (lt == DLT_WRITE) {
-+              /* exclusive lock: user don't want to share lock at all
-+               * NOTE: one process may take the same lock several times
-+               * this functionaly is useful for rename operations */
-+              while ((hl->dh_writers && hl->dh_pid != current->pid) ||
-+                              hl->dh_readers) {
-+                      spin_unlock(&dl->dl_list_lock);
-+                      wait_event(hl->dh_wait,
-+                              hl->dh_writers == 0 && hl->dh_readers == 0);
-+                      spin_lock(&dl->dl_list_lock);
-+              }
-+              hl->dh_writers++;
-+      } else {
-+              /* shared lock: user do not want to share lock with writer */
-+              while (hl->dh_writers) {
-+                      spin_unlock(&dl->dl_list_lock);
-+                      wait_event(hl->dh_wait, hl->dh_writers == 0);
-+                      spin_lock(&dl->dl_list_lock);
-+              }
-+              hl->dh_readers++;
-+      }
-+      hl->dh_pid = current->pid;
-+      spin_unlock(&dl->dl_list_lock);
-+
-+      return hl;
-+}
-+EXPORT_SYMBOL(dynlock_lock);
-+
-+
-+/*
-+ * dynlock_unlock
-+ *
-+ * user have to specify lockspace (dl) and pointer to lock structure
-+ * returned by dynlock_lock()
-+ *
-+ */
-+void dynlock_unlock(struct dynlock *dl, struct dynlock_handle *hl)
-+{
-+      int wakeup = 0;
-+      
-+      BUG_ON(dl == NULL);
-+      BUG_ON(hl == NULL);
-+      BUG_ON(dl->dl_magic != DYNLOCK_LIST_MAGIC);
-+
-+      if (hl->dh_magic != DYNLOCK_HANDLE_MAGIC)
-+              printk(KERN_EMERG "wrong lock magic: %#x\n", hl->dh_magic);
-+
-+      BUG_ON(hl->dh_magic != DYNLOCK_HANDLE_MAGIC);
-+      BUG_ON(hl->dh_writers != 0 && current->pid != hl->dh_pid);
-+
-+      spin_lock(&dl->dl_list_lock);
-+      if (hl->dh_writers) {
-+              BUG_ON(hl->dh_readers != 0);
-+              hl->dh_writers--;
-+              if (hl->dh_writers == 0)
-+                      wakeup = 1;
-+      } else if (hl->dh_readers) {
-+              hl->dh_readers--;
-+              if (hl->dh_readers == 0)
-+                      wakeup = 1;
-+      } else {
-+              BUG();
-+      }
-+      if (wakeup) {
-+              hl->dh_pid = 0;
-+              wake_up(&hl->dh_wait);
-+      }
-+      if (--(hl->dh_refcount) == 0) {
-+              hl->dh_magic = DYNLOCK_HANDLE_DEAD;
-+              list_del(&hl->dh_list);
-+              kmem_cache_free(dynlock_cachep, hl);
-+      }
-+      spin_unlock(&dl->dl_list_lock);
-+}
-+EXPORT_SYMBOL(dynlock_unlock);
-+
-+int dynlock_is_locked(struct dynlock *dl, unsigned long value)
-+{
-+      struct dynlock_handle *hl;
-+      int result = 0;
-+
-+      /* find requested lock in lockspace */
-+      spin_lock(&dl->dl_list_lock);
-+      BUG_ON(dl->dl_list.next == NULL);
-+      BUG_ON(dl->dl_list.prev == NULL);
-+      list_for_each_entry(hl, &dl->dl_list, dh_list) {
-+              BUG_ON(hl->dh_list.next == NULL);
-+              BUG_ON(hl->dh_list.prev == NULL);
-+              BUG_ON(hl->dh_magic != DYNLOCK_HANDLE_MAGIC);
-+              if (hl->dh_value == value && hl->dh_pid == current->pid) {
-+                      /* lock is found */
-+                      result = 1;
-+                      break;
-+              }
-+      }
-+      spin_unlock(&dl->dl_list_lock);
-+      return result;
-+}
-+EXPORT_SYMBOL(dynlock_is_locked);
-diff -rupN 2.6.27.21/include/linux/dynlocks.h 2.6.27.21_1//include/linux/dynlocks.h
---- 2.6.27.21/include/linux/dynlocks.h 1970-01-01 05:30:00.000000000 +0530
-+++ 2.6.27.21_1//include/linux/dynlocks.h      2009-08-23 10:40:07.000000000 +0530
-@@ -0,0 +1,34 @@
-+#ifndef _LINUX_DYNLOCKS_H
-+#define _LINUX_DYNLOCKS_H
-+
-+#include <linux/list.h>
-+#include <linux/wait.h>
-+
-+struct dynlock_handle;
-+
-+/*
-+ * lock's namespace:
-+ *   - list of locks
-+ *   - lock to protect this list
-+ */
-+struct dynlock {
-+      unsigned                dl_magic;
-+      struct list_head        dl_list;
-+      spinlock_t              dl_list_lock;
-+};
-+
-+enum dynlock_type {
-+      DLT_WRITE,
-+      DLT_READ
-+};
-+
-+int dynlock_cache_init(void);
-+void dynlock_cache_exit(void);
-+void dynlock_init(struct dynlock *dl);
-+struct dynlock_handle *dynlock_lock(struct dynlock *dl, unsigned long value,
-+                                  enum dynlock_type lt, gfp_t gfp);
-+void dynlock_unlock(struct dynlock *dl, struct dynlock_handle *lock);
-+int dynlock_is_locked(struct dynlock *dl, unsigned long value);
-+
-+#endif
-+
diff --git a/ldiskfs/kernel_patches/patches/ext4-fiemap-2.6-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-fiemap-2.6-sles11.patch
deleted file mode 100644 (file)
index 3027d40..0000000
+++ /dev/null
@@ -1,569 +0,0 @@
-A large part of this code is from the generic VFS code in fs/ioctl.c in the
-upstream kernel.
-
-Index: linux-2.6.27.21-0.1/fs/ext4/ioctl.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ioctl.c   2009-07-07 14:08:22.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ioctl.c        2009-07-07 14:38:12.000000000 +0530
-@@ -18,6 +18,162 @@
- #include "ext4_jbd2.h"
- #include "ext4.h"
-+#include "fiemap.h"
-+
-+/* So that the fiemap access checks can't overflow on 32 bit machines. */
-+#define FIEMAP_MAX_EXTENTS     (UINT_MAX / sizeof(struct fiemap_extent))
-+
-+/**
-+ * fiemap_fill_next_extent - Fiemap helper function
-+ * @fieinfo:   Fiemap context passed into ->fiemap
-+ * @logical:   Extent logical start offset, in bytes
-+ * @phys:      Extent physical start offset, in bytes
-+ * @len:       Extent length, in bytes
-+ * @flags:     FIEMAP_EXTENT flags that describe this extent
-+ * @lun:       LUN on which this extent resides
-+ *
-+ * Called from file system ->fiemap callback. Will populate extent
-+ * info as passed in via arguments and copy to user memory. On
-+ * success, extent count on fieinfo is incremented.
-+ *
-+ * Returns 0 on success, -errno on error, 1 if this was the last
-+ * extent that will fit in user array.
-+ */
-+#define SET_UNKNOWN_FLAGS      (FIEMAP_EXTENT_DELALLOC)
-+#define SET_NO_DIRECT_FLAGS    (FIEMAP_EXTENT_DATA_ENCRYPTED  \
-+                              |FIEMAP_EXTENT_NET)
-+#define SET_NO_UNMOUNTED_IO_FLAGS       (FIEMAP_EXTENT_DATA_ENCRYPTED)
-+#define SET_NOT_ALIGNED_FLAGS  (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
-+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
-+                          u64 phys, u64 len, u32 flags, dev_t dev)
-+{
-+      struct fiemap_extent extent = { 0 };
-+      struct fiemap_extent *dest = fieinfo->fi_extents_start;
-+
-+      /* only count the extents */
-+      if (fieinfo->fi_extents_max == 0) {
-+              fieinfo->fi_extents_mapped++;
-+              return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
-+      }
-+
-+      if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
-+              return 1;
-+
-+      if (flags & SET_UNKNOWN_FLAGS)
-+              flags |= FIEMAP_EXTENT_UNKNOWN;
-+      if (flags & SET_NO_DIRECT_FLAGS)
-+              flags |= FIEMAP_EXTENT_NO_DIRECT;
-+      if (flags & SET_NOT_ALIGNED_FLAGS)
-+              flags |= FIEMAP_EXTENT_NOT_ALIGNED;
-+      if (flags & SET_NO_UNMOUNTED_IO_FLAGS)
-+              flags |= FIEMAP_EXTENT_ENCODED;
-+
-+      extent.fe_logical = logical;
-+      extent.fe_physical = phys;
-+      extent.fe_length = len;
-+      extent.fe_flags = flags;
-+      extent.fe_device = new_encode_dev(dev);
-+
-+      dest += fieinfo->fi_extents_mapped;
-+      if (copy_to_user(dest, &extent, sizeof(extent)))
-+              return -EFAULT;
-+
-+      fieinfo->fi_extents_mapped++;
-+      if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
-+              return 1;
-+
-+      return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
-+}
-+
-+static int fiemap_check_ranges(struct super_block *sb,
-+                             u64 start, u64 len, u64 *new_len)
-+{
-+      *new_len = len;
-+
-+      if (len == 0)
-+              return -EINVAL;
-+
-+      if (start > sb->s_maxbytes)
-+              return -EFBIG;
-+
-+      /*
-+       * Shrink request scope to what the fs can actually handle.
-+       */
-+      if ((len > sb->s_maxbytes) ||
-+          (sb->s_maxbytes - len) < start)
-+              *new_len = sb->s_maxbytes - start;
-+
-+      return 0;
-+}
-+
-+/*
-+ * fiemap_check_flags - check validity of requested flags for fiemap
-+ * @fieinfo:   Fiemap context passed into ->fiemap
-+ * @fs_flags:  Set of fiemap flags that the file system understands
-+ *
-+ * Called from file system ->fiemap callback. This will compute the
-+ * intersection of valid fiemap flags and those that the fs supports. That
-+ * value is then compared against the user supplied flags. In case of bad user
-+ * flags, the invalid values will be written into the fieinfo structure, and
-+ * -EBADR is returned, which tells ioctl_fiemap() to return those values to
-+ * userspace. For this reason, a return code of -EBADR should be preserved.
-+ *
-+ * Returns 0 on success, -EBADR on bad flags.
-+ */
-+int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags)
-+{
-+      u32 incompat_flags;
-+
-+      incompat_flags = fieinfo->fi_flags & ~(FIEMAP_FLAGS_COMPAT & fs_flags);
-+      if (incompat_flags) {
-+              fieinfo->fi_flags = incompat_flags;
-+              return -EBADR;
-+      }
-+
-+      return 0;
-+}
-+
-+int ioctl_fiemap(struct inode *inode, struct file *filp, unsigned long arg)
-+{
-+      struct fiemap fiemap;
-+      u64 len;
-+      struct fiemap_extent_info fieinfo = {0, };
-+      struct super_block *sb = inode->i_sb;
-+      int error = 0;
-+
-+      if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
-+                         sizeof(struct fiemap)))
-+               return -EFAULT;
-+
-+      if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
-+              return -EINVAL;
-+
-+      error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
-+                                  &len);
-+      if (error)
-+              return error;
-+
-+      fieinfo.fi_flags = fiemap.fm_flags;
-+      fieinfo.fi_extents_max = fiemap.fm_extent_count;
-+      fieinfo.fi_extents_start = (struct fiemap_extent *)(arg + sizeof(fiemap));
-+
-+      if (fiemap.fm_extent_count != 0 &&
-+          !access_ok(VERIFY_WRITE, (void *)arg,
-+                     offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
-+              return -EFAULT;
-+
-+      if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
-+              filemap_write_and_wait(inode->i_mapping);
-+
-+      error = ext4_fiemap(inode, &fieinfo, fiemap.fm_start, len);
-+      fiemap.fm_flags = fieinfo.fi_flags;
-+      fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped;
-+      if (copy_to_user((char *)arg, &fiemap, sizeof(fiemap)))
-+              error = -EFAULT;
-+
-+      return error;
-+}
-+
- long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
- {
-       struct inode *inode = filp->f_dentry->d_inode;
-@@ -263,6 +419,10 @@
-               return err;
-       }
-+      case EXT4_IOC_FIEMAP: {
-+              return ioctl_fiemap(inode, filp, arg);
-+      }
-+
-       default:
-               return -ENOTTY;
-       }
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h    2009-07-07 14:36:58.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4.h 2009-07-07 14:46:12.000000000 +0530
-@@ -302,7 +302,8 @@
- #define EXT4_IOC_GROUP_EXTEND         _IOW('f', 7, unsigned long)
- #define EXT4_IOC_GROUP_ADD            _IOW('f', 8, struct ext4_new_group_input)
- #define EXT4_IOC_MIGRATE              _IO('f', 9)
-- /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */
-+#define EXT4_IOC_FIEMAP                       _IOWR('f', 11, struct fiemap)
-+
- /*
-  * ioctl commands in 32 bit emulation
-@@ -320,6 +321,8 @@
- #define EXT4_IOC32_GETVERSION_OLD     FS_IOC32_GETVERSION
- #define EXT4_IOC32_SETVERSION_OLD     FS_IOC32_SETVERSION
-+/* FIEMAP flags supported by ext4 */
-+#define EXT4_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC)
- /*
-  *  Mount options
-@@ -1138,6 +1141,9 @@
- /* ioctl.c */
- extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
- extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
-+struct fiemap_extent_info;
-+extern int ext4_fiemap(struct inode *, struct fiemap_extent_info *, __u64,
-+                     __u64);
- /* migrate.c */
- extern int ext4_ext_migrate(struct inode *);
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_extents.h    2009-07-07 14:08:22.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h 2009-07-07 14:46:11.000000000 +0530
-@@ -128,6 +128,22 @@
- #define EXT_MAX_BLOCK 0xffffffff
- /*
-+ * to be called by ext4_ext_walk_space()
-+ * negative retcode - error
-+ * positive retcode - signal for ext4_ext_walk_space(), see below
-+ * callback must return valid extent (passed or newly created)
-+ */
-+typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
-+                                  struct ext4_ext_cache *,
-+                                  struct ext4_extent *, void *);
-+
-+#define HAVE_EXT_PREPARE_CB_EXTENT
-+
-+#define EXT_CONTINUE   0
-+#define EXT_BREAK      1
-+#define EXT_REPEAT     2
-+
-+/*
-  * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
-  * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
-  * MSB of ee_len field in the extent datastructure to signify if this
-@@ -219,6 +235,8 @@
-                                struct ext4_extent *);
- extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
- extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
-+extern int ext4_ext_walk_space(struct inode *, ext4_lblk_t, ext4_lblk_t,
-+                             ext_prepare_callback, void *);
- extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
-                                                       struct ext4_ext_path *);
- extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
-Index: linux-2.6.27.21-0.1/fs/ext4/extents.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/extents.c 2009-07-07 14:08:22.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/extents.c      2009-07-07 14:46:59.000000000 +0530
-@@ -42,7 +42,7 @@
- #include <asm/uaccess.h>
- #include "ext4_jbd2.h"
- #include "ext4_extents.h"
--
-+#include "fiemap.h"
- /*
-  * ext_pblock:
-@@ -1622,6 +1622,114 @@
-       return err;
- }
-+int ext4_ext_walk_space(struct inode *inode, ext4_lblk_t block,
-+                      ext4_lblk_t num, ext_prepare_callback func,
-+                      void *cbdata)
-+{
-+      struct ext4_ext_path *path = NULL;
-+      struct ext4_ext_cache cbex;
-+      struct ext4_extent *ex;
-+      ext4_lblk_t next, start = 0, end = 0;
-+      ext4_lblk_t last = block + num;
-+      int depth, exists, err = 0;
-+
-+      BUG_ON(func == NULL);
-+      BUG_ON(inode == NULL);
-+
-+      while (block < last && block != EXT_MAX_BLOCK) {
-+              num = last - block;
-+              /* find extent for this block */
-+              path = ext4_ext_find_extent(inode, block, path);
-+              if (IS_ERR(path)) {
-+                      err = PTR_ERR(path);
-+                      path = NULL;
-+                      break;
-+              }
-+
-+              depth = ext_depth(inode);
-+              BUG_ON(path[depth].p_hdr == NULL);
-+              ex = path[depth].p_ext;
-+              next = ext4_ext_next_allocated_block(path);
-+
-+              exists = 0;
-+              if (!ex) {
-+                      /* there is no extent yet, so try to allocate
-+                       * all requested space */
-+                      start = block;
-+                      end = block + num;
-+              } else if (le32_to_cpu(ex->ee_block) > block) {
-+                      /* need to allocate space before found extent */
-+                      start = block;
-+                      end = le32_to_cpu(ex->ee_block);
-+                      if (block + num < end)
-+                              end = block + num;
-+              } else if (block >= le32_to_cpu(ex->ee_block)
-+                                      + ext4_ext_get_actual_len(ex)) {
-+                      /* need to allocate space after found extent */
-+                      start = block;
-+                      end = block + num;
-+                      if (end >= next)
-+                              end = next;
-+              } else if (block >= le32_to_cpu(ex->ee_block)) {
-+                      /*
-+                       * some part of requested space is covered
-+                       * by found extent
-+                       */
-+                      start = block;
-+                      end = le32_to_cpu(ex->ee_block)
-+                              + ext4_ext_get_actual_len(ex);
-+                      if (block + num < end)
-+                              end = block + num;
-+                      exists = 1;
-+              } else {
-+                      BUG();
-+              }
-+              BUG_ON(end <= start);
-+
-+              if (!exists) {
-+                      cbex.ec_block = start;
-+                      cbex.ec_len = end - start;
-+                      cbex.ec_start = 0;
-+                      cbex.ec_type = EXT4_EXT_CACHE_GAP;
-+              } else {
-+                      cbex.ec_block = le32_to_cpu(ex->ee_block);
-+                      cbex.ec_len = ext4_ext_get_actual_len(ex);
-+                      cbex.ec_start = ext_pblock(ex);
-+                      cbex.ec_type = EXT4_EXT_CACHE_EXTENT;
-+              }
-+
-+              BUG_ON(cbex.ec_len == 0);
-+              err = func(inode, path, &cbex, ex, cbdata);
-+              ext4_ext_drop_refs(path);
-+
-+              if (err < 0)
-+                      break;
-+
-+              if (err == EXT_REPEAT)
-+                      continue;
-+              else if (err == EXT_BREAK) {
-+                      err = 0;
-+                      break;
-+              }
-+
-+              if (ext_depth(inode) != depth) {
-+                      /* depth was changed. we have to realloc path */
-+                      kfree(path);
-+                      path = NULL;
-+              }
-+
-+              block = cbex.ec_block + cbex.ec_len;
-+      }
-+
-+      if (path) {
-+              ext4_ext_drop_refs(path);
-+              kfree(path);
-+      }
-+
-+      return err;
-+}
-+EXPORT_SYMBOL(ext4_ext_walk_space);
-+
- static void
- ext4_ext_put_in_cache(struct inode *inode, ext4_lblk_t block,
-                       __u32 len, ext4_fsblk_t start, int type)
-@@ -2966,3 +3074,100 @@
-       mutex_unlock(&inode->i_mutex);
-       return ret > 0 ? ret2 : ret;
- }
-+
-+/*
-+ * Callback function called for each extent to gather FIEMAP information.
-+ */
-+int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
-+                     struct ext4_ext_cache *newex, struct ext4_extent *ex,
-+                     void *data)
-+{
-+      struct fiemap_extent_info *fieinfo = data;
-+      unsigned char blksize_bits = inode->i_sb->s_blocksize_bits;
-+      __u64   logical;
-+      __u64   physical;
-+      __u64   length;
-+      __u32   flags = 0;
-+      int     error;
-+
-+      logical =  (__u64)newex->ec_block << blksize_bits;
-+
-+      if (newex->ec_type == EXT4_EXT_CACHE_GAP) {
-+              pgoff_t offset;
-+              struct page *page;
-+              struct buffer_head *bh = NULL;
-+
-+              offset = logical >> PAGE_SHIFT;
-+              page = find_get_page(inode->i_mapping, offset);
-+              if (!page || !page_has_buffers(page))
-+                      return EXT_CONTINUE;
-+
-+              bh = page_buffers(page);
-+
-+              if (!bh)
-+                      return EXT_CONTINUE;
-+
-+              if (buffer_delay(bh)) {
-+                      flags |= FIEMAP_EXTENT_DELALLOC;
-+                      page_cache_release(page);
-+              } else {
-+                      page_cache_release(page);
-+                      return EXT_CONTINUE;
-+              }
-+      }
-+
-+      physical = (__u64)newex->ec_start << blksize_bits;
-+      length =   (__u64)newex->ec_len << blksize_bits;
-+
-+      if (ex && ext4_ext_is_uninitialized(ex))
-+              flags |= FIEMAP_EXTENT_UNWRITTEN;
-+
-+      /*
-+       * If this extent reaches EXT_MAX_BLOCK, it must be last.
-+       *
-+       * Or if ext4_ext_next_allocated_block is EXT_MAX_BLOCK,
-+       * this indicates no more allocated blocks.
-+       *
-+       * XXX this might miss a single-block extent at EXT_MAX_BLOCK
-+       */
-+      if (ext4_ext_next_allocated_block(path) == EXT_MAX_BLOCK ||
-+          newex->ec_block + newex->ec_len - 1 == EXT_MAX_BLOCK)
-+              flags |= FIEMAP_EXTENT_LAST;
-+
-+      error = fiemap_fill_next_extent(fieinfo, logical, physical,
-+                                      length, flags, inode->i_sb->s_dev);
-+      if (error < 0)
-+              return error;
-+      if (error == 1)
-+              return EXT_BREAK;
-+
-+      return EXT_CONTINUE;
-+}
-+
-+int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
-+              __u64 start, __u64 len)
-+{
-+      ext4_fsblk_t start_blk;
-+      ext4_fsblk_t len_blks;
-+      int error = 0;
-+
-+      if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
-+              return -EOPNOTSUPP;
-+
-+      if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS_COMPAT))
-+              return -EBADR;
-+
-+      start_blk = start >> inode->i_sb->s_blocksize_bits;
-+      len_blks = (len + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
-+
-+      /*
-+       * Walk the extent tree gathering extent information.
-+       * ext4_ext_fiemap_cb will push extents back to user.
-+       */
-+      down_write(&EXT4_I(inode)->i_data_sem);
-+      error = ext4_ext_walk_space(inode, start_blk, len_blks,
-+                                ext4_ext_fiemap_cb, fieinfo);
-+      up_write(&EXT4_I(inode)->i_data_sem);
-+
-+      return error;
-+}
-Index: linux-2.6.27.21-0.1/fs/ext4/fiemap.h
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.27.21-0.1/fs/ext4/fiemap.h       2009-07-07 14:38:12.000000000 +0530
-@@ -0,0 +1,85 @@
-+/*
-+ * FIEMAP ioctl infrastructure.
-+ *
-+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-+ *
-+ * Author: Kalpak Shah <kalpak.shah@sun.com>
-+ *     Andreas Dilger <adilger@sun.com>
-+ */
-+
-+#ifndef _LINUX_EXT4_FIEMAP_H
-+#define _LINUX_EXT4_FIEMAP_H
-+
-+struct fiemap_extent {
-+      __u64 fe_logical;  /* logical offset in bytes for the start of
-+                          * the extent from the beginning of the file */
-+      __u64 fe_physical; /* physical offset in bytes for the start
-+                          * of the extent from the beginning of the disk */
-+      __u64 fe_length;   /* length in bytes for this extent */
-+      __u64 fe_reserved64[2];
-+      __u32 fe_flags;    /* FIEMAP_EXTENT_* flags for this extent */
-+      __u32 fe_device;   /* device number for this extent */
-+      __u32 fe_reserved[2];
-+};
-+
-+struct fiemap {
-+      __u64 fm_start;  /* logical offset (inclusive) at
-+                               * which to start mapping (in) */
-+      __u64 fm_length;        /* logical length of mapping which
-+                               * userspace wants (in) */
-+      __u32 fm_flags;  /* FIEMAP_FLAG_* flags for request (in/out) */
-+      __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
-+      __u32 fm_extent_count;  /* size of fm_extents array (in) */
-+      __u32 fm_reserved;
-+      struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
-+};
-+
-+/*
-+ * FIEMAP helper definition.
-+ */
-+struct fiemap_extent_info {
-+      unsigned int    fi_flags;               /* Flags as passed from user */
-+      unsigned int    fi_extents_mapped;      /* Number of mapped extents */
-+      unsigned int    fi_extents_max;         /* Size of fiemap_extent array*/
-+      struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent array */
-+};
-+
-+int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
-+int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
-+                          u64 phys, u64 len, u32 flags, u32 lun);
-+
-+#define       FIEMAP_MAX_OFFSET       (~0ULL)
-+
-+#define       FIEMAP_FLAG_SYNC        0x00000001 /* sync file data before map */
-+#define       FIEMAP_FLAG_XATTR       0x00000002 /* map extended attribute tree */
-+
-+/* ldiskfs only supports FLAG_SYNC flag currently */
-+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
-+
-+#define FIEMAP_EXTENT_LAST            0x00000001 /* Last extent in file. */
-+#define FIEMAP_EXTENT_UNKNOWN         0x00000002 /* Data location unknown. */
-+#define FIEMAP_EXTENT_DELALLOC                0x00000004 /* Location still pending.
-+                                                  * Sets EXTENT_UNKNOWN. */
-+#define FIEMAP_EXTENT_ENCODED         0x00000008 /* Data can not be read
-+                                                  * while fs is unmounted */
-+#define FIEMAP_EXTENT_DATA_ENCRYPTED  0x00000080 /* Data is encrypted by fs.
-+                                                  * Sets EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_NOT_ALIGNED     0x00000100 /* Extent offsets may not be
-+                                                  * block aligned. */
-+#define FIEMAP_EXTENT_DATA_INLINE     0x00000200 /* Data mixed with metadata.
-+                                                  * Sets EXTENT_NOT_ALIGNED.*/
-+#define FIEMAP_EXTENT_DATA_TAIL               0x00000400 /* Multiple files in block.
-+                                                  * Sets EXTENT_NOT_ALIGNED.*/
-+#define FIEMAP_EXTENT_UNWRITTEN               0x00000800 /* Space allocated, but
-+                                                  * no data (i.e. zero). */
-+#define FIEMAP_EXTENT_MERGED          0x00001000 /* File does not natively
-+                                                  * support extents. Result
-+                                                  * merged for efficiency. */
-+
-+/* Lustre specific flags - use a high bit, don't conflict with upstream flag */
-+#define FIEMAP_EXTENT_NO_DIRECT               0x40000000 /* Data mapping undefined */
-+#define FIEMAP_EXTENT_NET             0x80000000 /* Data stored remotely.
-+                                                  * Sets NO_DIRECT flag */
-+
-+#endif /* _LINUX_EXT4_FIEMAP_H */
-+
diff --git a/ldiskfs/kernel_patches/patches/ext4-lookup-dotdot-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-lookup-dotdot-sles11.patch
deleted file mode 100644 (file)
index af019fa..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-Index: linux-2.6.18.i386/fs/ext4/iopen.c
-===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/iopen.c
-+++ linux-2.6.18.i386/fs/ext4/iopen.c
-@@ -91,9 +91,12 @@ static struct dentry *iopen_lookup(struc
-               assert(!(alternate->d_flags & DCACHE_DISCONNECTED));
-       }
--      if (!list_empty(&inode->i_dentry)) {
--              alternate = list_entry(inode->i_dentry.next,
--                                     struct dentry, d_alias);
-+      list_for_each(lp, &inode->i_dentry) {
-+              alternate = list_entry(lp, struct dentry, d_alias);
-+              /* ignore dentries created for ".." to preserve
-+               * proper dcache hierarchy -- bug 10458 */
-+              if (alternate->d_flags & DCACHE_NFSFS_RENAMED)
-+                      continue;
-               dget_locked(alternate);
-               spin_lock(&alternate->d_lock);
-               alternate->d_flags |= DCACHE_REFERENCED;
-Index: linux-2.6.18.i386/fs/ext4/namei.c
-===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/namei.c
-+++ linux-2.6.18.i386/fs/ext4/namei.c
-@@ -1067,6 +1067,38 @@ static struct dentry *ext4_lookup(struct
-                       return ERR_CAST(inode);
-       }
-+      /* ".." shouldn't go into dcache to preserve dcache hierarchy
-+       * otherwise we'll get parent being a child of actual child.
-+       * see bug 10458 for details -bzzz */
-+      if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 ||
-+              (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) {
-+              struct dentry *tmp, *goal = NULL;
-+              struct list_head *lp;
-+
-+              /* first, look for an existing dentry - any one is good */
-+              spin_lock(&dcache_lock);
-+              list_for_each(lp, &inode->i_dentry) {
-+                      tmp = list_entry(lp, struct dentry, d_alias);
-+                      goal = tmp;
-+                      dget_locked(goal);
-+                      break;
-+              }
-+              if (goal == NULL) {
-+                      /* there is no alias, we need to make current dentry:
-+                       *  a) inaccessible for __d_lookup()
-+                       *  b) inaccessible for iopen */
-+                      J_ASSERT(list_empty(&dentry->d_alias));
-+                      dentry->d_flags |= DCACHE_NFSFS_RENAMED;
-+                      /* this is d_instantiate() ... */
-+                      list_add(&dentry->d_alias, &inode->i_dentry);
-+                      dentry->d_inode = inode;
-+              }
-+              spin_unlock(&dcache_lock);
-+              if (goal)
-+                      iput(inode);
-+              return goal;
-+      }
-+
-       return iopen_connect_dentry(dentry, inode, 1);
- }
diff --git a/ldiskfs/kernel_patches/patches/ext4-map_inode_page-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-map_inode_page-sles11.patch
deleted file mode 100644 (file)
index 4ed87f0..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-Index: linux-2.6.18.i386/fs/ext4/inode.c
-===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/inode.c
-+++ linux-2.6.18.i386/fs/ext4/inode.c
-@@ -3666,3 +3666,66 @@ out_unlock:
-       unlock_page(page);
-       return ret;
- }
-+
-+int ext4_map_inode_page(struct inode *inode, struct page *page,
-+                      unsigned long *blocks, int *created, int create)
-+{
-+      unsigned int blocksize, blocks_per_page;
-+      unsigned long iblock;
-+      struct buffer_head dummy;
-+      void *handle;
-+      int i, rc = 0, failed = 0, needed_blocks;
-+
-+      blocksize = inode->i_sb->s_blocksize;
-+      blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
-+      iblock = page->index * blocks_per_page;
-+
-+      for (i = 0; i < blocks_per_page; i++, iblock++) {
-+              blocks[i] = ext4_bmap(inode->i_mapping, iblock);
-+              if (blocks[i] == 0) {
-+                      failed++;
-+                      if (created)
-+                              created[i] = -1;
-+              } else if (created) {
-+                      created[i] = 0;
-+              }
-+      }
-+
-+      if (failed == 0 || create == 0)
-+              return 0;
-+
-+      needed_blocks = ext4_writepage_trans_blocks(inode);
-+      handle = ext4_journal_start(inode, needed_blocks);
-+      if (IS_ERR(handle))
-+              return PTR_ERR(handle);
-+
-+      iblock = page->index * blocks_per_page;
-+      for (i = 0; i < blocks_per_page; i++, iblock++) {
-+              if (blocks[i] != 0)
-+                      continue;
-+
-+              rc = ext4_get_blocks_handle(handle, inode, iblock, 1, &dummy, 1, 1);
-+              if (rc < 0) {
-+                      printk(KERN_INFO "ext4_map_inode_page: error reading "
-+                                      "block %ld\n", iblock);
-+                      goto out;
-+              } else {
-+                      if (rc > 1)
-+                              WARN_ON(1);
-+                      rc = 0;
-+              }
-+              /* Unmap any metadata buffers from the block mapping, to avoid
-+               * data corruption due to direct-write from Lustre being
-+               * clobbered by a later flush of the blockdev metadata buffer.*/
-+              if (buffer_new(&dummy))
-+                      unmap_underlying_metadata(dummy.b_bdev,
-+                                      dummy.b_blocknr);
-+              blocks[i] = dummy.b_blocknr;
-+              if (created)
-+                      created[i] = 1;
-+      }
-+
-+out:
-+      ext4_journal_stop(handle);
-+      return rc;
-+}
-Index: linux-2.6.18.i386/fs/ext4/super.c
-===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/super.c
-+++ linux-2.6.18.i386/fs/ext4/super.c
-@@ -3498,6 +3498,10 @@ static void __exit exit_ext4_fs(void)
-       __free_page(ext4_zero_page);
- }
-+int ext4_map_inode_page(struct inode *inode, struct page *page,
-+                      unsigned long *blocks, int *created, int create);
-+EXPORT_SYMBOL(ext4_map_inode_page);
-+
- MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
- MODULE_DESCRIPTION("Fourth Extended Filesystem with extents");
- MODULE_LICENSE("GPL");
diff --git a/ldiskfs/kernel_patches/patches/ext4-max-dir-size-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-max-dir-size-sles11.patch
deleted file mode 100644 (file)
index fb7cb5a..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-Index: linux-2.6.27.21-0.1/fs/ext4/ialloc.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ialloc.c  2009-07-07 14:35:55.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ialloc.c       2009-07-07 14:38:17.000000000 +0530
-@@ -700,12 +700,15 @@
-               return ERR_PTR(-EPERM);
-       sb = dir->i_sb;
-+      sbi = EXT4_SB(sb);
-+      if (sbi->s_max_dir_size > 0 && i_size_read(dir) >= sbi->s_max_dir_size)
-+              return ERR_PTR(-EFBIG);
-+
-       inode = new_inode(sb);
-       if (!inode)
-               return ERR_PTR(-ENOMEM);
-       ei = EXT4_I(inode);
--      sbi = EXT4_SB(sb);
-       es = sbi->s_es;
-       if (goal && goal < le32_to_cpu(es->s_inodes_count)) {
-Index: linux-2.6.27.21-0.1/fs/ext4/super.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/super.c   2009-07-07 14:38:06.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/super.c        2009-07-07 14:38:41.000000000 +0530
-@@ -41,6 +41,7 @@
- #include <asm/uaccess.h>
- #include <linux/kthread.h>
- #include <linux/utsname.h>
-+#include <linux/proc_fs.h>
- #include "ext4.h"
- #include "ext4_jbd2.h"
-@@ -71,6 +72,8 @@
- static void ext4_write_super_lockfs(struct super_block *sb);
-+struct proc_dir_entry *proc_root_ext4;
-+
- ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
-                              struct ext4_group_desc *bg)
- {
-@@ -603,6 +606,7 @@
-       }
-       if (sbi->s_mmp_tsk)
-               kthread_stop(sbi->s_mmp_tsk);
-+
-       sb->s_fs_info = NULL;
-       kfree(sbi);
-       return;
-@@ -2283,6 +2287,46 @@
-       return 0;
- }
-+static int ext4_max_dir_size_read(char *page, char **start, off_t off,
-+                                  int count, int *eof, void *data)
-+{
-+      struct ext4_sb_info *sbi = data;
-+      int len;
-+
-+      *eof = 1;
-+      if (off != 0)
-+              return 0;
-+
-+      len = sprintf(page, "%lu\n", sbi->s_max_dir_size);
-+      *start = page;
-+      return len;
-+}
-+
-+static int ext4_max_dir_size_write(struct file *file, const char *buffer,
-+                                   unsigned long count, void *data)
-+{
-+      struct ext4_sb_info *sbi = data;
-+      char str[32];
-+      unsigned long value;
-+      char *end;
-+
-+      if (count >= sizeof(str)) {
-+              printk(KERN_ERR "EXT4-fs: %s string too long, max %u bytes\n",
-+                     EXT4_MAX_DIR_SIZE_NAME, (int)sizeof(str));
-+              return -EOVERFLOW;
-+      }
-+
-+      if (copy_from_user(str, buffer, count))
-+              return -EFAULT;
-+
-+      value = simple_strtol(str, &end, 0);
-+      if (value < 0)
-+              return -ERANGE;
-+
-+      sbi->s_max_dir_size = value;
-+      return count;
-+}
-+
- static int ext4_fill_super(struct super_block *sb, void *data, int silent)
-                               __releases(kernel_lock)
-                               __acquires(kernel_lock)
-@@ -2307,6 +2351,7 @@
-       int needs_recovery, has_huge_files;
-       int features;
-       __u64 blocks_count;
-+      struct proc_dir_entry *proc;
-       int err;
-       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
-@@ -2880,6 +2925,22 @@
-              test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA ? "ordered":
-              "writeback");
-+      sbi->s_max_dir_size = EXT4_DEFAULT_MAX_DIR_SIZE;
-+      proc = create_proc_entry(EXT4_MAX_DIR_SIZE_NAME,
-+                               S_IFREG | S_IRUGO | S_IWUSR, sbi->s_proc);
-+      if (proc == NULL) {
-+              printk(KERN_ERR "EXT4-fs: unable to create %s\n",
-+                     EXT4_MAX_DIR_SIZE_NAME);
-+              remove_proc_entry(EXT4_MAX_DIR_SIZE_NAME, sbi->s_proc);
-+              remove_proc_entry(sbi->s_proc->name, proc_root_ext4);
-+              sbi->s_proc = NULL;
-+              ret = -ENOMEM;
-+              goto failed_mount4;
-+      }
-+      proc->data = sbi;
-+      proc->read_proc = ext4_max_dir_size_read;
-+      proc->write_proc = ext4_max_dir_size_write;
-+
-       lock_kernel();
-       return 0;
-@@ -2906,6 +2967,7 @@
- failed_mount:
-       if (sbi->s_proc) {
-               remove_proc_entry("inode_readahead_blks", sbi->s_proc);
-+              remove_proc_entry(EXT4_MAX_DIR_SIZE_NAME, sbi->s_proc);
-               remove_proc_entry("inode_goal", sbi->s_proc);
-               remove_proc_entry(sb->s_id, ext4_proc_root);
-       }
-@@ -3254,7 +3316,6 @@
-       }
- }
--
- /*
-  * Have we just finished recovery?  If so, and if we are mounting (or
-  * remounting) the filesystem readonly, then we will end up with a
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_sb.h 2009-07-07 14:36:58.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h      2009-07-07 14:38:17.000000000 +0530
-@@ -119,6 +119,7 @@
-       /* where last allocation was done - for stream allocation */
-       unsigned long s_mb_last_group;
-       unsigned long s_mb_last_start;
-+      unsigned long s_max_dir_size;
-       /* history to debug policy */
-       struct ext4_mb_history *s_mb_history;
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h    2009-07-07 14:38:12.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4.h 2009-07-07 14:38:17.000000000 +0530
-@@ -1017,6 +1017,14 @@
-  */
- #define EXT4_MMP_MIN_CHECK_INTERVAL   5
-+extern struct proc_dir_entry *proc_root_ext4;
-+
-+/*
-+ * max directory size tunable
-+ */
-+#define EXT4_DEFAULT_MAX_DIR_SIZE     0
-+#define EXT4_MAX_DIR_SIZE_NAME                "max_dir_size"
-+
- /*
-  * Function prototypes
-  */
-Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c 2009-07-07 14:08:21.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c      2009-07-07 14:38:17.000000000 +0530
-@@ -2943,6 +2943,7 @@
-       remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
-       remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
-       remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_proc);
-+      remove_proc_entry(EXT4_MAX_DIR_SIZE_NAME, sbi->s_proc);
-       return -ENOMEM;
- #else
-       return 0;
-@@ -2963,6 +2964,7 @@
-       remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
-       remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
-       remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_proc);
-+      remove_proc_entry(EXT4_MAX_DIR_SIZE_NAME, sbi->s_proc);
- #endif
-       return 0;
- }
diff --git a/ldiskfs/kernel_patches/patches/ext4-misc-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-misc-sles11.patch
deleted file mode 100644 (file)
index 09f42d8..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_jbd2.h       2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.h    2009-07-07 14:47:22.000000000 +0530
-@@ -35,6 +35,9 @@
-       (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
-               || test_opt(sb, EXTENTS) ? 27U : 8U)
-+/* Indicate that EXT4_SINGLEDATA_TRANS_BLOCKS takes the sb as argument */
-+#define EXT4_SINGLEDATA_TRANS_BLOCKS_HAS_SB
-+
- /* 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.27.21-0.1/fs/ext4/extents.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/extents.c 2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/extents.c      2009-07-07 14:48:03.000000000 +0530
-@@ -48,7 +48,7 @@
-  * ext_pblock:
-  * combine low and high parts of physical block number into ext4_fsblk_t
-  */
--static ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
-+ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
- {
-       ext4_fsblk_t block;
-@@ -58,6 +58,17 @@
- }
- /*
-+ * ext4_ext_store_pblock:
-+ * stores a large physical block number into an extent struct,
-+ * breaking it into parts
-+ */
-+void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
-+{
-+      ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
-+      ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
-+}
-+
-+/*
-  * idx_pblock:
-  * combine low and high parts of a leaf physical block number into ext4_fsblk_t
-  */
-@@ -71,17 +82,6 @@
- }
- /*
-- * ext4_ext_store_pblock:
-- * stores a large physical block number into an extent struct,
-- * breaking it into parts
-- */
--void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
--{
--      ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
--      ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
--}
--
--/*
-  * ext4_idx_store_pblock:
-  * stores a large physical block number into an index struct,
-  * breaking it into parts
-@@ -1852,6 +1852,56 @@
- }
- /*
-+ * This routine returns max. credits extent tree can consume.
-+ * It should be OK for low-performance paths like ->writepage()
-+ * To allow many writing process to fit a single transaction,
-+ * caller should calculate credits under truncate_mutex and
-+ * pass actual path.
-+ */
-+int ext4_ext_calc_credits_for_insert(struct inode *inode,
-+                                  struct ext4_ext_path *path)
-+{
-+      int depth, needed;
-+
-+      if (path) {
-+              /* probably there is space in leaf? */
-+              depth = ext_depth(inode);
-+              if (le16_to_cpu(path[depth].p_hdr->eh_entries)
-+                              < le16_to_cpu(path[depth].p_hdr->eh_max))
-+                      return 1;
-+      }
-+
-+      /*
-+       * given 32bit logical block (4294967296 blocks), max. tree
-+       * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
-+       * let's also add one more level for imbalance.
-+       */
-+      depth = 5;
-+
-+      /* allocation of new data block(s) */
-+      needed = 2;
-+
-+      /*
-+       * tree can be full, so it'd need to grow in depth:
-+       * we need one credit to modify old root, credits for
-+       * new root will be added in split accounting
-+       */
-+      needed += 1;
-+
-+      /*
-+       * Index split can happen, we'd need:
-+       *    allocate intermediate indexes (bitmap + group)
-+       *  + change two blocks at each level, but root (already included)
-+       */
-+      needed += (depth * 2) + (depth * 2);
-+
-+      /* any allocation modifies superblock */
-+      needed += 1;
-+
-+      return needed;
-+}
-+
-+/*
-  * ext4_ext_calc_credits_for_single_extent:
-  * This routine returns max. credits that needed to insert an extent
-  * to the extent tree.
-@@ -3171,3 +3221,15 @@
-       return error;
- }
-+
-+EXPORT_SYMBOL(ext4_ext_store_pblock);
-+EXPORT_SYMBOL(ext4_ext_search_right);
-+EXPORT_SYMBOL(ext4_ext_search_left);
-+EXPORT_SYMBOL(ext_pblock);
-+EXPORT_SYMBOL(ext4_ext_insert_extent);
-+EXPORT_SYMBOL(ext4_mb_new_blocks);
-+EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
-+EXPORT_SYMBOL(ext4_mark_inode_dirty);
-+EXPORT_SYMBOL(ext4_ext_find_extent);
-+EXPORT_SYMBOL(ext4_ext_drop_refs);
-+
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_extents.h    2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h 2009-07-07 14:47:22.000000000 +0530
-@@ -59,6 +59,11 @@
-  */
- #define EXT_STATS_
-+/*
-+ * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
-+ * are now accounted in ext4_ext_calc_credits_for_insert()
-+ */
-+#define EXT4_ALLOC_NEEDED 0
- /*
-  * ext4_inode has i_block array (60 bytes total).
-@@ -124,6 +129,7 @@
- #define EXT4_EXT_CACHE_GAP    1
- #define EXT4_EXT_CACHE_EXTENT 2
-+#define EXT4_EXT_HAS_NO_TREE  /* ext4_extents_tree struct is not used*/
- #define EXT_MAX_BLOCK 0xffffffff
-@@ -223,10 +229,14 @@
-               (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
- }
-+extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex);
-+extern void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb);
- extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
- 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 *);
-+extern int ext4_ext_calc_credits_for_insert(struct inode *,
-+                                          struct ext4_ext_path *);
- extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
-                                                  int num,
-                                                  struct ext4_ext_path *path);
-Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c 2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c      2009-07-07 14:47:22.000000000 +0530
-@@ -4355,6 +4355,7 @@
-               kmem_cache_free(ext4_ac_cachep, ac);
- }
-+EXPORT_SYMBOL(ext4_discard_preallocations);
- /*
-  * finds all preallocated spaces and return blocks being freed to them
-  * if preallocated space becomes full (no block is used from the space)
-@@ -5177,3 +5184,6 @@
-               kmem_cache_free(ext4_ac_cachep, ac);
-       return;
- }
-+
-+EXPORT_SYMBOL(ext4_free_blocks);
-+
-Index: linux-2.6.27.21-0.1/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_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
-               (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)
-@@ -1286,6 +1287,7 @@
-       Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
-       Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
-       Opt_grpquota, Opt_extents, Opt_noextents, Opt_i_version,
-+      Opt_mballoc,
-       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
-       Opt_inode_readahead_blks, Opt_bigendian_extents,
-       Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
-@@ -1346,6 +1348,7 @@
-       {Opt_i_version, "i_version"},
-       {Opt_stripe, "stripe=%u"},
-       {Opt_resize, "resize"},
-+      {Opt_mballoc, "mballoc"},
-       {Opt_delalloc, "delalloc"},
-       {Opt_nodelalloc, "nodelalloc"},
-       {Opt_inode_readahead_blks, "inode_readahead_blks=%u"},
-@@ -1768,6 +1771,8 @@
-               case Opt_bigendian_extents:
-                       bigendian_extents = 1;
-                       break;
-+              case Opt_mballoc:
-+                      break;
-               default:
-                       printk(KERN_ERR
-                              "EXT4-fs: Unrecognized mount option \"%s\" "
-@@ -4094,7 +4099,7 @@
-       .kill_sb        = kill_block_super,
-       .fs_flags       = FS_REQUIRES_DEV,
- };
--MODULE_ALIAS("ext4dev");
-+MODULE_ALIAS("ext4");
- static int __init init_ext4_fs(void)
- {
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_jbd2.c       2009-07-07 14:47:19.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_jbd2.c    2009-07-07 14:47:22.000000000 +0530
-@@ -21,6 +21,7 @@
-               ext4_journal_abort_handle(where, __func__, bh, handle, err);
-       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 @@
-               ext4_journal_abort_handle(where, __func__, bh, handle, err);
-       return err;
- }
-+EXPORT_SYMBOL(__ext4_journal_dirty_metadata);
-Index: linux-2.6.27.21-0.1/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
-@@ -26,6 +26,9 @@
-  * The fourth extended filesystem constants/structures
-  */
-+/* Has been moved to linux/magic.h but we need it for Lustre */
-+#define EXT4_SUPER_MAGIC      0xEF53
-+
- /*
-  * Define EXT4FS_DEBUG to produce debug messages
-  */
-@@ -400,6 +403,8 @@
-       __le32  i_version_hi;   /* high 32 bits for 64-bit version */
- };
-+/* SLES11 kernel already has 64-bit inode->i_version field */
-+#define HAVE_DISK_INODE_VERSION
- #define EXT4_EPOCH_BITS 2
- #define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
-@@ -1123,6 +1128,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);
-+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-2.6.27.21-0.1/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 @@
-       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,
diff --git a/ldiskfs/kernel_patches/patches/ext4-prealloc-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-prealloc-sles11.patch
deleted file mode 100644 (file)
index 16a3c59..0000000
+++ /dev/null
@@ -1,378 +0,0 @@
-Index: linux-2.6.18-128.1.6/fs/ext4/super.c
-===================================================================
---- linux-2.6.18-128.1.6.orig/fs/ext4/super.c
-+++ linux-2.6.18-128.1.6/fs/ext4/super.c
-@@ -108,7 +108,8 @@
- EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
- EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
- EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
--EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
-+EXT4_RW_ATTR_SBI_UI(mb_small_req, s_mb_small_req);
-+EXT4_RW_ATTR_SBI_UI(mb_large_req, s_mb_large_req);
- EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
- EXT4_RW_ATTR_SBI_UI(max_dir_size, s_max_dir_size);
-@@ -108,7 +108,8 @@
-       ATTR_LIST(mb_max_to_scan),
-       ATTR_LIST(mb_min_to_scan),
-       ATTR_LIST(mb_order2_req),
--      ATTR_LIST(mb_stream_req),
-+      ATTR_LIST(mb_small_req),
-+      ATTR_LIST(mb_large_req),
-       ATTR_LIST(mb_group_prealloc),
-       ATTR_LIST(max_dir_size),
-       NULL,
-Index: linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_sb.h 2009-05-28 11:13:24.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h      2009-05-28 11:16:48.000000000 +0530
-@@ -109,11 +109,14 @@
-       /* tunables */
-       unsigned long s_stripe;
--      unsigned int s_mb_stream_request;
-+      unsigned long s_mb_small_req;
-+      unsigned long s_mb_large_req;
-       unsigned int s_mb_max_to_scan;
-       unsigned int s_mb_min_to_scan;
-       unsigned int s_mb_stats;
-       unsigned int s_mb_order2_reqs;
-+      unsigned long *s_mb_prealloc_table;
-+      unsigned long s_mb_prealloc_table_size;
-       unsigned int s_mb_group_prealloc;
-       /* where last allocation was done - for stream allocation */
-       unsigned long s_mb_last_group;
-Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c 2009-05-28 11:12:43.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c      2009-05-28 11:18:09.000000000 +0530
-@@ -2686,6 +2686,26 @@
-       return -ENOMEM;
- }
-+static void ext4_mb_prealloc_table_add(struct ext4_sb_info *sbi, int value)
-+{
-+      int i;
-+
-+      if (value > (sbi->s_blocks_per_group - 1 - 1 - sbi->s_itb_per_group))
-+              return;
-+
-+      for (i = 0; i < sbi->s_mb_prealloc_table_size; i++) {
-+              if (sbi->s_mb_prealloc_table[i] == 0) {
-+                      sbi->s_mb_prealloc_table[i] = value;
-+                      return;
-+              }
-+
-+              /* they should add values in order */
-+              if (value <= sbi->s_mb_prealloc_table[i])
-+                      return;
-+      }
-+}
-+
-+
- static int ext4_mb_good_group(struct ext4_allocation_context *ac,
-                               ext4_group_t group, int cr)
- {
-@@ -2325,6 +2389,80 @@
-       .llseek         = seq_lseek,
-       .release        = seq_release,
- };
-+
-+#define EXT4_MB_PREALLOC_TABLE          "prealloc_table"
-+
-+static int ext4_mb_prealloc_table_proc_read(char *page, char **start, off_t off,
-+                                          int count, int *eof, void *data)
-+{
-+      struct ext4_sb_info *sbi = data;
-+      int len = 0;
-+      int i;
-+
-+      *eof = 1;
-+      if (off != 0)
-+              return 0;
-+
-+      for (i = 0; i < sbi->s_mb_prealloc_table_size; i++)
-+              len += sprintf(page + len, "%ld ",
-+                             sbi->s_mb_prealloc_table[i]);
-+      len += sprintf(page + len, "\n");
-+
-+      *start = page;
-+      return len;
-+}
-+
-+static int ext4_mb_prealloc_table_proc_write(struct file *file,
-+                                           const char __user *buf,
-+                                           unsigned long cnt, void *data)
-+{
-+      struct ext4_sb_info *sbi = data;
-+      unsigned long value;
-+      unsigned long prev = 0;
-+      char str[128];
-+      char *cur;
-+      char *end;
-+      unsigned long *new_table;
-+      int num = 0;
-+      int i = 0;
-+
-+      if (cnt >= sizeof(str))
-+              return -EINVAL;
-+      if (copy_from_user(str, buf, cnt))
-+              return -EFAULT;
-+
-+      num = 0;
-+      cur = str;
-+      end = str + cnt;
-+      while (cur < end) {
-+              while ((cur < end) && (*cur == ' ')) cur++;
-+              value = simple_strtol(cur, &cur, 0);
-+              if (value == 0)
-+                      break;
-+              if (value <= prev)
-+                      return -EINVAL;
-+              prev = value;
-+              num++;
-+      }
-+
-+      new_table = kmalloc(num * sizeof(*new_table), GFP_KERNEL);
-+      if (new_table == NULL)
-+              return -ENOMEM;
-+      kfree(sbi->s_mb_prealloc_table);
-+      memset(new_table, 0, num * sizeof(*new_table));
-+      sbi->s_mb_prealloc_table = new_table;
-+      sbi->s_mb_prealloc_table_size = num;
-+      cur = str;
-+      end = str + cnt;
-+      while (cur < end && i < num) {
-+      while ((cur < end) && (*cur == ' ')) cur++;
-+              value = simple_strtol(cur, &cur, 0);
-+              ext4_mb_prealloc_table_add(sbi, value);
-+              i++;
-+      }
-+
-+      return cnt;
-+}
- static void ext4_mb_history_release(struct super_block *sb)
- {
-@@ -2400,6 +2400,7 @@
-               remove_proc_entry("mb_groups", sbi->s_proc);
-               if (sbi->s_mb_history_max)
-                       remove_proc_entry("mb_history", sbi->s_proc);
-+              remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc);
-       }
-       kfree(sbi->s_mb_history);
- }
-@@ -2408,6 +2446,13 @@
-                       p->proc_fops = &ext4_mb_seq_groups_fops;
-                       p->data = sb;
-               }
-+              p = create_proc_entry(EXT4_MB_PREALLOC_TABLE, S_IFREG |
-+                                    S_IRUGO | S_IWUSR, sbi->s_proc);
-+              if (p) {
-+                      p->data = sbi;
-+                      p->read_proc = ext4_mb_prealloc_table_proc_read;
-+                      p->write_proc = ext4_mb_prealloc_table_proc_write;
-+              }
-       }
-
-       sbi->s_mb_history_cur = 0;
-@@ -2542,13 +2562,57 @@
-       sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
-       sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
-       sbi->s_mb_stats = MB_DEFAULT_STATS;
--      sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
-       sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
-       sbi->s_mb_history_filter = EXT4_MB_HISTORY_DEFAULT;
--      sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC;
-+
-+      if (sbi->s_stripe == 0) {
-+              sbi->s_mb_prealloc_table_size = 10;
-+              i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
-+              sbi->s_mb_prealloc_table = kmalloc(i, GFP_NOFS);
-+              if (sbi->s_mb_prealloc_table == NULL) {
-+                              kfree(sbi->s_mb_offsets);
-+                              kfree(sbi->s_mb_maxs);
-+                              return -ENOMEM;
-+              }
-+              memset(sbi->s_mb_prealloc_table, 0, i);
-+
-+              ext4_mb_prealloc_table_add(sbi, 4);
-+              ext4_mb_prealloc_table_add(sbi, 8);
-+              ext4_mb_prealloc_table_add(sbi, 16);
-+              ext4_mb_prealloc_table_add(sbi, 32);
-+              ext4_mb_prealloc_table_add(sbi, 64);
-+              ext4_mb_prealloc_table_add(sbi, 128);
-+              ext4_mb_prealloc_table_add(sbi, 256);
-+              ext4_mb_prealloc_table_add(sbi, 512);
-+              ext4_mb_prealloc_table_add(sbi, 1024);
-+              ext4_mb_prealloc_table_add(sbi, 2048);
-+
-+              sbi->s_mb_small_req = 256;
-+              sbi->s_mb_large_req = 1024;
-+              sbi->s_mb_group_prealloc = 512;
-+      } else {
-+              sbi->s_mb_prealloc_table_size = 3;
-+              i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
-+              sbi->s_mb_prealloc_table = kmalloc(i, GFP_NOFS);
-+              if (sbi->s_mb_prealloc_table == NULL) {
-+                      kfree(sbi->s_mb_offsets);
-+                      kfree(sbi->s_mb_maxs);
-+                      return -ENOMEM;
-+              }
-+              memset(sbi->s_mb_prealloc_table, 0, i);
-+
-+              ext4_mb_prealloc_table_add(sbi, sbi->s_stripe);
-+              ext4_mb_prealloc_table_add(sbi, sbi->s_stripe * 2);
-+              ext4_mb_prealloc_table_add(sbi, sbi->s_stripe * 4);
-+
-+              sbi->s_mb_small_req = sbi->s_stripe;
-+              sbi->s_mb_large_req = sbi->s_stripe * 8;
-+              sbi->s_mb_group_prealloc = sbi->s_stripe * 4;
-+      }
-       sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group);
-       if (sbi->s_locality_groups == NULL) {
-+              kfree(sbi->s_mb_prealloc_table);
-               kfree(sbi->s_mb_offsets);
-               kfree(sbi->s_mb_maxs);
-               return -ENOMEM;
-@@ -3032,11 +3186,12 @@
- ext4_mb_normalize_request(struct ext4_allocation_context *ac,
-                               struct ext4_allocation_request *ar)
- {
--      int bsbits, max;
-+      int bsbits, i, wind;
-       ext4_lblk_t end;
--      loff_t size, orig_size, start_off;
-+      loff_t size, orig_size;
-       ext4_lblk_t start, orig_start;
-       struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
-+      struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
-       struct ext4_prealloc_space *pa;
-       /* do normalize only data requests, metadata requests
-@@ -3196,49 +3351,35 @@
-       size = size << bsbits;
-       if (size < i_size_read(ac->ac_inode))
-               size = i_size_read(ac->ac_inode);
-+      size = (size + ac->ac_sb->s_blocksize - 1) >> bsbits;
--      /* max size of free chunks */
--      max = 2 << bsbits;
-+      start = wind = 0;
--#define NRL_CHECK_SIZE(req, size, max, chunk_size)    \
--              (req <= (size) || max <= (chunk_size))
-+      /* let's choose preallocation window depending on file size */
-+      for (i = 0; i < sbi->s_mb_prealloc_table_size; i++) {
-+              if (size <= sbi->s_mb_prealloc_table[i]) {
-+                      wind = sbi->s_mb_prealloc_table[i];
-+                      break;
-+              }
-+      }
-+      size = wind;
--      /* first, try to predict filesize */
--      /* XXX: should this table be tunable? */
--      start_off = 0;
--      if (size <= 16 * 1024) {
--              size = 16 * 1024;
--      } else if (size <= 32 * 1024) {
--              size = 32 * 1024;
--      } else if (size <= 64 * 1024) {
--              size = 64 * 1024;
--      } else if (size <= 128 * 1024) {
--              size = 128 * 1024;
--      } else if (size <= 256 * 1024) {
--              size = 256 * 1024;
--      } else if (size <= 512 * 1024) {
--              size = 512 * 1024;
--      } else if (size <= 1024 * 1024) {
--              size = 1024 * 1024;
--      } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) {
--              start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
--                                              (21 - bsbits)) << 21;
--              size = 2 * 1024 * 1024;
--      } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) {
--              start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
--                                                      (22 - bsbits)) << 22;
--              size = 4 * 1024 * 1024;
--      } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len,
--                                      (8<<20)>>bsbits, max, 8 * 1024)) {
--              start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
--                                                      (23 - bsbits)) << 23;
--              size = 8 * 1024 * 1024;
--      } else {
--              start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits;
--              size      = ac->ac_o_ex.fe_len << bsbits;
-+      if (wind == 0) {
-+              __u64 tstart, tend;
-+              /* file is quite large, we now preallocate with
-+               * the biggest configured window with regart to
-+               * logical offset */
-+              wind = sbi->s_mb_prealloc_table[i - 1];
-+              tstart = ac->ac_o_ex.fe_logical;
-+              do_div(tstart, wind);
-+              start = tstart * wind;
-+              tend = ac->ac_o_ex.fe_logical + ac->ac_o_ex.fe_len - 1;
-+              do_div(tend, wind);
-+              tend = tend * wind + wind;
-+              size = tend - start;
-       }
--      orig_size = size = size >> bsbits;
--      orig_start = start = start_off >> bsbits;
-+      orig_size = size;
-+      orig_start = start;
-       /* don't cover already allocated blocks in selected range */
-       if (ar->pleft && start <= ar->lleft) {
-@@ -3185,7 +3326,6 @@
-       }
-       BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
-                       start > ac->ac_o_ex.fe_logical);
--      BUG_ON(size <= 0 || size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
-       /* now prepare goal request */
-@@ -4077,11 +4217,17 @@
-       /* don't use group allocation for large files */
-       size = max(size, isize);
--      if (size >= sbi->s_mb_stream_request) {
-+      if ((ac->ac_o_ex.fe_len >= sbi->s_mb_small_req) ||
-+          (size >= sbi->s_mb_large_req)) {
-               ac->ac_flags |= EXT4_MB_STREAM_ALLOC;
-               return;
-       }
-+      /* request is so large that we don't care about
-+       * streaming - it overweights any possible seek */
-+      if (ac->ac_o_ex.fe_len >= sbi->s_mb_large_req)
-+              return;
-+
-       BUG_ON(ac->ac_lg != NULL);
-       /*
-        * locality group prealloc space are per cpu. The reason for having
-Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
-===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c   2009-05-28 11:12:42.000000000 +0530
-+++ linux-2.6.27.21-0.1/fs/ext4/inode.c        2009-05-28 11:16:48.000000000 +0530
-@@ -2442,14 +2442,14 @@
-               return -EROFS;
-       /*
--       * Make sure nr_to_write is >= sbi->s_mb_stream_request
-+       * Make sure nr_to_write is >= sbi->s_mb_small_req
-        * This make sure small files blocks are allocated in
-        * single attempt. This ensure that small files
-        * get less fragmented.
-        */
--      if (wbc->nr_to_write < sbi->s_mb_stream_request) {
--              nr_to_writebump = sbi->s_mb_stream_request - wbc->nr_to_write;
--              wbc->nr_to_write = sbi->s_mb_stream_request;
-+      if (wbc->nr_to_write < sbi->s_mb_small_req) {
-+              nr_to_writebump = sbi->s_mb_small_req - wbc->nr_to_write;
-+              wbc->nr_to_write = sbi->s_mb_small_req;
-       }
-       if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
-               range_whole = 1;
diff --git a/ldiskfs/kernel_patches/patches/ext4-print-inum-in-htree-warning-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-print-inum-in-htree-warning-sles11.patch
deleted file mode 100644 (file)
index 1cc10a8..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Index: linux-2.6.18.i386/fs/ext4/namei.c
-===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/namei.c
-+++ linux-2.6.18.i386/fs/ext4/namei.c
-@@ -374,8 +374,8 @@ dx_probe(struct dentry *dentry, struct i
-           root->info.hash_version != DX_HASH_HALF_MD4 &&
-           root->info.hash_version != DX_HASH_LEGACY) {
-               ext4_warning(dir->i_sb, __func__,
--                           "Unrecognised inode hash code %d",
--                           root->info.hash_version);
-+                           "Unrecognised inode hash code %d for directory "
-+                           "#%lu", root->info.hash_version, dir->i_ino);
-               brelse(bh);
-               *err = ERR_BAD_DX_DIR;
-               goto fail;
index b431530..0b052da 100644 (file)
@@ -1,6 +1,6 @@
 diff -urpN linux-stage.orig/fs/ext4/balloc.c linux-stage/fs/ext4/balloc.c
---- linux-stage.orig/fs/ext4/balloc.c  2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/balloc.c       2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/balloc.c  2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/balloc.c       2012-02-16 08:05:47.000000000 -0500
 @@ -97,7 +97,7 @@ unsigned ext4_init_block_bitmap(struct s
                /* If checksum is bad mark all blocks used to prevent allocation
                 * essentially implementing a per-group read-only flag. */
@@ -79,18 +79,55 @@ diff -urpN linux-stage.orig/fs/ext4/balloc.c linux-stage/fs/ext4/balloc.c
                                   (ext4_fsblk_t)(block + i));
                        BUFFER_TRACE(bitmap_bh, "bit already cleared");
 diff -urpN linux-stage.orig/fs/ext4/dir.c linux-stage/fs/ext4/dir.c
---- linux-stage.orig/fs/ext4/dir.c     2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/dir.c  2011-12-28 11:24:07.000000000 -0500
-@@ -83,7 +83,7 @@ int ext4_check_dir_entry(const char *fun
+--- linux-stage.orig/fs/ext4/dir.c     2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/dir.c  2012-02-16 08:05:47.000000000 -0500
+@@ -70,28 +70,29 @@ int ext4_check_dir_entry(const char *fun
+       const int rlen = ext4_rec_len_from_disk(de->rec_len,
+                                               dir->i_sb->s_blocksize);
+-      if (rlen < EXT4_DIR_REC_LEN(1))
++      if (unlikely(rlen < EXT4_DIR_REC_LEN(1)))
+               error_msg = "rec_len is smaller than minimal";
+-      else if (rlen % 4 != 0)
++      else if (unlikely(rlen % 4 != 0))
+               error_msg = "rec_len % 4 != 0";
+-      else if (rlen < EXT4_DIR_REC_LEN(de->name_len))
++      else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len)))
+               error_msg = "rec_len is too small for name_len";
+-      else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
++      else if (unlikely(((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize))
+               error_msg = "directory entry across blocks";
+-      else if (le32_to_cpu(de->inode) >
+-                      le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))
++      else if (unlikely(le32_to_cpu(de->inode) >
++                      le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count)))
                error_msg = "inode out of bounds";
++      else
++              return 1;
  
-       if (error_msg != NULL)
+-      if (error_msg != NULL)
 -              ext4_error(dir->i_sb, function,
-+              ext4_error(dir->i_sb,
-                       "bad entry in directory #%lu: %s - block=%llu"
-                       "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d",
-                       dir->i_ino, error_msg,
-@@ -152,7 +152,7 @@ static int ext4_readdir(struct file *fil
+-                      "bad entry in directory #%lu: %s - block=%llu"
+-                      "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d",
+-                      dir->i_ino, error_msg,
+-                      (unsigned long long) bh->b_blocknr,
+-                      (unsigned) (offset%bh->b_size), offset,
+-                      le32_to_cpu(de->inode),
+-                      rlen, de->name_len);
+-      return error_msg == NULL ? 1 : 0;
++      ext4_error(dir->i_sb,
++              "bad entry in directory #%lu: %s - block=%llu"
++              "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d",
++              dir->i_ino, error_msg,
++              (unsigned long long) bh->b_blocknr,
++              (unsigned) (offset%bh->b_size), offset,
++              le32_to_cpu(de->inode),
++              rlen, de->name_len);
++      return 0;
+ }
+ static int ext4_readdir(struct file *filp,
+@@ -152,7 +153,7 @@ static int ext4_readdir(struct file *fil
                 */
                if (!bh) {
                        if (!dir_has_error) {
@@ -100,8 +137,8 @@ diff -urpN linux-stage.orig/fs/ext4/dir.c linux-stage/fs/ext4/dir.c
                                           inode->i_ino,
                                           (unsigned long long) filp->f_pos);
 diff -urpN linux-stage.orig/fs/ext4/ext4_extents.h linux-stage/fs/ext4/ext4_extents.h
---- linux-stage.orig/fs/ext4/ext4_extents.h    2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/ext4_extents.h 2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/ext4_extents.h    2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/ext4_extents.h 2012-02-16 08:05:47.000000000 -0500
 @@ -138,7 +138,7 @@ typedef int (*ext_prepare_callback)(stru
  #define EXT_REPEAT     2
  
@@ -112,8 +149,8 @@ diff -urpN linux-stage.orig/fs/ext4/ext4_extents.h linux-stage/fs/ext4/ext4_exte
  /*
   * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
 diff -urpN linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
---- linux-stage.orig/fs/ext4/ext4.h    2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/ext4.h 2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/ext4.h    2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/ext4.h 2012-02-16 08:06:56.000000000 -0500
 @@ -23,6 +23,7 @@
  #include <linux/quota.h>
  #include <linux/rwsem.h>
@@ -135,15 +172,49 @@ diff -urpN linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
  /* data type for block offset of block group */
  typedef int ext4_grpblk_t;
  
-@@ -1509,6 +1516,7 @@ extern struct buffer_head *ext4_read_ino
-                                                 ext4_group_t block_group);
+@@ -1110,6 +1117,9 @@ struct ext4_sb_info {
+       /* workqueue for dio unwritten */
+       struct workqueue_struct *dio_unwritten_wq;
++
++      /* Lazy inode table initialization info */
++      struct ext4_li_request *s_li_request;
+ };
+ static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
+@@ -1431,6 +1441,23 @@ void ext4_get_group_no_and_offset(struct
+ extern struct proc_dir_entry *ext4_proc_root;
+ /*
++ * Timeout and state flag for lazy initialization inode thread.
++ */
++#define EXT4_DEF_LI_WAIT_MULT                 10
++#define EXT4_DEF_LI_MAX_START_DELAY           5
++#define EXT4_LAZYINIT_QUIT                    0x0001
++#define EXT4_LAZYINIT_RUNNING                 0x0002
++
++/*
++ * Lazy inode table initialization info
++ */
++struct ext4_lazy_init {
++      unsigned long           li_state;
++      struct list_head        li_request_list;
++      struct mutex            li_list_mtx;
++};
++
++/*
+  * Function prototypes
+  */
+@@ -1509,6 +1536,7 @@ extern struct buffer_head *ext4_read_ino
+ extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
  
  /* mballoc.c */
 +struct fstrim_range;
  extern long ext4_mb_stats;
  extern long ext4_mb_max_to_scan;
  extern int ext4_mb_init(struct super_block *, int);
-@@ -1526,6 +1534,8 @@ extern int ext4_mb_add_groupinfo(struct 
+@@ -1526,6 +1554,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);
@@ -152,7 +223,7 @@ diff -urpN linux-stage.orig/fs/ext4/ext4.h linux-stage/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);
-@@ -1586,13 +1596,17 @@ extern int ext4_group_extend(struct supe
+@@ -1586,13 +1616,17 @@ extern int ext4_group_extend(struct supe
                                ext4_fsblk_t n_blocks_count);
  
  /* super.c */
@@ -173,8 +244,8 @@ diff -urpN linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
        __attribute__ ((format (printf, 3, 4)));
  extern void ext4_grp_locked_error(struct super_block *, ext4_group_t,
 diff -urpN linux-stage.orig/fs/ext4/ext4_jbd2.c linux-stage/fs/ext4/ext4_jbd2.c
---- linux-stage.orig/fs/ext4/ext4_jbd2.c       2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/ext4_jbd2.c    2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/ext4_jbd2.c       2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/ext4_jbd2.c    2012-02-16 08:05:47.000000000 -0500
 @@ -96,7 +96,7 @@ int __ext4_handle_dirty_metadata(const c
                if (inode && inode_needs_sync(inode)) {
                        sync_dirty_buffer(bh);
@@ -185,8 +256,8 @@ diff -urpN linux-stage.orig/fs/ext4/ext4_jbd2.c linux-stage/fs/ext4/ext4_jbd2.c
                                           "inode=%lu, block=%llu",
                                           inode->i_ino,
 diff -urpN linux-stage.orig/fs/ext4/extents.c linux-stage/fs/ext4/extents.c
---- linux-stage.orig/fs/ext4/extents.c 2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/extents.c      2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/extents.c 2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/extents.c      2012-02-16 08:05:47.000000000 -0500
 @@ -437,7 +437,7 @@ static int __ext4_ext_check(const char *
        return 0;
  
@@ -387,8 +458,8 @@ diff -urpN linux-stage.orig/fs/ext4/extents.c linux-stage/fs/ext4/extents.c
  
                /*
 diff -urpN linux-stage.orig/fs/ext4/ialloc.c linux-stage/fs/ext4/ialloc.c
---- linux-stage.orig/fs/ext4/ialloc.c  2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/ialloc.c       2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/ialloc.c  2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/ialloc.c       2012-02-16 08:05:47.000000000 -0500
 @@ -76,7 +76,7 @@ unsigned ext4_init_inode_bitmap(struct s
        /* If checksum is bad mark all blocks and inodes use to prevent
         * allocation, essentially implementing a per-group read-only flag. */
@@ -477,8 +548,8 @@ diff -urpN linux-stage.orig/fs/ext4/ialloc.c linux-stage/fs/ext4/ialloc.c
        printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n",
               bit, (unsigned long long)bitmap_bh->b_blocknr,
 diff -urpN linux-stage.orig/fs/ext4/inode.c linux-stage/fs/ext4/inode.c
---- linux-stage.orig/fs/ext4/inode.c   2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/inode.c        2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/inode.c   2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/inode.c        2012-02-16 08:05:47.000000000 -0500
 @@ -246,7 +246,7 @@ void ext4_delete_inode(struct inode *ino
        inode->i_size = 0;
        err = ext4_mark_inode_dirty(handle, inode);
@@ -601,8 +672,26 @@ diff -urpN linux-stage.orig/fs/ext4/inode.c linux-stage/fs/ext4/inode.c
                                        " some EAs or run e2fsck.",
                                        inode->i_ino);
 diff -urpN linux-stage.orig/fs/ext4/mballoc.c linux-stage/fs/ext4/mballoc.c
---- linux-stage.orig/fs/ext4/mballoc.c 2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/mballoc.c      2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/mballoc.c 2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/mballoc.c      2012-02-16 08:05:47.000000000 -0500
+@@ -862,8 +862,6 @@ static int ext4_mb_init_cache(struct pag
+       err = 0;
+       first_block = page->index * blocks_per_page;
+-      /* init the page  */
+-      memset(page_address(page), 0xff, PAGE_CACHE_SIZE);
+       for (i = 0; i < blocks_per_page; i++) {
+               int group;
+               struct ext4_group_info *grinfo;
+@@ -899,6 +897,8 @@ static int ext4_mb_init_cache(struct pag
+                        * incore got set to the group block bitmap below
+                        */
+                       ext4_lock_group(sb, group);
++                      /* init the page  */
++                      memset(data, 0xff, blocksize);
+                       ext4_mb_generate_buddy(sb, data, incore, group);
+                       ext4_unlock_group(sb, group);
+                       incore = NULL;
 @@ -1862,7 +1862,6 @@ void ext4_mb_scan_aligned(struct ext4_al
        }
  }
@@ -754,8 +843,8 @@ diff -urpN linux-stage.orig/fs/ext4/mballoc.c linux-stage/fs/ext4/mballoc.c
                           "Block = %llu, count = %lu", block, count);
                /* err = 0. ext4_std_error should be a no op */
 diff -urpN linux-stage.orig/fs/ext4/move_extent.c linux-stage/fs/ext4/move_extent.c
---- linux-stage.orig/fs/ext4/move_extent.c     2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/move_extent.c  2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/move_extent.c     2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/move_extent.c  2012-02-16 08:05:47.000000000 -0500
 @@ -152,12 +152,12 @@ mext_check_null_inode(struct inode *inod
        int ret = 0;
  
@@ -823,8 +912,8 @@ diff -urpN linux-stage.orig/fs/ext4/move_extent.c linux-stage/fs/ext4/move_exten
                                        "sum of replaced: %llu requested: %llu",
                                        *moved_len, len);
 diff -urpN linux-stage.orig/fs/ext4/namei.c linux-stage/fs/ext4/namei.c
---- linux-stage.orig/fs/ext4/namei.c   2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/namei.c        2011-12-28 11:28:51.000000000 -0500
+--- linux-stage.orig/fs/ext4/namei.c   2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/namei.c        2012-02-16 08:05:47.000000000 -0500
 @@ -394,8 +394,7 @@ dx_probe(const struct qstr *d_name, stru
        if (root->info.hash_version != DX_HASH_TEA &&
            root->info.hash_version != DX_HASH_HALF_MD4 &&
@@ -1051,8 +1140,8 @@ diff -urpN linux-stage.orig/fs/ext4/namei.c linux-stage/fs/ext4/namei.c
                                old_dir->i_ino, old_dir->i_nlink, retval);
        }
 diff -urpN linux-stage.orig/fs/ext4/resize.c linux-stage/fs/ext4/resize.c
---- linux-stage.orig/fs/ext4/resize.c  2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/resize.c       2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/resize.c  2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/resize.c       2012-02-16 08:05:47.000000000 -0500
 @@ -48,63 +48,63 @@ static int verify_group_input(struct sup
  
        ext4_get_group_no_and_offset(sb, start, NULL, &offset);
@@ -1311,9 +1400,18 @@ diff -urpN linux-stage.orig/fs/ext4/resize.c linux-stage/fs/ext4/resize.c
                mutex_unlock(&EXT4_SB(sb)->s_resize_lock);
                ext4_journal_stop(handle);
 diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
---- linux-stage.orig/fs/ext4/super.c   2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/super.c        2011-12-28 11:24:07.000000000 -0500
-@@ -337,7 +337,7 @@ static void ext4_handle_error(struct sup
+--- linux-stage.orig/fs/ext4/super.c   2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/super.c        2012-02-16 08:05:47.000000000 -0500
+@@ -53,6 +53,8 @@
+ struct proc_dir_entry *ext4_proc_root;
+ static struct kset *ext4_kset;
++static struct ext4_lazy_init *ext4_li_info;
++static struct mutex ext4_li_mtx;
+ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
+                            unsigned long journal_devnum);
+@@ -337,7 +339,7 @@ static void ext4_handle_error(struct sup
                        sb->s_id);
  }
  
@@ -1322,7 +1420,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
                const char *fmt, ...)
  {
        va_list args;
-@@ -351,6 +351,42 @@ void ext4_error(struct super_block *sb, 
+@@ -351,6 +353,42 @@ void ext4_error(struct super_block *sb, 
        ext4_handle_error(sb);
  }
  
@@ -1365,7 +1463,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
  static const char *ext4_decode_error(struct super_block *sb, int errno,
                                     char nbuf[16])
  {
-@@ -454,7 +490,7 @@ void ext4_msg (struct super_block * sb, 
+@@ -454,7 +492,7 @@ void ext4_msg (struct super_block * sb, 
        va_end(args);
  }
  
@@ -1374,7 +1472,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
                  const char *fmt, ...)
  {
        va_list args;
-@@ -511,7 +547,7 @@ void ext4_update_dynamic_rev(struct supe
+@@ -511,7 +549,7 @@ void ext4_update_dynamic_rev(struct supe
        if (le32_to_cpu(es->s_rev_level) > EXT4_GOOD_OLD_REV)
                return;
  
@@ -1383,7 +1481,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
                     "updating to rev %d because of new feature flag, "
                     "running e2fsck is recommended",
                     EXT4_DYNAMIC_REV);
-@@ -1096,9 +1132,9 @@ enum {
+@@ -1096,13 +1134,14 @@ enum {
        Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
        Opt_data_err_abort, Opt_data_err_ignore,
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
@@ -1396,7 +1494,12 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
        Opt_stripe, Opt_delalloc, Opt_nodelalloc,
        Opt_block_validity, Opt_noblock_validity,
        Opt_inode_readahead_blks, Opt_journal_ioprio,
-@@ -2709,6 +2745,21 @@ static int ext4_fill_super(struct super_
+       Opt_discard, Opt_nodiscard,
++      Opt_init_inode_table, Opt_noinit_inode_table,
+ };
+ static const match_table_t tokens = {
+@@ -2709,6 +2748,21 @@ static int ext4_fill_super(struct super_
        get_random_bytes(&sbi->s_next_generation, sizeof(u32));
        spin_lock_init(&sbi->s_next_gen_lock);
  
@@ -1418,7 +1521,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
        sbi->s_stripe = ext4_get_stripe_size(sbi);
        sbi->s_max_writeback_mb_bump = 128;
  
-@@ -2828,20 +2879,6 @@ static int ext4_fill_super(struct super_
+@@ -2828,20 +2882,6 @@ static int ext4_fill_super(struct super_
        set_task_ioprio(sbi->s_journal->j_task, journal_ioprio);
  
  no_journal:
@@ -1439,7 +1542,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
        if (test_opt(sb, NOBH)) {
                if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
                        ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
-@@ -2974,10 +3011,6 @@ failed_mount_wq:
+@@ -2974,10 +3014,6 @@ failed_mount_wq:
                jbd2_journal_destroy(sbi->s_journal);
                sbi->s_journal = NULL;
        }
@@ -1450,7 +1553,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
  failed_mount3:
        if (sbi->s_flex_groups) {
                if (is_vmalloc_addr(sbi->s_flex_groups))
-@@ -2985,6 +3018,10 @@ failed_mount3:
+@@ -2985,6 +3021,10 @@ failed_mount3:
                else
                        kfree(sbi->s_flex_groups);
        }
@@ -1461,7 +1564,7 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
  failed_mount2:
        for (i = 0; i < db_count; i++)
                brelse(sbi->s_group_desc[i]);
-@@ -3377,9 +3414,9 @@ static void ext4_clear_journal_err(struc
+@@ -3377,9 +3417,9 @@ static void ext4_clear_journal_err(struc
                char nbuf[16];
  
                errstr = ext4_decode_error(sb, j_errno, nbuf);
@@ -1473,9 +1576,67 @@ diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
                             "filesystem check.");
  
                EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
+@@ -4007,11 +4047,21 @@ static struct file_system_type ext4_fs_t
+       .fs_flags       = FS_REQUIRES_DEV,
+ };
++static int __init ext4_init_feat_adverts(void)
++{
++      return 0;
++}
++
++static void ext4_exit_feat_adverts(void)
++{
++}
++
+ static int __init init_ext4_fs(void)
+ {
+       int err;
+       ext4_check_flag_values();
++
+       err = init_ext4_system_zone();
+       if (err)
+               return err;
+@@ -4019,6 +4069,9 @@ static int __init init_ext4_fs(void)
+       if (!ext4_kset)
+               goto out4;
+       ext4_proc_root = proc_mkdir("fs/ext4", NULL);
++
++      err = ext4_init_feat_adverts();
++
+       err = init_ext4_mballoc();
+       if (err)
+               goto out3;
+@@ -4032,6 +4085,9 @@ static int __init init_ext4_fs(void)
+       err = register_filesystem(&ext4_fs_type);
+       if (err)
+               goto out;
++
++      ext4_li_info = NULL;
++      mutex_init(&ext4_li_mtx);
+       return 0;
+ out:
+       destroy_inodecache();
+@@ -4040,6 +4096,7 @@ out1:
+ out2:
+       exit_ext4_mballoc();
+ out3:
++      ext4_exit_feat_adverts();
+       remove_proc_entry("fs/ext4", NULL);
+       kset_unregister(ext4_kset);
+ out4:
+@@ -4053,6 +4110,7 @@ static void __exit exit_ext4_fs(void)
+       destroy_inodecache();
+       exit_ext4_xattr();
+       exit_ext4_mballoc();
++      ext4_exit_feat_adverts();
+       remove_proc_entry("fs/ext4", NULL);
+       kset_unregister(ext4_kset);
+       exit_ext4_system_zone();
 diff -urpN linux-stage.orig/fs/ext4/xattr.c linux-stage/fs/ext4/xattr.c
---- linux-stage.orig/fs/ext4/xattr.c   2011-12-28 08:18:31.000000000 -0500
-+++ linux-stage/fs/ext4/xattr.c        2011-12-28 11:24:07.000000000 -0500
+--- linux-stage.orig/fs/ext4/xattr.c   2012-02-16 07:54:55.000000000 -0500
++++ linux-stage/fs/ext4/xattr.c        2012-02-16 08:05:47.000000000 -0500
 @@ -227,7 +227,7 @@ ext4_xattr_block_get(struct inode *inode
        ea_bdebug(bh, "b_count=%d, refcount=%d",
                atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
index 2c471fe..cda8636 100644 (file)
@@ -1,6 +1,6 @@
 ext4-wantedi-2.6-rhel6.patch
 ext4-map_inode_page-2.6.18-rhel5.patch
-export-ext4-2.6-rhel5.patch
+export-ext4-2.6-rhel6.patch
 ext4-remove-cond_resched-calls-rhel5.patch
 ext4-nlink-2.6-rhel5.patch
 ext4-ext_generation-sles11.patch