Whamcloud - gitweb
Branch b1_6
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-mballoc3-2.6.22.patch
index ddc64d8..7ce15fe 100644 (file)
@@ -1,7 +1,7 @@
-Index: linux-2.6.18.8/include/linux/ext3_fs_i.h
+Index: linux-2.6.22.19/include/linux/ext3_fs_i.h
 ===================================================================
---- linux-2.6.18.8.orig/include/linux/ext3_fs_i.h      2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/include/linux/ext3_fs_i.h   2007-07-17 09:18:53.000000000 +0200
+--- linux-2.6.22.19.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.22.19/include/linux/ext3_fs_i.h
 @@ -154,6 +154,10 @@ struct ext3_inode_info {
        struct inode vfs_inode;
  
@@ -13,10 +13,10 @@ Index: linux-2.6.18.8/include/linux/ext3_fs_i.h
  };
  
  #endif        /* _LINUX_EXT3_FS_I */
-Index: linux-2.6.18.8/include/linux/ext3_fs_sb.h
+Index: linux-2.6.22.19/include/linux/ext3_fs_sb.h
 ===================================================================
---- linux-2.6.18.8.orig/include/linux/ext3_fs_sb.h     2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/include/linux/ext3_fs_sb.h  2007-07-17 09:18:53.000000000 +0200
+--- linux-2.6.22.19.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.22.19/include/linux/ext3_fs_sb.h
 @@ -21,8 +21,15 @@
  #include <linux/wait.h>
  #include <linux/blockgroup_lock.h>
@@ -33,10 +33,10 @@ Index: linux-2.6.18.8/include/linux/ext3_fs_sb.h
  
  /*
   * third extended-fs super-block data in memory
-Index: linux-2.6.18.8/include/linux/ext3_fs.h
+Index: linux-2.6.22.19/include/linux/ext3_fs.h
 ===================================================================
---- linux-2.6.18.8.orig/include/linux/ext3_fs.h        2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/include/linux/ext3_fs.h     2007-07-17 09:18:53.000000000 +0200
+--- linux-2.6.22.19.orig/include/linux/ext3_fs.h
++++ linux-2.6.22.19/include/linux/ext3_fs.h
 @@ -17,6 +17,7 @@
  #define _LINUX_EXT3_FS_H
  
@@ -45,7 +45,7 @@ Index: linux-2.6.18.8/include/linux/ext3_fs.h
  #include <linux/magic.h>
  
  /*
-@@ -67,12 +68,12 @@
+@@ -68,12 +69,12 @@
  
  struct ext3_allocation_request {
        struct inode *inode;    /* target inode for block we're allocating */
@@ -64,7 +64,7 @@ Index: linux-2.6.18.8/include/linux/ext3_fs.h
        unsigned long len;      /* how many blocks we want to allocate */
        unsigned long flags;    /* flags. see above EXT3_MB_HINT_* */
  };
