Whamcloud - gitweb
Branch b1_6
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-mballoc3-core.patch
index fca4db9..f1d9bd6 100644 (file)
@@ -183,7 +183,7 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 ===================================================================
 --- linux-2.6.9-full.orig/fs/ext3/mballoc.c    2007-10-17 21:59:51.072534980 +0400
 +++ linux-2.6.9-full/fs/ext3/mballoc.c 2007-10-17 23:09:22.000000000 +0400
-@@ -0,0 +1,4404 @@
+@@ -0,0 +1,4398 @@
 +/*
 + * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com
 + * Written by Alex Tomas <alex@clusterfs.com>
@@ -2600,7 +2600,7 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +      sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
 +      sbi->s_mb_history_filter = EXT3_MB_HISTORY_DEFAULT;
 +
-+      i = sizeof(struct ext3_locality_group) * NR_CPUS;
++      i = sizeof(struct ext3_locality_group) * num_possible_cpus();
 +      sbi->s_locality_groups = kmalloc(i, GFP_NOFS);
 +      if (sbi->s_locality_groups == NULL) {
 +              clear_opt(sbi->s_mount_opt, MBALLOC);
@@ -2608,7 +2608,7 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +              kfree(sbi->s_mb_maxs);
 +              return -ENOMEM;
 +      }
-+      for (i = 0; i < NR_CPUS; i++) {
++      for (i = 0; i < num_possible_cpus(); i++) {
 +              struct ext3_locality_group *lg;
 +              lg = &sbi->s_locality_groups[i];
 +              sema_init(&lg->lg_sem, 1);
@@ -3889,8 +3889,6 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +              spin_lock(&pa->pa_lock);
 +              if (atomic_read(&pa->pa_count)) {
 +                      spin_unlock(&pa->pa_lock);
-+                      printk("uh! busy PA\n");
-+                      dump_stack();
 +                      busy = 1;
 +                      continue;
 +              }
@@ -3983,8 +3981,6 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +                       * use preallocation while we're discarding it */
 +                      spin_unlock(&pa->pa_lock);
 +                      spin_unlock(&ei->i_prealloc_lock);
-+                      printk("uh-oh! used pa while discarding\n");
-+                      dump_stack();
 +                      current->state = TASK_UNINTERRUPTIBLE;
 +                      schedule_timeout(HZ);
 +                      goto repeat;
@@ -4014,8 +4010,6 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +               * add a flag to force wait only in case
 +               * of ->clear_inode(), but not in case of
 +               * regular truncate */
-+              printk("uh-oh! some one just deleted it\n");
-+              dump_stack();
 +              current->state = TASK_UNINTERRUPTIBLE;
 +              schedule_timeout(HZ);
 +              goto repeat;
@@ -4030,15 +4024,15 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +              BUG_ON(err != 0); /* error handling here */
 +
 +              bitmap_bh = read_block_bitmap(sb, group);
-+              if (bitmap_bh == NULL) {
-+                      /* error handling here */
-+                      ext3_mb_release_desc(&e3b);
-+                      BUG_ON(bitmap_bh == NULL);
-+              }
 +
 +              ext3_lock_group(sb, group);
 +              list_del_rcu(&pa->pa_group_list);
-+              ext3_mb_release_inode_pa(&e3b, bitmap_bh, pa);
++
++              /* can be NULL due to IO error, at worst
++               * we leave some free blocks unavailable
++               * do not go RO - no need for */
++              if (bitmap_bh != NULL)
++                      ext3_mb_release_inode_pa(&e3b, bitmap_bh, pa);
 +              ext3_unlock_group(sb, group);
 +
 +              ext3_mb_release_desc(&e3b);