ext4_group_t group);
@@ -660,7 +660,7 @@ static void ext4_mb_mark_free_simple(str
- }
}
--static void ext4_mb_generate_buddy(struct super_block *sb,
-+static int ext4_mb_generate_buddy(struct super_block *sb,
+ static noinline_for_stack
+-void ext4_mb_generate_buddy(struct super_block *sb,
++int ext4_mb_generate_buddy(struct super_block *sb,
void *buddy, void *bitmap, ext4_group_t group)
{
struct ext4_group_info *grp = ext4_get_group_info(sb, group);
- grp->bb_free = free;
+ struct ext4_group_desc *gdp;
+ gdp = ext4_get_group_desc (sb, group, NULL);
-+ ext4_error(sb, __FUNCTION__,
++ ext4_error(sb,
+ "group %lu: %u blocks in bitmap, %u in bb, "
+ "%u in gd, %lu pa's\n", (long unsigned int)group,
+ free, grp->bb_free, ext4_free_blks_count(sb, gdp),
if (ac->ac_op == EXT4_MB_HISTORY_ALLOC) {
if (ac->ac_g_ex.fe_start == ac->ac_b_ex.fe_start &&
ac->ac_g_ex.fe_group == ac->ac_b_ex.fe_group)
-@@ -3539,22 +3555,67 @@ ext4_mb_use_preallocated(struct ext4_all
+@@ -3539,23 +3555,68 @@ ext4_mb_use_preallocated(struct ext4_all
}
/*
+ }
+
+ if (free != ext4_free_blks_count(sb, gdp)) {
-+ ext4_error(sb, __FUNCTION__, "on-disk bitmap for group %d"
++ ext4_error(sb, "on-disk bitmap for group %d"
+ "corrupted: %u blocks free in bitmap, %u - in gd\n",
+ group, free, ext4_free_blks_count(sb, gdp));
+ return -EIO;
+/*
* 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 void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-+static int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
+ static noinline_for_stack
+-void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
++int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
ext4_group_t group)
{
struct ext4_group_info *grp = ext4_get_group_info(sb, group);
/* all form of preallocation discards first load group,
* so the only competing code is preallocation use.
* we don't need any locking here
-@@ -3570,15 +3631,24 @@ static void ext4_mb_generate_from_pa(str
+@@ -3570,14 +3631,23 @@ static void ext4_mb_generate_from_pa(str
&groupnr, &start);
len = pa->pa_len;
spin_unlock(&pa->pa_lock);
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++;
}
+ if (count + skip != grp->bb_prealloc_nr) {
-+ ext4_error(sb, __FUNCTION__, "lost preallocations: "
++ ext4_error(sb, "lost preallocations: "
+ "count %d, bb_prealloc_nr %lu, skip %d\n",
+ count, grp->bb_prealloc_nr, skip);
+ return -EIO;
+ }
- mb_debug("prellocated %u for group %u\n", preallocated, group);
+ mb_debug(1, "prellocated %u for group %u\n", preallocated, group);
+ return 0;
}
}
@@ -4107,7 +4183,7 @@ repeat:
if (err) {
- ext4_error(sb, __func__, "Error in loading buddy "
- "information for %u", group);
+ ext4_error(sb, "Error loading buddy information for %u",
+ group);
- continue;
+ return;
}
===================================================================
--- linux-2.6.18-128.1.6.orig/fs/ext4/mballoc.h
+++ linux-2.6.18-128.1.6/fs/ext4/mballoc.h
+@@ -92,7 +92,7 @@
+ /*
+ * for which requests use 2^N search using buddies
+ */
+-#define MB_DEFAULT_ORDER2_REQS 2
++#define MB_DEFAULT_ORDER2_REQS 8
+
+ /*
+ * default group prealloc size 512 blocks
@@ -228,7 +229,7 @@ struct ext4_mb_history {
__u16 tail; /* what tail broke some buddy */
__u16 buddy; /* buddy the tail ^^^ broke */