From: Sun YangKai <sunk67188@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Sun YangKai <sunk67188@gmail.com>
Subject: [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
Date: Sat, 14 Jun 2025 11:39:06 +0800 [thread overview]
Message-ID: <20250614033920.3874-1-sunk67188@gmail.com> (raw)
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>
---
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) {
--
2.49.0
next reply other threads:[~2025-06-14 3:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-14 3:39 Sun YangKai [this message]
2025-06-14 7:34 ` [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters Qu Wenruo
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=20250614033920.3874-1-sunk67188@gmail.com \
--to=sunk67188@gmail.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