public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 8/8] btrfs: remove redundant root argument from fixup_inode_link_count()
Date: Sat, 23 Sep 2023 07:41:19 +0930	[thread overview]
Message-ID: <ea74eb11-9a70-405f-b166-e1bf09abb58c@gmx.com> (raw)
In-Reply-To: <9bae05da75131701556cd6704cab663d10e2bb20.1695333082.git.fdmanana@suse.com>



On 2023/9/22 20:07, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> The root argument for fixup_inode_link_count() always matches the root of
> the given inode, so remove the root argument and get it from the inode
> argument. This also applies to the helpers count_inode_extrefs() and
> count_inode_refs() used by fixup_inode_link_count() - they don't need the
> root argument, as it always matches the root of the inode passed to them.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/tree-log.c | 20 +++++++++-----------
>   1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index a7bba3d61e55..f4257be56bd3 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -1482,8 +1482,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
>   	return ret;
>   }
>
> -static int count_inode_extrefs(struct btrfs_root *root,
> -		struct btrfs_inode *inode, struct btrfs_path *path)
> +static int count_inode_extrefs(struct btrfs_inode *inode, struct btrfs_path *path)
>   {
>   	int ret = 0;
>   	int name_len;
> @@ -1497,8 +1496,8 @@ static int count_inode_extrefs(struct btrfs_root *root,
>   	struct extent_buffer *leaf;
>
>   	while (1) {
> -		ret = btrfs_find_one_extref(root, inode_objectid, offset, path,
> -					    &extref, &offset);
> +		ret = btrfs_find_one_extref(inode->root, inode_objectid, offset,
> +					    path, &extref, &offset);
>   		if (ret)
>   			break;
>
> @@ -1526,8 +1525,7 @@ static int count_inode_extrefs(struct btrfs_root *root,
>   	return nlink;
>   }
>
> -static int count_inode_refs(struct btrfs_root *root,
> -			struct btrfs_inode *inode, struct btrfs_path *path)
> +static int count_inode_refs(struct btrfs_inode *inode, struct btrfs_path *path)
>   {
>   	int ret;
>   	struct btrfs_key key;
> @@ -1542,7 +1540,7 @@ static int count_inode_refs(struct btrfs_root *root,
>   	key.offset = (u64)-1;
>
>   	while (1) {
> -		ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
> +		ret = btrfs_search_slot(NULL, inode->root, &key, path, 0, 0);
>   		if (ret < 0)
>   			break;
>   		if (ret > 0) {
> @@ -1594,9 +1592,9 @@ static int count_inode_refs(struct btrfs_root *root,
>    * will free the inode.
>    */
>   static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
> -					   struct btrfs_root *root,
>   					   struct inode *inode)
>   {
> +	struct btrfs_root *root = BTRFS_I(inode)->root;
>   	struct btrfs_path *path;
>   	int ret;
>   	u64 nlink = 0;
> @@ -1606,13 +1604,13 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
>   	if (!path)
>   		return -ENOMEM;
>
> -	ret = count_inode_refs(root, BTRFS_I(inode), path);
> +	ret = count_inode_refs(BTRFS_I(inode), path);
>   	if (ret < 0)
>   		goto out;
>
>   	nlink = ret;
>
> -	ret = count_inode_extrefs(root, BTRFS_I(inode), path);
> +	ret = count_inode_extrefs(BTRFS_I(inode), path);
>   	if (ret < 0)
>   		goto out;
>
> @@ -1684,7 +1682,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
>   			break;
>   		}
>
> -		ret = fixup_inode_link_count(trans, root, inode);
> +		ret = fixup_inode_link_count(trans, inode);
>   		iput(inode);
>   		if (ret)
>   			break;

  reply	other threads:[~2023-09-22 22:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 10:37 [PATCH 0/8] btrfs: some cleanups around inode update and helpers fdmanana
2023-09-22 10:37 ` [PATCH 1/8] btrfs: simplify error check condition at btrfs_dirty_inode() fdmanana
2023-09-22 22:00   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 2/8] btrfs: remove noline from btrfs_update_inode() fdmanana
2023-09-22 22:00   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 3/8] btrfs: remove redundant root argument from btrfs_update_inode_fallback() fdmanana
2023-09-22 10:37 ` [PATCH 4/8] btrfs: remove redundant root argument from btrfs_update_inode() fdmanana
2023-09-22 22:04   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 5/8] btrfs: remove redundant root argument from btrfs_update_inode_item() fdmanana
2023-09-22 22:06   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 6/8] btrfs: remove redundant root argument from btrfs_delayed_update_inode() fdmanana
2023-09-22 22:08   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 7/8] btrfs: remove redundant root argument from maybe_insert_hole() fdmanana
2023-09-22 22:09   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 8/8] btrfs: remove redundant root argument from fixup_inode_link_count() fdmanana
2023-09-22 22:11   ` Qu Wenruo [this message]
2023-09-22 13:48 ` [PATCH 0/8] btrfs: some cleanups around inode update and helpers 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=ea74eb11-9a70-405f-b166-e1bf09abb58c@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=fdmanana@kernel.org \
    --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