btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
PATCH 1/1 btrfs: simplify btrfs_lookup_inode_extref() by removing unused parameters
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.
--- 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(-)
fs/btrfs/inode-item.c +3 -5
@@ -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 )
fs/btrfs/inode-item.h +1 -3
@@ -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,
fs/btrfs/tree-log.c +2 -3
@@ -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) {
Signature · 1 line
2.49.0
Quoted 11 lines · 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 usingtrans = NULL,ins_len = 0, andcow = 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 <[email protected]>
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
Quoted 68 lines
--- 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(-)fs/btrfs/inode-item.c +3
-5@@ -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 )fs/btrfs/inode-item.h +1
-3@@ -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,fs/btrfs/tree-log.c +2
-3@@ -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) {
Quoted 11 lines · 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 usingtrans = NULL,ins_len = 0, andcow = 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 <[email protected]>
Added to for-next with some minor style adjustments, thanks.