Skip to content

Commit

Permalink
ext4: mballoc: don't replace the current preallocation group unnecess…
Browse files Browse the repository at this point in the history
…arily

In ext4_mb_check_group_pa(), the current preallocation space is
replaced with a new preallocation space when the two have the same
distance from the goal block.

This doesn't actually gain us anything, so change things so that the
function only switches to the new preallocation group if its distance
from the goal block is strictly smaller than the current preallocaiton
group's distance from the goal block.

Signed-off-by: Coly Li <bosong.ly@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Coly Li authored and Theodore Ts'o committed Feb 24, 2011
1 parent 58696f3 commit 5a54b2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3213,7 +3213,7 @@ ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
cur_distance = abs(goal_block - cpa->pa_pstart);
new_distance = abs(goal_block - pa->pa_pstart);

if (cur_distance < new_distance)
if (cur_distance <= new_distance)
return cpa;

/* drop the previous reference */
Expand Down

0 comments on commit 5a54b2f

Please sign in to comment.