btrfs: Use NULL in btrfs_search_slot as trans if we only want to search
PATCH 1/1 btrfs: Use NULL in btrfs_search_slot as trans if we only want to search
Using a transaction in btrfs_search_slot is only useful when if are searching to add or modify the tree. When the function is only used for searching, insert length and mod arguments are 0, there is no need to use a transaction.
No functional changes, changing for consistency.
--- fs/btrfs/backref.c | 2 +- fs/btrfs/extent-tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/backref.c +1 -1
@@ -1211,7 +1211,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, again: head =NULL ; - ret =btrfs_search_slot (trans, fs_info->extent_root, &key, path,0 ,0 ); + ret =btrfs_search_slot (NULL , fs_info->extent_root, &key, path,0 ,0 );if (ret <0 ) goto out;BUG_ON (ret ==0 );
fs/btrfs/extent-tree.c +1 -1
@@ -153,7 +153,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,else key.type =BTRFS_EXTENT_ITEM_KEY ; - ret =btrfs_search_slot (trans, fs_info->extent_root, &key, path,0 ,0 ); + ret =btrfs_search_slot (NULL , fs_info->extent_root, &key, path,0 ,0 );if (ret <0 ) goto out_free;
Signature · 1 line
2.26.2
Quoted 8 lines · Marcos Paulo de Souza
Using a transaction in
btrfs_search_slotis only useful when if are searching to add or modify the tree. When the function is only used for searching, insert length and mod arguments are 0, there is no need to use a transaction.No functional changes, changing for consistency.
Signed-off-by Marcos Paulo de Souza <[email protected]>
Basically when cow is 0 and ins_len is also 0 then no paths which utilize a transaction are called so this patch is fine.
Quoted 32 lines
--- fs/btrfs/backref.c | 2 +- fs/btrfs/extent-tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)fs/btrfs/backref.c +1
-1@@ -1211,7 +1211,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, again: head =NULL ; - ret =btrfs_search_slot (trans, fs_info->extent_root, &key, path,0 ,0 ); + ret =btrfs_search_slot (NULL , fs_info->extent_root, &key, path,0 ,0 );if (ret <0 ) goto out;BUG_ON (ret ==0 );fs/btrfs/extent-tree.c +1
-1@@ -153,7 +153,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,else key.type =BTRFS_EXTENT_ITEM_KEY ; - ret =btrfs_search_slot (trans, fs_info->extent_root, &key, path,0 ,0 ); + ret =btrfs_search_slot (NULL , fs_info->extent_root, &key, path,0 ,0 );if (ret <0 ) goto out_free;
Quoted 8 lines · Nikolay Borisov
Quoted 5 lines · Marcos Paulo de Souza
Using a transaction in
btrfs_search_slotis only useful when if are searching to add or modify the tree. When the function is only used for searching, insert length and mod arguments are 0, there is no need to use a transaction.
Quoted 6 lines
Quoted 3 lines
No functional changes, changing for consistency.
Signed-off-by Marcos Paulo de Souza <[email protected]>Basically when cow is 0 and
ins_lenis also 0 then no paths which utilize a transaction are called so this patch is fine.
This sounds like a recipe for an assertion.
Quoted 8 lines · Marcos Paulo de Souza
Using a transaction in
btrfs_search_slotis only useful when if are searching to add or modify the tree. When the function is only used for searching, insert length and mod arguments are 0, there is no need to use a transaction.No functional changes, changing for consistency.
Signed-off-by Marcos Paulo de Souza <[email protected]>
Added to misc-next, thanks.