aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorColy Li <colyli@gmail.com>2011-02-24 14:10:05 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-02-24 14:10:05 -0500
commit5a54b2f199fdf19533f96c3e285b70c6729e1e4a (patch)
treebf5b23a197b71349076558d2d985848451194bab /fs/ext4/mballoc.c
parent58696f3ab2b23fd6519189875fafdb5d1281eb54 (diff)
ext4: mballoc: don't replace the current preallocation group unnecessarily
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>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index b5235c8a2e78..66bee7274d6a 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3213,7 +3213,7 @@ ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
3213 cur_distance = abs(goal_block - cpa->pa_pstart); 3213 cur_distance = abs(goal_block - cpa->pa_pstart);
3214 new_distance = abs(goal_block - pa->pa_pstart); 3214 new_distance = abs(goal_block - pa->pa_pstart);
3215 3215
3216 if (cur_distance < new_distance) 3216 if (cur_distance <= new_distance)
3217 return cpa; 3217 return cpa;
3218 3218
3219 /* drop the previous reference */ 3219 /* drop the previous reference */