Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163677
b: refs/heads/master
c: f41c075
h: refs/heads/master
i:
  163675: 42060d5
v: v3
  • Loading branch information
Aneesh Kumar K.V authored and Theodore Ts'o committed Sep 10, 2009
1 parent c3acd40 commit 56684fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b6a758ec3af3ec236dbfdcf6a06b84ac8f94957e
refs/heads/master: f41c0750538667b87a19c93952e5d42fcc069bd7
39 changes: 18 additions & 21 deletions trunk/fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,26 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
* groups mapped by the page is blocked
* till we are done with allocation
*/
repeat_load_buddy:
down_read(e4b->alloc_semp);

if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
/* we need to check for group need init flag
* with alloc_semp held so that we can be sure
* that new blocks didn't get added to the group
* when we are loading the buddy cache
*/
up_read(e4b->alloc_semp);
/*
* we need full data about the group
* to make a good selection
*/
ret = ext4_mb_init_group(sb, group);
if (ret)
return ret;
goto repeat_load_buddy;
}

/*
* the buddy cache inode stores the block bitmap
* and buddy information in consecutive blocks.
Expand Down Expand Up @@ -2012,27 +2030,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
if (grp->bb_free == 0)
continue;

/*
* if the group is already init we check whether it is
* a good group and if not we don't load the buddy
*/
if (EXT4_MB_GRP_NEED_INIT(grp)) {
/*
* we need full data about the group
* to make a good selection
*/
err = ext4_mb_init_group(sb, group);
if (err)
goto out;
}

/*
* If the particular group doesn't satisfy our
* criteria we continue with the next group
*/
if (!ext4_mb_good_group(ac, group, cr))
continue;

err = ext4_mb_load_buddy(sb, group, &e4b);
if (err)
goto out;
Expand Down

0 comments on commit 56684fd

Please sign in to comment.