From: Ted Ts'o <tytso@mit.edu>
To: Yongqiang Yang <xiaoqiangnk@gmail.com>
Cc: Robin Dong <hao.bigrat@gmail.com>,
linux-ext4@vger.kernel.org, Robin Dong <sanbai@taobao.com>
Subject: Re: [PATCH 2/2] ext4: avoid finding next leaf if newext->ee_block smaller than fex->ee_block
Date: Mon, 11 Jul 2011 15:52:11 -0400 [thread overview]
Message-ID: <20110711195211.GQ28763@thunk.org> (raw)
In-Reply-To: <BANLkTikeMA72P2-6eSv=2cqOtvEaHRbsZA@mail.gmail.com>
On Thu, Jun 30, 2011 at 04:42:31PM +0800, Yongqiang Yang wrote:
> How about:
> next = EXT_MAX_BLOCKS;
> if (le32_to_cpu(newext->ee_block) > le32_to_cpu(fex->ee_block)
> next = ext4_ext_next_leaf_block(inode, path);
> if (next != EXT_MAX_BLOCKS) {
Agreed, that's a better way of doing things. Also, Robin, please
compare and contrast your description with mine. The commit
description shouldn't just be a textual description of the change. It
should give the larger context of the change and why it's important.
- Ted
commit 2a3f7e0e0e55f8817fbe92d111ef2a06e6b8ef18
Author: Robin Dong <sanbai@taobao.com>
Date: Mon Jul 11 15:43:38 2011 -0400
ext4: avoid unneeded ext4_ext_next_leaf_block() while inserting extents
Optimize ext4_exT_insert_extent() by avoiding
ext4_ext_next_leaf_block() when the result is not used/needed.
Signed-off-by: Robin Dong <sanbai@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 9cbdcb2..f1c538e 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1730,9 +1730,10 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
/* probably next leaf has space for us? */
fex = EXT_LAST_EXTENT(eh);
- next = ext4_ext_next_leaf_block(inode, path);
- if (le32_to_cpu(newext->ee_block) > le32_to_cpu(fex->ee_block)
- && next != EXT_MAX_BLOCKS) {
+ next = EXT_MAX_BLOCKS;
+ if (le32_to_cpu(newext->ee_block) > le32_to_cpu(fex->ee_block))
+ next = ext4_ext_next_leaf_block(inode, path);
+ if (next != EXT_MAX_BLOCKS) {
ext_debug("next leaf block - %d\n", next);
BUG_ON(npath != NULL);
npath = ext4_ext_find_extent(inode, next, NULL);
next prev parent reply other threads:[~2011-07-11 19:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 8:03 [PATCH 1/2] ext4: remove redundant goto tag "repeat" Robin Dong
2011-06-30 8:03 ` [PATCH 2/2] ext4: avoid finding next leaf if newext->ee_block smaller than fex->ee_block Robin Dong
2011-06-30 8:42 ` Yongqiang Yang
2011-07-11 19:52 ` Ted Ts'o [this message]
2011-07-12 1:33 ` Robin Dong
2011-07-11 17:07 ` Ted Ts'o
2011-06-30 11:56 ` [PATCH 1/2] ext4: remove redundant goto tag "repeat" Lukas Czerner
2011-07-11 15:45 ` 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=20110711195211.GQ28763@thunk.org \
--to=tytso@mit.edu \
--cc=hao.bigrat@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sanbai@taobao.com \
--cc=xiaoqiangnk@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.