From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs: clean search for device item in finish sprout
Date: Wed, 21 Aug 2019 15:54:51 +0200 [thread overview]
Message-ID: <20190821135450.GE18575@twin.jikos.cz> (raw)
In-Reply-To: <20190821092634.6778-3-anand.jain@oracle.com>
On Wed, Aug 21, 2019 at 05:26:34PM +0800, Anand Jain wrote:
> No need to btrfs_item_key_to_cpu() as we continue to next leaf. Also keep
> the found_key and search key separate.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/volumes.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index a343aa9cf5ba..1db06894aee6 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2471,6 +2471,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
> struct extent_buffer *leaf;
> struct btrfs_dev_item *dev_item;
> struct btrfs_device *device;
> + struct btrfs_key found_key;
The declaration should be in the scope of use, ie. inside the while
loop.
> struct btrfs_key key;
> u8 fs_uuid[BTRFS_FSID_SIZE];
> u8 dev_uuid[BTRFS_UUID_SIZE];
> @@ -2498,15 +2499,13 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
> break;
> if (ret < 0)
> goto error;
> - leaf = path->nodes[0];
> - btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
> btrfs_release_path(path);
> continue;
> }
>
> - btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
> - if (key.objectid != BTRFS_DEV_ITEMS_OBJECTID ||
> - key.type != BTRFS_DEV_ITEM_KEY)
> + btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
> + if (found_key.objectid != BTRFS_DEV_ITEMS_OBJECTID ||
> + found_key.type != BTRFS_DEV_ITEM_KEY)
> break;
>
> dev_item = btrfs_item_ptr(leaf, path->slots[0],
> --
> 2.21.0 (Apple Git-120)
next prev parent reply other threads:[~2019-08-21 13:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 9:26 [PATCH 1/3] btrfs: dev stat drop useless goto Anand Jain
2019-08-21 9:26 ` [PATCH 2/3] btrfs: dev stats item key conversion per cpu type is not needed Anand Jain
2019-08-21 13:51 ` David Sterba
2019-08-21 9:26 ` [PATCH 3/3] btrfs: clean search for device item in finish sprout Anand Jain
2019-08-21 13:54 ` David Sterba [this message]
2019-08-21 14:01 ` David Sterba
2019-08-21 14:02 ` [PATCH 1/3] btrfs: dev stat drop useless goto David Sterba
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=20190821135450.GE18575@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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).