From: Coly Li <i@coly.li>
To: linux-ext4@vger.kernel.org
Cc: Alex Tomas <alex@clusterfs.com>, Theodore Tso <tytso@google.com>
Subject: [PATCH 5/5] mballoc: don't change cpa if cur_distance is equal to new_distance
Date: Sun, 06 Feb 2011 12:54:18 +0800 [thread overview]
Message-ID: <4D4E297A.8090801@coly.li> (raw)
In ext4_mb_check_group_pa(), cur_distance is selected to return only
when it's smaller than new_distance, this is unreasonable. If
cur_distance is equal to new_distance, current code will return
new_distance to update cpa from ext4_mb_use_preallocated(), which doesn't
make any sense.
This patch makes new_distance to return only when it's smaller then
cur_distance, which avoids unnecessary cpa update in
ext4_mb_use_preallocated().
Signed-off-by: Coly Li <bosong.ly@taobao.com>
Cc: Alex Tomas <alex@clusterfs.com>
Cc: Theodore Tso <tytso@google.com>
---
fs/ext4/mballoc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 569cff6..af706f6 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3181,7 +3181,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 */
--
1.7.3.4
next reply other threads:[~2011-02-06 4:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-06 4:54 Coly Li [this message]
2011-02-24 19:10 ` [PATCH 5/5] mballoc: don't change cpa if cur_distance is equal to new_distance Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D4E297A.8090801@coly.li \
--to=i@coly.li \
--cc=alex@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).