From: Liu Bo <bo.li.liu@oracle.com>
To: Jan Schmidt <list.btrfs@jan-o-sch.net>
Cc: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/6] Btrfs: determine level of old roots
Date: Tue, 23 Oct 2012 23:31:29 +0800 [thread overview]
Message-ID: <5086B851.6020109@oracle.com> (raw)
In-Reply-To: <1351000527-24952-5-git-send-email-list.btrfs@jan-o-sch.net>
On 10/23/2012 09:55 PM, Jan Schmidt wrote:
> In btrfs_find_all_roots' termination condition, we compare the level of the
> old buffer we got from btrfs_search_old_slot to the level of the current
> root node. We'd better compare it to the level of the rewinded root node.
>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Tested-by: Liu Bo <bo.li.liu@oracle.com>
thanks,
liubo
> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
> ---
> fs/btrfs/backref.c | 4 +---
> fs/btrfs/ctree.c | 17 +++++++++++++++++
> fs/btrfs/ctree.h | 1 +
> 3 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
> index f318793..65608fb 100644
> --- a/fs/btrfs/backref.c
> +++ b/fs/btrfs/backref.c
> @@ -283,9 +283,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
> goto out;
> }
>
> - rcu_read_lock();
> - root_level = btrfs_header_level(root->node);
> - rcu_read_unlock();
> + root_level = btrfs_old_root_level(root, time_seq);
>
> if (root_level + 1 == level)
> goto out;
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index 1b60c56..7093ff5 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -1292,6 +1292,23 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
> return eb;
> }
>
> +int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq)
> +{
> + struct tree_mod_elem *tm;
> + int level;
> +
> + tm = __tree_mod_log_oldest_root(root->fs_info, root, time_seq);
> + if (tm && tm->op == MOD_LOG_ROOT_REPLACE) {
> + level = tm->old_root.level;
> + } else {
> + rcu_read_lock();
> + level = btrfs_header_level(root->node);
> + rcu_read_unlock();
> + }
> +
> + return level;
> +}
> +
> static inline int should_cow_block(struct btrfs_trans_handle *trans,
> struct btrfs_root *root,
> struct extent_buffer *buf)
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 1630be8..34c5a44 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3120,6 +3120,7 @@ static inline u64 btrfs_inc_tree_mod_seq(struct btrfs_fs_info *fs_info)
> {
> return atomic_inc_return(&fs_info->tree_mod_seq);
> }
> +int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq);
>
> /* root-item.c */
> int btrfs_find_root_ref(struct btrfs_root *tree_root,
>
next prev parent reply other threads:[~2012-10-23 15:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 13:55 [PATCH 0/6] Btrfs: tree mod log fixes for 3.7-rc3 Jan Schmidt
2012-10-23 13:55 ` [PATCH 1/6] Btrfs: don't put removals from push_node_left into tree mod log twice Jan Schmidt
2012-10-23 15:23 ` Liu Bo
2012-10-23 13:55 ` [PATCH 2/6] Btrfs: fix a tree mod logging issue for root replacement operations Jan Schmidt
2012-10-23 15:28 ` Liu Bo
2012-10-23 15:51 ` Jan Schmidt
2012-10-23 13:55 ` [PATCH 3/6] Btrfs: tree mod log's old roots could still be part of the tree Jan Schmidt
2012-10-23 15:30 ` Liu Bo
2012-10-24 9:55 ` Liu Bo
2012-10-24 10:45 ` [PATCH] Btrfs: drop locks before calling read_tree_block from get_old_root Jan Schmidt
2012-10-24 14:18 ` Liu Bo
2012-10-23 13:55 ` [PATCH 4/6] Btrfs: determine level of old roots Jan Schmidt
2012-10-23 15:31 ` Liu Bo [this message]
2012-10-23 13:55 ` [PATCH 5/6] Btrfs: fix extent buffer reference for tree mod log roots Jan Schmidt
2012-10-23 15:32 ` Liu Bo
2012-10-23 13:55 ` [PATCH 6/6] Btrfs: comment for loop in tree_mod_log_insert_move Jan Schmidt
2012-10-23 15:32 ` Liu Bo
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=5086B851.6020109@oracle.com \
--to=bo.li.liu@oracle.com \
--cc=chris.mason@fusionio.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=list.btrfs@jan-o-sch.net \
/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).