Whamcloud - gitweb
b=19625
authorgirish <girish>
Thu, 28 May 2009 07:01:56 +0000 (07:01 +0000)
committergirish <girish>
Thu, 28 May 2009 07:01:56 +0000 (07:01 +0000)
i=adilger
i=johann

fix mballoc prealloc table

ldiskfs/kernel_patches/patches/ext4-prealloc-sles11.patch

index 31eff99..029a91a 100644 (file)
@@ -1,8 +1,8 @@
 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
 ===================================================================
 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
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
-@@ -111,11 +111,14 @@ struct ext4_sb_info {
+--- 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;
  
        /* tunables */
        unsigned long s_stripe;
@@ -20,9 +20,9 @@ Index: linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
        unsigned long s_mb_last_group;
 Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
 ===================================================================
        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
-+++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c
-@@ -1996,7 +1996,7 @@ ext4_mb_regular_allocator(struct ext4_al
+--- 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
+@@ -1996,7 +1996,7 @@
        if (size < isize)
                size = isize;
  
        if (size < isize)
                size = isize;
  
@@ -31,7 +31,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
                        (ac->ac_flags & EXT4_MB_HINT_DATA)) {
                /* TBD: may be hot point */
                spin_lock(&sbi->s_md_lock);
                        (ac->ac_flags & EXT4_MB_HINT_DATA)) {
                /* TBD: may be hot point */
                spin_lock(&sbi->s_md_lock);
-@@ -2686,6 +2686,26 @@ err_freesgi:
+@@ -2686,6 +2686,26 @@
        return -ENOMEM;
  }
  
        return -ENOMEM;
  }
  
@@ -58,7 +58,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
  int ext4_mb_init(struct super_block *sb, int needs_recovery)
  {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
  int ext4_mb_init(struct super_block *sb, int needs_recovery)
  {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
-@@ -2738,13 +2758,55 @@ int ext4_mb_init(struct super_block *sb,
+@@ -2738,13 +2758,55 @@
        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_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;
@@ -116,7 +116,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
                kfree(sbi->s_mb_offsets);
                kfree(sbi->s_mb_maxs);
                return -ENOMEM;
                kfree(sbi->s_mb_offsets);
                kfree(sbi->s_mb_maxs);
                return -ENOMEM;
-@@ -2915,9 +2977,89 @@ ext4_mb_free_committed_blocks(struct sup
+@@ -2915,15 +2977,90 @@
  #define EXT4_MB_MAX_TO_SCAN_NAME      "max_to_scan"
  #define EXT4_MB_MIN_TO_SCAN_NAME      "min_to_scan"
  #define EXT4_MB_ORDER2_REQ            "order2_req"
  #define EXT4_MB_MAX_TO_SCAN_NAME      "max_to_scan"
  #define EXT4_MB_MIN_TO_SCAN_NAME      "min_to_scan"
  #define EXT4_MB_ORDER2_REQ            "order2_req"
@@ -198,24 +198,36 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
 +      return cnt;
 +}
 +
 +      return cnt;
 +}
 +
-+static const struct file_operations ext4_mb_prealloc_table_proc_fops = {
-+      .owner          = THIS_MODULE,
-+      .read           = ext4_mb_prealloc_table_proc_read,
-+      .write          = ext4_mb_prealloc_table_proc_write,
-+};
-+
  static int ext4_mb_init_per_dev_proc(struct super_block *sb)
  {
  #ifdef CONFIG_PROC_FS
  static int ext4_mb_init_per_dev_proc(struct super_block *sb)
  {
  #ifdef CONFIG_PROC_FS
-@@ -2932,13 +3074,17 @@ static int ext4_mb_init_per_dev_proc(str
+       mode_t mode = S_IFREG | S_IRUGO | S_IWUSR;
+       struct ext4_sb_info *sbi = EXT4_SB(sb);
+       struct proc_dir_entry *proc;
++      struct proc_dir_entry *proc_entry;
+       if (sbi->s_proc == NULL)
+               return -EINVAL;
+@@ -2932,13 +3069,28 @@
        EXT4_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, mb_max_to_scan);
        EXT4_PROC_HANDLER(EXT4_MB_MIN_TO_SCAN_NAME, mb_min_to_scan);
        EXT4_PROC_HANDLER(EXT4_MB_ORDER2_REQ, mb_order2_reqs);
 -      EXT4_PROC_HANDLER(EXT4_MB_STREAM_REQ, mb_stream_request);
 +      EXT4_PROC_HANDLER(EXT4_MB_SMALL_REQ, mb_small_req);
 +      EXT4_PROC_HANDLER(EXT4_MB_LARGE_REQ, mb_large_req);
        EXT4_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, mb_max_to_scan);
        EXT4_PROC_HANDLER(EXT4_MB_MIN_TO_SCAN_NAME, mb_min_to_scan);
        EXT4_PROC_HANDLER(EXT4_MB_ORDER2_REQ, mb_order2_reqs);
 -      EXT4_PROC_HANDLER(EXT4_MB_STREAM_REQ, mb_stream_request);
 +      EXT4_PROC_HANDLER(EXT4_MB_SMALL_REQ, mb_small_req);
 +      EXT4_PROC_HANDLER(EXT4_MB_LARGE_REQ, mb_large_req);
-+      EXT4_PROC_HANDLER(EXT4_MB_PREALLOC_TABLE, mb_prealloc_table);
        EXT4_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, mb_group_prealloc);
        EXT4_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, mb_group_prealloc);
++
++      proc_entry = create_proc_entry(EXT4_MB_PREALLOC_TABLE, S_IFREG |
++                                     S_IRUGO | S_IWUSR, sbi->s_proc);
++      if (proc_entry == NULL) {
++              printk(KERN_ERR "EXT4-fs: unable to create %s\n",
++                     EXT4_MB_PREALLOC_TABLE);
++              goto err_out;
++      }
++      proc_entry->data = sbi;
++      proc_entry->read_proc = ext4_mb_prealloc_table_proc_read;
++      proc_entry->write_proc = ext4_mb_prealloc_table_proc_write;
++
        return 0;
  
  err_out:
        return 0;
  
  err_out:
@@ -227,7 +239,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
        remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
        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_ORDER2_REQ, sbi->s_proc);
        remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
        remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
-@@ -2959,7 +3105,9 @@ static int ext4_mb_destroy_per_dev_proc(
+@@ -2959,7 +3111,9 @@
                return -EINVAL;
  
        remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
                return -EINVAL;
  
        remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
@@ -238,7 +250,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
        remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
        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_ORDER2_REQ, sbi->s_proc);
        remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
        remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
-@@ -3162,11 +3310,12 @@ static noinline_for_stack void
+@@ -3162,11 +3316,12 @@
  ext4_mb_normalize_request(struct ext4_allocation_context *ac,
                                struct ext4_allocation_request *ar)
  {
  ext4_mb_normalize_request(struct ext4_allocation_context *ac,
                                struct ext4_allocation_request *ar)
  {
@@ -253,7 +265,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
        struct ext4_prealloc_space *pa;
  
        /* do normalize only data requests, metadata requests
        struct ext4_prealloc_space *pa;
  
        /* do normalize only data requests, metadata requests
-@@ -3196,49 +3345,35 @@ ext4_mb_normalize_request(struct ext4_al
+@@ -3196,49 +3351,35 @@
        size = size << bsbits;
        if (size < i_size_read(ac->ac_inode))
                size = i_size_read(ac->ac_inode);
        size = size << bsbits;
        if (size < i_size_read(ac->ac_inode))
                size = i_size_read(ac->ac_inode);
@@ -328,7 +340,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
  
        /* don't cover already allocated blocks in selected range */
        if (ar->pleft && start <= ar->lleft) {
  
        /* don't cover already allocated blocks in selected range */
        if (ar->pleft && start <= ar->lleft) {
-@@ -3315,7 +3450,6 @@ ext4_mb_normalize_request(struct ext4_al
+@@ -3315,7 +3456,6 @@
        }
        BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
                        start > ac->ac_o_ex.fe_logical);
        }
        BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
                        start > ac->ac_o_ex.fe_logical);
@@ -336,7 +348,7 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
  
        /* now prepare goal request */
  
  
        /* now prepare goal request */
  
-@@ -4236,22 +4370,32 @@ static void ext4_mb_group_or_file(struct
+@@ -4236,22 +4376,32 @@
  {
        struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
        int bsbits = ac->ac_sb->s_blocksize_bits;
  {
        struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
        int bsbits = ac->ac_sb->s_blocksize_bits;
@@ -378,9 +390,9 @@ Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
         * locality group prealloc space are per cpu. The reason for having
 Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
 ===================================================================
         * 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
-+++ linux-2.6.27.21-0.1/fs/ext4/inode.c
-@@ -2442,14 +2442,14 @@ static int ext4_da_writepages(struct add
+--- 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;
  
        /*
                return -EROFS;
  
        /*