Re: [PATCH] btrfs: Use NULL in btrfs_search_slot as trans if we only want to search
From: Nikolay Borisov <hidden>
Date: 2021-07-21 12:37:08
On 20.07.21 г. 21:02, Marcos Paulo de Souza wrote:
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. Signed-off-by: Marcos Paulo de Souza <redacted>
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. Reviewed-by: Nikolay Borisov <redacted>
quoted hunk ↗ jump to hunk
--- fs/btrfs/backref.c | 2 +- fs/btrfs/extent-tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 7a8a2fc19533..0602c1cc7b62 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c@@ -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);diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d296483d148f..d8d5fb9fb77a 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c@@ -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;