From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Sun YangKai <sunk67188@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
Date: Sat, 14 Jun 2025 17:04:35 +0930 [thread overview]
Message-ID: <bc326ef2-9808-4be3-8ccb-2ad7bd3b3db7@gmx.com> (raw)
In-Reply-To: <20250614033920.3874-1-sunk67188@gmail.com>
在 2025/6/14 13:09, Sun YangKai 写道:
> The `btrfs_lookup_inode_extref()` function no longer requires transaction
> handle, insert length, or COW flag, as the onlycaller now perform a
> read-only lookup using `trans = NULL`, `ins_len = 0`, and `cow = 0`.
>
> This patch removes the unused parameters from the function signature and
> call sites, simplifying the interface and clarifying its current usage as
> a read-only lookup helper.
>
> No functional changes intended.
>
> Signed-off-by: Sun YangKai <sunk67188@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
This function is introduced in the early days where extref feature is
introduced by commit f186373fef00 ("btrfs: extended inode refs").
Then some cleanup is done in commit 33b98f227111 ("btrfs: cleanup:
removed unused 'btrfs_get_inode_ref_index'"), which removed the only
caller passing trans and other COW specific options.
Thanks,
Qu
> ---
> fs/btrfs/inode-item.c | 8 +++-----
> fs/btrfs/inode-item.h | 4 +---
> fs/btrfs/tree-log.c | 5 ++---
> 3 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
> index a61c3540d67b..a35abe10de64 100644
> --- a/fs/btrfs/inode-item.c
> +++ b/fs/btrfs/inode-item.c
> @@ -79,12 +79,10 @@ struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
>
> /* Returns NULL if no extref found */
> struct btrfs_inode_extref *
> -btrfs_lookup_inode_extref(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root,
> +btrfs_lookup_inode_extref(struct btrfs_root *root,
> struct btrfs_path *path,
> const struct fscrypt_str *name,
> - u64 inode_objectid, u64 ref_objectid, int ins_len,
> - int cow)
> + u64 inode_objectid, u64 ref_objectid)
> {
> int ret;
> struct btrfs_key key;
> @@ -93,7 +91,7 @@ btrfs_lookup_inode_extref(struct btrfs_trans_handle *trans,
> key.type = BTRFS_INODE_EXTREF_KEY;
> key.offset = btrfs_extref_hash(ref_objectid, name->name, name->len);
>
> - ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
> + ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
> if (ret < 0)
> return ERR_PTR(ret);
> if (ret > 0)
> diff --git a/fs/btrfs/inode-item.h b/fs/btrfs/inode-item.h
> index c11b97fdccc4..c57661bdde30 100644
> --- a/fs/btrfs/inode-item.h
> +++ b/fs/btrfs/inode-item.h
> @@ -102,12 +102,10 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans,
> struct btrfs_key *location, int mod);
>
> struct btrfs_inode_extref *btrfs_lookup_inode_extref(
> - struct btrfs_trans_handle *trans,
> struct btrfs_root *root,
> struct btrfs_path *path,
> const struct fscrypt_str *name,
> - u64 inode_objectid, u64 ref_objectid, int ins_len,
> - int cow);
> + u64 inode_objectid, u64 ref_objectid);
>
> struct btrfs_inode_ref *btrfs_find_name_in_backref(const struct extent_buffer *leaf,
> int slot,
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 97e933113b82..66fff2bc60f3 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -1125,9 +1125,8 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
> btrfs_release_path(path);
>
> /* Same search but for extended refs */
> - extref = btrfs_lookup_inode_extref(NULL, root, path, name,
> - inode_objectid, parent_objectid, 0,
> - 0);
> + extref = btrfs_lookup_inode_extref(root, path, name,
> + inode_objectid, parent_objectid);
> if (IS_ERR(extref)) {
> return PTR_ERR(extref);
> } else if (extref) {
next prev parent reply other threads:[~2025-06-14 7:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-14 3:39 [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters Sun YangKai
2025-06-14 7:34 ` Qu Wenruo [this message]
2025-06-19 13:33 ` 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=bc326ef2-9808-4be3-8ccb-2ad7bd3b3db7@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sunk67188@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox