From: Jan Kara <jack@suse.cz>
To: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>,
Theodore Ts'o <tytso@mit.edu>, Jan kara <jack@suse.cz>
Subject: Re: [PATCH 01/10 v5] ext4: refine extent status tree
Date: Fri, 8 Feb 2013 16:35:00 +0100 [thread overview]
Message-ID: <20130208153500.GA10226@quack.suse.cz> (raw)
In-Reply-To: <1360313046-9876-2-git-send-email-wenqing.lz@taobao.com>
On Fri 08-02-13 16:43:57, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> This commit refines the extent status tree code.
>
> 1) A prefix 'es_' is added to to the extent status tree structure
> members.
>
> 2) Refactored es_remove_extent() so that __es_remove_extent() can be
> used by es_insert_extent() to remove the old extent entry(-ies) before
> inserting a new one.
>
> 3) Rename extent_status_end() to ext4_es_end()
>
> 4) ext4_es_can_be_merged() is define to check whether two extents can
> be merged or not.
>
> 5) Update and clarified comments.
Just one minor comment below. Otherwise the patch looks good (although I
admit I didn't check all the renaming changes carefully. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Jan kara <jack@suse.cz>
> ---
> fs/ext4/extents.c | 21 +--
> fs/ext4/extents_status.c | 318 ++++++++++++++++++++++++--------------------
> fs/ext4/extents_status.h | 8 +-
> fs/ext4/file.c | 12 +-
> include/trace/events/ext4.h | 40 +++---
> 5 files changed, 217 insertions(+), 182 deletions(-)
>
> --- a/fs/ext4/extents_status.c
> +++ b/fs/ext4/extents_status.c
...
> @@ -320,60 +352,39 @@ ext4_es_try_to_merge_right(struct ext4_es_tree *tree, struct extent_status *es)
> return es;
> }
>
> -static int __es_insert_extent(struct ext4_es_tree *tree, ext4_lblk_t offset,
> - ext4_lblk_t len)
> +static int __es_insert_extent(struct ext4_es_tree *tree,
> + struct extent_status *newes)
> {
> struct rb_node **p = &tree->root.rb_node;
> struct rb_node *parent = NULL;
> struct extent_status *es;
> - ext4_lblk_t end = offset + len - 1;
> -
> - BUG_ON(end < offset);
> - es = tree->cache_es;
> - if (es && offset == (extent_status_end(es) + 1)) {
> - es_debug("cached by [%u/%u)\n", es->start, es->len);
> - es->len += len;
> - es = ext4_es_try_to_merge_right(tree, es);
> - goto out;
> - } else if (es && es->start == end + 1) {
> - es_debug("cached by [%u/%u)\n", es->start, es->len);
> - es->start = offset;
> - es->len += len;
> - es = ext4_es_try_to_merge_left(tree, es);
> - goto out;
> - } else if (es && es->start <= offset &&
> - end <= extent_status_end(es)) {
> - es_debug("cached by [%u/%u)\n", es->start, es->len);
> - goto out;
> - }
>
> while (*p) {
> parent = *p;
> es = rb_entry(parent, struct extent_status, rb_node);
>
> - if (offset < es->start) {
> - if (es->start == end + 1) {
> - es->start = offset;
> - es->len += len;
> + if (newes->es_lblk < es->es_lblk) {
> + if (ext4_es_can_be_merged(newes, es)) {
> + es->es_lblk = newes->es_lblk;
> + es->es_len += newes->es_len;
This is wrong, isn't it? You cannot change es->es_lblk because that can
break ordering of elements in the tree... thinking ... ah, it's OK because
you have non-overlapping intervals. But it deserves a comment I guess.
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2013-02-08 15:35 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 8:43 [PATCH 00/10 v5] ext4: extent status tree (step2) Zheng Liu
2013-02-08 8:43 ` [PATCH 01/10 v5] ext4: refine extent status tree Zheng Liu
2013-02-08 15:35 ` Jan Kara [this message]
2013-02-15 6:38 ` Zheng Liu
2013-02-08 8:43 ` [PATCH 02/10 v5] ext4: add physical block and status member into " Zheng Liu
2013-02-08 15:39 ` Jan Kara
2013-02-08 8:43 ` [PATCH 03/10 v5] ext4: let ext4_ext_map_blocks return EXT4_MAP_UNWRITTEN flag Zheng Liu
2013-02-08 15:41 ` Jan Kara
2013-02-08 8:44 ` [PATCH 04/10 v5] ext4: track all extent status in extent status tree Zheng Liu
2013-02-11 12:21 ` Jan Kara
2013-02-15 6:45 ` Zheng Liu
2013-02-13 3:28 ` Theodore Ts'o
2013-02-13 3:46 ` [PATCH 1/2] ext4: rename ext4_es_find_extent() to ext4_es_find_delayed_extent() Theodore Ts'o
2013-02-13 3:46 ` [PATCH 2/2] ext4: track all extent status in extent status tree Theodore Ts'o
2013-02-15 6:53 ` [PATCH 04/10 v5] " Zheng Liu
2013-02-17 16:26 ` Zheng Liu
2013-02-08 8:44 ` [PATCH 05/10 v5] ext4: lookup block mapping " Zheng Liu
2013-02-12 12:31 ` Jan Kara
2013-02-15 7:06 ` Zheng Liu
2013-02-15 16:47 ` Jan Kara
2013-02-15 17:25 ` Theodore Ts'o
2013-02-16 2:32 ` Zheng Liu
2013-02-16 16:18 ` Possible TODO projects for the map_blocks() code path (was: Re: [PATCH 05/10 v5] ext4: lookup block mapping in extent status tree) Theodore Ts'o
2013-02-17 3:15 ` Zheng Liu
2013-02-08 8:44 ` [PATCH 06/10 v5] ext4: remove single extent cache Zheng Liu
2013-02-08 8:44 ` [PATCH 07/10 v5] ext4: adjust some functions for reclaiming extents from extent status tree Zheng Liu
2013-02-08 8:44 ` [PATCH 08/10 v5] ext4: reclaim " Zheng Liu
2013-02-08 8:44 ` [PATCH 09/10 v5] ext4: convert unwritten extents from extent status tree in end_io Zheng Liu
2013-02-10 8:45 ` Zheng Liu
2013-02-11 1:52 ` Theodore Ts'o
2013-02-12 12:51 ` Jan Kara
2013-02-15 7:12 ` Zheng Liu
2013-02-08 8:44 ` [PATCH 10/10 v5] ext4: remove bogus wait for unwritten extents in ext4_ind_direct_IO Zheng Liu
2013-02-12 12:58 ` Jan Kara
2013-02-15 7:14 ` Zheng Liu
2013-02-10 1:38 ` [PATCH 00/10 v5] ext4: extent status tree (step2) Theodore Ts'o
2013-02-10 8:40 ` Zheng Liu
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=20130208153500.GA10226@quack.suse.cz \
--to=jack@suse.cz \
--cc=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqing.lz@taobao.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).