]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ext4: mballoc: don't replace the current preallocation group unnecessarily
authorColy Li <colyli@gmail.com>
Thu, 24 Feb 2011 19:10:05 +0000 (14:10 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 24 Feb 2011 19:10:05 +0000 (14:10 -0500)
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>
fs/ext4/mballoc.c

index b5235c8a2e78ca3b1111276a71cdff8e1fdb468c..66bee7274d6a8e8b5a1d2bcb4edfeff7d7df3014 100644 (file)
@@ -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 */