* [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
@ 2025-06-14 3:39 Sun YangKai
2025-06-14 7:34 ` Qu Wenruo
2025-06-19 13:33 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Sun YangKai @ 2025-06-14 3:39 UTC (permalink / raw)
To: linux-btrfs; +Cc: 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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
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
2025-06-19 13:33 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2025-06-14 7:34 UTC (permalink / raw)
To: Sun YangKai, linux-btrfs
在 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) {
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
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
@ 2025-06-19 13:33 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2025-06-19 13:33 UTC (permalink / raw)
To: Sun YangKai; +Cc: linux-btrfs
On Sat, Jun 14, 2025 at 11:39:06AM +0800, Sun YangKai wrote:
> 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>
Added to for-next with some minor style adjustments, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-19 13:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2025-06-19 13:33 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox