From 2d8344658951da34d78fa0dfaa257c2fa9e73326 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 16 Mar 2009 23:25:40 -0400 Subject: [PATCH] --- yaml --- r: 132435 b: refs/heads/master c: d33a1976fbee1ee321d6f014333d8f03a39d526c h: refs/heads/master i: 132433: 3c59882398c2f70f36d812cfaaf42b6a02030ae6 132431: 0d8e57ed32ce37f901d1962d344a8e39f8e489d6 v: v3 --- [refs] | 2 +- trunk/fs/ext4/mballoc.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 6ef6a1636265..f0f67c9c5c34 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8d03c7a0c550e7ab24cadcef5e66656bfadec8b9 +refs/heads/master: d33a1976fbee1ee321d6f014333d8f03a39d526c diff --git a/trunk/fs/ext4/mballoc.c b/trunk/fs/ext4/mballoc.c index 41f4348b62f5..9f61e62f435f 100644 --- a/trunk/fs/ext4/mballoc.c +++ b/trunk/fs/ext4/mballoc.c @@ -3589,6 +3589,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac, struct super_block *sb, struct ext4_prealloc_space *pa) { ext4_group_t grp; + ext4_fsblk_t grp_blk; if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0) return; @@ -3603,8 +3604,12 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac, pa->pa_deleted = 1; spin_unlock(&pa->pa_lock); - /* -1 is to protect from crossing allocation group */ - ext4_get_group_no_and_offset(sb, pa->pa_pstart - 1, &grp, NULL); + grp_blk = pa->pa_pstart; + /* If linear, pa_pstart may be in the next group when pa is used up */ + if (pa->pa_linear) + grp_blk--; + + ext4_get_group_no_and_offset(sb, grp_blk, &grp, NULL); /* * possible race: