summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorColy Li <colyli@gmail.com>2011-02-24 22:10:05 +0300
committerTheodore Ts'o <tytso@mit.edu>2011-02-24 22:10:05 +0300
commit5a54b2f199fdf19533f96c3e285b70c6729e1e4a (patch)
treebf5b23a197b71349076558d2d985848451194bab /fs
parent58696f3ab2b23fd6519189875fafdb5d1281eb54 (diff)
downloadlinux-5a54b2f199fdf19533f96c3e285b70c6729e1e4a.tar.xz
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')
-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,
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 */