mirror of
https://github.com/torvalds/linux.git
synced 2024-11-08 13:11:45 +00:00
ext4: don't load the block bitmap for block groups which have no space
Add a short circuit check to ext4_mb_group_group() so that we don't bother to load the block bitmap for a block group which does not have any space available. (Or which does not have enough space until we are in desperation mode, i.e., when cr == 3.) Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=45741 Reported-by: mirek@me.com Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
ecb94f5fdf
commit
01fc48e892
@ -1862,6 +1862,12 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
|
|||||||
|
|
||||||
BUG_ON(cr < 0 || cr >= 4);
|
BUG_ON(cr < 0 || cr >= 4);
|
||||||
|
|
||||||
|
free = grp->bb_free;
|
||||||
|
if (free == 0)
|
||||||
|
return 0;
|
||||||
|
if (cr <= 2 && free < ac->ac_g_ex.fe_len)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* We only do this if the grp has never been initialized */
|
/* We only do this if the grp has never been initialized */
|
||||||
if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
|
if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
|
||||||
int ret = ext4_mb_init_group(ac->ac_sb, group);
|
int ret = ext4_mb_init_group(ac->ac_sb, group);
|
||||||
@ -1869,10 +1875,7 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
free = grp->bb_free;
|
|
||||||
fragments = grp->bb_fragments;
|
fragments = grp->bb_fragments;
|
||||||
if (free == 0)
|
|
||||||
return 0;
|
|
||||||
if (fragments == 0)
|
if (fragments == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user