-@@ -400,6 +401,7 @@ struct ext3_inode {
+@@ -414,6 +415,7 @@ struct ext3_inode {
  #define EXT3_MOUNT_IOPEN_NOPRIV               0x800000/* Make iopen world-readable */
  #define EXT3_MOUNT_EXTENTS            0x2000000/* Extents support */
  #define EXT3_MOUNT_EXTDEBUG             0x4000000/* Extents debug */
@@ -72,7 +72,7 @@ Index: linux-2.6.18.8/include/linux/ext3_fs.h
  
  /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
  #ifndef clear_opt
-@@ -787,12 +789,12 @@ ext3_group_first_block_no(struct super_b
+@@ -801,12 +803,12 @@ ext3_group_first_block_no(struct super_b
  /* balloc.c */
  extern int ext3_bg_has_super(struct super_block *sb, int group);
  extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
@@ -88,7 +88,7 @@ Index: linux-2.6.18.8/include/linux/ext3_fs.h
  extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
                                 ext3_fsblk_t block, unsigned long count,
                                unsigned long *pdquot_freed_blocks);
-@@ -836,15 +838,45 @@ extern long ext3_mb_stats;
+@@ -850,15 +852,45 @@ extern long ext3_mb_stats;
  extern long ext3_mb_max_to_scan;
  extern int ext3_mb_init(struct super_block *, int);
  extern int ext3_mb_release(struct super_block *);
@@ -136,11 +136,11 @@ Index: linux-2.6.18.8/include/linux/ext3_fs.h
  
  /* inode.c */
  int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
-Index: linux-2.6.18.8/fs/ext3/super.c
+Index: linux-2.6.22.19/fs/ext3/super.c
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/super.c        2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/fs/ext3/super.c     2007-07-17 09:18:53.000000000 +0200
-@@ -688,6 +688,7 @@ enum {
+--- linux-2.6.22.19.orig/fs/ext3/super.c
++++ linux-2.6.22.19/fs/ext3/super.c
+@@ -685,6 +685,7 @@ enum {
        Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
        Opt_grpquota,
        Opt_extents, Opt_noextents, Opt_extdebug,
@@ -148,7 +148,7 @@ Index: linux-2.6.18.8/fs/ext3/super.c
  };
  
  static match_table_t tokens = {
-@@ -743,6 +744,9 @@ static match_table_t tokens = {
+@@ -740,6 +741,9 @@ static match_table_t tokens = {
        {Opt_extents, "extents"},
        {Opt_noextents, "noextents"},
        {Opt_extdebug, "extdebug"},
@@ -158,7 +158,7 @@ Index: linux-2.6.18.8/fs/ext3/super.c
        {Opt_err, NULL},
        {Opt_resize, "resize"},
  };
-@@ -1096,6 +1100,19 @@ clear_qf_name:
+@@ -1093,6 +1097,19 @@ clear_qf_name:
                case Opt_extdebug:
                        set_opt (sbi->s_mount_opt, EXTDEBUG);
                        break;
@@ -178,7 +178,7 @@ Index: linux-2.6.18.8/fs/ext3/super.c
                default:
                        printk (KERN_ERR
                                "EXT3-fs: Unrecognized mount option \"%s\" "
-@@ -1826,6 +1843,7 @@ static int ext3_fill_super (struct super
+@@ -1832,6 +1849,7 @@ static int ext3_fill_super (struct super
                "writeback");
  
        ext3_ext_init(sb);
@@ -186,11 +186,11 @@ Index: linux-2.6.18.8/fs/ext3/super.c
  
        lock_kernel();
        return 0;
-Index: linux-2.6.18.8/fs/ext3/extents.c
+Index: linux-2.6.22.19/fs/ext3/extents.c
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/extents.c      2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/fs/ext3/extents.c   2007-07-17 09:18:53.000000000 +0200
-@@ -795,7 +795,7 @@ cleanup:
+--- linux-2.6.22.19.orig/fs/ext3/extents.c
++++ linux-2.6.22.19/fs/ext3/extents.c
+@@ -801,7 +801,7 @@ cleanup:
                for (i = 0; i < depth; i++) {
                        if (!ablocks[i])
                                continue;
@@ -199,7 +199,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
                }
        }
        kfree(ablocks);
-@@ -1613,7 +1613,7 @@ int ext3_ext_rm_idx(handle_t *handle, st
+@@ -1619,7 +1619,7 @@ int ext3_ext_rm_idx(handle_t *handle, st
        ext_debug(inode, "index is empty, remove it, free block %lu\n", leaf);
        bh = sb_find_get_block(inode->i_sb, leaf);
        ext3_forget(handle, 1, inode, bh, leaf);
@@ -208,7 +208,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
        return err;
  }
  
-@@ -1672,7 +1672,7 @@ static int ext3_remove_blocks(handle_t *
+@@ -1678,7 +1678,7 @@ static int ext3_remove_blocks(handle_t *
                                unsigned long from, unsigned long to)
  {
        struct buffer_head *bh;
@@ -217,7 +217,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
  
  #ifdef EXTENTS_STATS
        {
-@@ -1690,6 +1690,8 @@ static int ext3_remove_blocks(handle_t *
+@@ -1696,6 +1696,8 @@ static int ext3_remove_blocks(handle_t *
                spin_unlock(&sbi->s_ext_stats_lock);
        }
  #endif
@@ -226,7 +226,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
        if (from >= le32_to_cpu(ex->ee_block)
            && to == le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - 1) {
                /* tail removal */
-@@ -1701,7 +1703,7 @@ static int ext3_remove_blocks(handle_t *
+@@ -1707,7 +1709,7 @@ static int ext3_remove_blocks(handle_t *
                        bh = sb_find_get_block(inode->i_sb, start + i);
                        ext3_forget(handle, 0, inode, bh, start + i);
                }
@@ -235,7 +235,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
        } else if (from == le32_to_cpu(ex->ee_block)
                   && to <= le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - 1) {
                printk("strange request: removal %lu-%lu from %u:%u\n",
-@@ -2034,7 +2036,7 @@ int ext3_ext_get_blocks(handle_t *handle
+@@ -2040,7 +2042,7 @@ int ext3_ext_get_blocks(handle_t *handle
        struct ext3_extent newex, *ex;
        int goal, newblock, err = 0, depth;
        unsigned long allocated = 0;
@@ -244,7 +244,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
  
        __clear_bit(BH_New, &bh_result->b_state);
        ext_debug(inode, "blocks %d/%lu requested for inode %u\n", (int) iblock,
-@@ -2116,18 +2118,33 @@ int ext3_ext_get_blocks(handle_t *handle
+@@ -2122,18 +2124,36 @@ int ext3_ext_get_blocks(handle_t *handle
        if (S_ISREG(inode->i_mode) && (!EXT3_I(inode)->i_block_alloc_info))
                ext3_init_block_alloc_info(inode);
  
@@ -279,12 +279,15 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
 +      ar.goal = ext3_ext_find_goal(inode, path, iblock);
 +      ar.logical = iblock;
 +      ar.len = allocated;
-+      ar.flags = EXT3_MB_HINT_DATA;
++      if (S_ISREG(inode->i_mode))
++              ar.flags = EXT3_MB_HINT_DATA;
++      else
++              ar.flags = 0;
 +      newblock = ext3_mb_new_blocks(handle, &ar, &err);
        if (!newblock)
                goto out2;
        ext_debug(inode, "allocate new block: goal %d, found %d/%lu\n",
-@@ -2137,12 +2154,16 @@ int ext3_ext_get_blocks(handle_t *handle
+@@ -2143,12 +2163,16 @@ int ext3_ext_get_blocks(handle_t *handle
        newex.ee_block = cpu_to_le32(iblock);
        newex.ee_start = cpu_to_le32(newblock);
        newex.ee_start_hi = 0;
@@ -304,7 +307,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
                goto out2;
        }
  
-@@ -2151,6 +2172,7 @@ int ext3_ext_get_blocks(handle_t *handle
+@@ -2157,6 +2181,7 @@ int ext3_ext_get_blocks(handle_t *handle
  
        /* previous routine could use block we allocated */
        newblock = le32_to_cpu(newex.ee_start);
@@ -312,7 +315,7 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
        __set_bit(BH_New, &bh_result->b_state);
  
        ext3_ext_put_in_cache(inode, iblock, allocated, newblock,
-@@ -2202,6 +2224,9 @@ void ext3_ext_truncate(struct inode * in
+@@ -2208,6 +2233,9 @@ void ext3_ext_truncate(struct inode * in
        mutex_lock(&EXT3_I(inode)->truncate_mutex);
        ext3_ext_invalidate_cache(inode);
  
@@ -322,11 +325,11 @@ Index: linux-2.6.18.8/fs/ext3/extents.c
        /*
         * TODO: optimization is possible here
         * probably we need not scaning at all,
-Index: linux-2.6.18.8/fs/ext3/Makefile
+Index: linux-2.6.22.19/fs/ext3/Makefile
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/Makefile       2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/fs/ext3/Makefile    2007-07-17 09:18:53.000000000 +0200
-@@ -5,7 +5,7 @@
+--- linux-2.6.22.19.orig/fs/ext3/Makefile
++++ linux-2.6.22.19/fs/ext3/Makefile
+@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
  
  ext3-y        := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
           ioctl.o namei.o super.o symlink.o hash.o resize.o ext3_jbd.o \
@@ -335,11 +338,11 @@ Index: linux-2.6.18.8/fs/ext3/Makefile
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
  ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
-Index: linux-2.6.18.8/fs/ext3/xattr.c
+Index: linux-2.6.22.19/fs/ext3/xattr.c
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/xattr.c        2007-02-24 00:52:30.000000000 +0100
-+++ linux-2.6.18.8/fs/ext3/xattr.c     2007-07-17 09:18:53.000000000 +0200
-@@ -484,7 +484,7 @@ ext3_xattr_release_block(handle_t *handl
+--- linux-2.6.22.19.orig/fs/ext3/xattr.c
++++ linux-2.6.22.19/fs/ext3/xattr.c
+@@ -488,7 +488,7 @@ ext3_xattr_release_block(handle_t *handl
                ea_bdebug(bh, "refcount now=0; freeing");
                if (ce)
                        mb_cache_entry_free(ce);
@@ -348,7 +351,7 @@ Index: linux-2.6.18.8/fs/ext3/xattr.c
                get_bh(bh);
                ext3_forget(handle, 1, inode, bh, bh->b_blocknr);
        } else {
-@@ -805,7 +805,7 @@ inserted:
+@@ -813,7 +813,7 @@ inserted:
                        new_bh = sb_getblk(sb, block);
                        if (!new_bh) {
  getblk_failed:
@@ -357,11 +360,11 @@ Index: linux-2.6.18.8/fs/ext3/xattr.c
                                error = -EIO;
                                goto cleanup;
                        }
-Index: linux-2.6.18.8/fs/ext3/balloc.c
+Index: linux-2.6.22.19/fs/ext3/balloc.c
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/balloc.c       2007-02-24 00:52:30.000000000 +0100
-+++ linux-2.6.18.8/fs/ext3/balloc.c    2007-07-17 09:18:53.000000000 +0200
-@@ -79,7 +79,7 @@ struct ext3_group_desc * ext3_get_group_
+--- linux-2.6.22.19.orig/fs/ext3/balloc.c
++++ linux-2.6.22.19/fs/ext3/balloc.c
+@@ -90,7 +90,7 @@ struct ext3_group_desc * ext3_get_group_
   *
   * Return buffer_head on success or NULL in case of failure.
   */
@@ -370,7 +373,7 @@ Index: linux-2.6.18.8/fs/ext3/balloc.c
  read_block_bitmap(struct super_block *sb, unsigned int block_group)
  {
        struct ext3_group_desc * desc;
-@@ -294,6 +294,8 @@ void ext3_discard_reservation(struct ino
+@@ -391,6 +391,8 @@ void ext3_discard_reservation(struct ino
        struct ext3_reserve_window_node *rsv;
        spinlock_t *rsv_lock = &EXT3_SB(inode->i_sb)->s_rsv_window_lock;
  
@@ -379,7 +382,7 @@ Index: linux-2.6.18.8/fs/ext3/balloc.c
        if (!block_i)
                return;
  
-@@ -490,19 +492,24 @@
+@@ -602,19 +604,24 @@ error_return:
   * @count:            number of blocks to count
   */
  void ext3_free_blocks(handle_t *handle, struct inode *inode,
@@ -414,16 +417,16 @@ Index: linux-2.6.18.8/fs/ext3/balloc.c
        return;
  }
  
-@@ -1199,7 +1205,7 @@ int ext3_should_retry_alloc(struct super
-  * bitmap, and then for any free bit if that fails.
-  * This function also updates quota and i_blocks field.
+@@ -1403,7 +1410,7 @@ int ext3_should_retry_alloc(struct super
+  * any specific goal block.
+  *
   */
 -ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
 +ext3_fsblk_t ext3_new_blocks_old(handle_t *handle, struct inode *inode,
                        ext3_fsblk_t goal, unsigned long *count, int *errp)
  {
        struct buffer_head *bitmap_bh = NULL;
-@@ -1463,7 +1469,7 @@ out:
+@@ -1666,7 +1673,7 @@ out:
        return 0;
  }
  
@@ -432,10 +435,10 @@ Index: linux-2.6.18.8/fs/ext3/balloc.c
                        ext3_fsblk_t goal, int *errp)
  {
        unsigned long count = 1;
-Index: linux-2.6.18.8/fs/ext3/inode.c
+Index: linux-2.6.22.19/fs/ext3/inode.c
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/inode.c        2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/fs/ext3/inode.c     2007-07-17 09:18:53.000000000 +0200
+--- linux-2.6.22.19.orig/fs/ext3/inode.c
++++ linux-2.6.22.19/fs/ext3/inode.c
 @@ -560,7 +560,7 @@ static int ext3_alloc_blocks(handle_t *h
        return ret;
  failed_out:
@@ -470,7 +473,7 @@ Index: linux-2.6.18.8/fs/ext3/inode.c
  
        return err;
  }
-@@ -1996,7 +1997,7 @@ static void ext3_clear_blocks(handle_t *
+@@ -1988,7 +1989,7 @@ static void ext3_clear_blocks(handle_t *
                }
        }
  
@@ -479,7 +482,7 @@ Index: linux-2.6.18.8/fs/ext3/inode.c
  }
  
  /**
-@@ -2169,7 +2170,7 @@ static void ext3_free_branches(handle_t 
+@@ -2161,7 +2162,7 @@ static void ext3_free_branches(handle_t 
                                ext3_journal_test_restart(handle, inode);
                        }
  
@@ -488,11 +491,11 @@ Index: linux-2.6.18.8/fs/ext3/inode.c
  
                        if (parent_bh) {
                                /*
-Index: linux-2.6.18.8/fs/ext3/mballoc.c
+Index: linux-2.6.22.19/fs/ext3/mballoc.c
 ===================================================================
---- linux-2.6.18.8.orig/fs/ext3/mballoc.c      2007-07-17 09:18:14.000000000 +0200
-+++ linux-2.6.18.8/fs/ext3/mballoc.c   2007-07-17 09:23:56.000000000 +0200
-@@ -307,7 +307,7 @@
+--- linux-2.6.22.19.orig/fs/ext3/mballoc.c
++++ linux-2.6.22.19/fs/ext3/mballoc.c
+@@ -305,7 +305,7 @@
   */
  #define MB_DEFAULT_STRIPE             256
  
@@ -548,7 +551,7 @@ Index: linux-2.6.18.8/fs/ext3/mballoc.c
                        + fex->fe_start
                        + le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
        return block;
-@@ -3174,7 +3174,7 @@ void ext3_mb_collect_stats(struct ext3_a
+@@ -3202,7 +3202,7 @@ void ext3_mb_collect_stats(struct ext3_a
  void ext3_mb_use_inode_pa(struct ext3_allocation_context *ac,
                                struct ext3_prealloc_space *pa)
  {
@@ -557,7 +560,7 @@ Index: linux-2.6.18.8/fs/ext3/mballoc.c
  
        /* found preallocated blocks, use them */
        start = pa->pa_pstart + (ac->ac_o_ex.fe_logical - pa->pa_lstart);
-@@ -4027,13 +4027,13 @@ int ext3_mb_discard_preallocations(struc
+@@ -4053,13 +4053,13 @@ int ext3_mb_discard_preallocations(struc
   * it tries to use preallocation first, then falls back
   * to usual allocation
   */
@@ -573,7 +576,7 @@ Index: linux-2.6.18.8/fs/ext3/mballoc.c
        int freed, inquota;
  
        sb = ar->inode->i_sb;
-@@ -4044,8 +4044,8 @@ unsigned long ext3_mb_new_blocks(handle_
+@@ -4070,8 +4070,8 @@ unsigned long ext3_mb_new_blocks(handle_
                if (ext3_mballoc_warning++ == 0)
                        printk(KERN_ERR "EXT3-fs: multiblock request with "
                                        "mballoc disabled!\n");
@@ -584,7 +587,7 @@ Index: linux-2.6.18.8/fs/ext3/mballoc.c
                return block;
        }
  
-@@ -4109,11 +4109,11 @@ out:
+@@ -4135,11 +4135,11 @@ out:
  }
  EXPORT_SYMBOL(ext3_mb_new_blocks);
  
@@ -599,7 +602,7 @@ Index: linux-2.6.18.8/fs/ext3/mballoc.c
  
        if (!test_opt(inode->i_sb, MBALLOC)) {
                ret = ext3_new_block_old(handle, inode, goal, errp);
-@@ -4228,8 +4228,8 @@ int ext3_mb_free_metadata(handle_t *hand
+@@ -4254,8 +4254,8 @@ int ext3_mb_free_metadata(handle_t *hand
   * Main entry point into mballoc to free blocks
   */
  void ext3_mb_free_blocks(handle_t *handle, struct inode *inode,