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 22:25:11.000000000 +0400
-@@ -0,0 +1,4402 @@
++++ linux-2.6.9-full/fs/ext3/mballoc.c 2007-10-17 23:09:22.000000000 +0400
+@@ -0,0 +1,4404 @@
+/*
+ * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com
+ * Written by Alex Tomas <alex@clusterfs.com>
+ spin_lock_init(&sbi->s_mb_history_lock);
+ i = sbi->s_mb_history_max * sizeof(struct ext3_mb_history);
+ sbi->s_mb_history = kmalloc(i, GFP_KERNEL);
-+ if (likely(sbi->s_mb_history != NULL))
-+ memset(sbi->s_mb_history, 0, i);
++ if (likely(sbi->s_mb_history != NULL))
++ memset(sbi->s_mb_history, 0, i);
+ /* if we can't allocate history, then we simple won't use it */
+}
+
+ ext3_get_group_no_and_offset(sb, pa->pa_pstart, &groupnr, &start);
+ len = pa->pa_len;
+ spin_unlock(&pa->pa_lock);
-+ BUG_ON(groupnr != group);
++ if (unlikely(len == 0))
++ continue;
++ BUG_ON(groupnr != group && len != 0);
+ mb_set_bits(sb_bgl_lock(EXT3_SB(sb), group), bitmap, start,len);
+ preallocated += len;
+ count++;
+ BUG_ON(ac->ac_status != AC_STATUS_FOUND);
+ BUG_ON(!S_ISREG(ac->ac_inode->i_mode));
+
-+ pa = kmem_cache_alloc(ext3_pspace_cachep, SLAB_NOFS);
++ pa = kmem_cache_alloc(ext3_pspace_cachep, GFP_NOFS);
+ if (pa == NULL)
+ return -ENOMEM;
+
+ BUG_ON(!S_ISREG(ac->ac_inode->i_mode));
+
+ BUG_ON(ext3_pspace_cachep == NULL);
-+ pa = kmem_cache_alloc(ext3_pspace_cachep, SLAB_NOFS);
++ pa = kmem_cache_alloc(ext3_pspace_cachep, GFP_NOFS);
+ if (pa == NULL)
+ return -ENOMEM;
+
+
+ BUG_ON(pa->pa_deleted == 0);
+ ext3_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
-+ BUG_ON(group != e3b->bd_group);
++ BUG_ON(group != e3b->bd_group && pa->pa_len != 0);
+ end = bit + pa->pa_len;
+
+ ac.ac_sb = sb;
+
+ BUG_ON(pa->pa_deleted == 0);
+ ext3_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
-+ BUG_ON(group != e3b->bd_group);
++ BUG_ON(group != e3b->bd_group && pa->pa_len != 0);
+ mb_free_blocks(pa->pa_inode, e3b, bit, pa->pa_len);
+ atomic_add(pa->pa_len, &EXT3_SB(sb)->s_mb_discarded);
+