diff mbox series

btrfs: remove NULL transaction support for btrfs_lookup_extent_info()

Message ID 053ee6d9b396be679070a5540b3452ee6e11a7d6.1718695906.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: remove NULL transaction support for btrfs_lookup_extent_info() | expand

Commit Message

Filipe Manana June 18, 2024, 7:32 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

There are no callers of btrfs_lookup_extent_info() that pass a NULL value
for the transaction handle argument, so there's no point in having special
logic to deal with the NULL. The last caller that passed a NULL value was
removed in commit 19b546d7a1b2 ("btrfs: relocation:
Use btrfs_find_all_leafs to locate data extent parent tree leaves").

So remove the NULL handling from btrfs_lookup_extent_info().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/extent-tree.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Qu Wenruo June 18, 2024, 10:20 a.m. UTC | #1
在 2024/6/18 17:02, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> There are no callers of btrfs_lookup_extent_info() that pass a NULL value
> for the transaction handle argument, so there's no point in having special
> logic to deal with the NULL. The last caller that passed a NULL value was
> removed in commit 19b546d7a1b2 ("btrfs: relocation:
> Use btrfs_find_all_leafs to locate data extent parent tree leaves").
>
> So remove the NULL handling from btrfs_lookup_extent_info().
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/extent-tree.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 58a72a57414a..a52e52144fa2 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -126,11 +126,6 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
>   	if (!path)
>   		return -ENOMEM;
>
> -	if (!trans) {
> -		path->skip_locking = 1;
> -		path->search_commit_root = 1;
> -	}
> -
>   search_again:
>   	key.objectid = bytenr;
>   	key.offset = offset;
> @@ -186,9 +181,6 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
>   		ret = 0;
>   	}
>
> -	if (!trans)
> -		goto out;
> -
>   	delayed_refs = &trans->transaction->delayed_refs;
>   	spin_lock(&delayed_refs->lock);
>   	head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
> @@ -219,7 +211,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
>   		mutex_unlock(&head->mutex);
>   	}
>   	spin_unlock(&delayed_refs->lock);
> -out:
> +
>   	WARN_ON(num_refs == 0);
>   	if (refs)
>   		*refs = num_refs;
diff mbox series

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 58a72a57414a..a52e52144fa2 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -126,11 +126,6 @@  int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
 	if (!path)
 		return -ENOMEM;
 
-	if (!trans) {
-		path->skip_locking = 1;
-		path->search_commit_root = 1;
-	}
-
 search_again:
 	key.objectid = bytenr;
 	key.offset = offset;
@@ -186,9 +181,6 @@  int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
 		ret = 0;
 	}
 
-	if (!trans)
-		goto out;
-
 	delayed_refs = &trans->transaction->delayed_refs;
 	spin_lock(&delayed_refs->lock);
 	head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
@@ -219,7 +211,7 @@  int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
 		mutex_unlock(&head->mutex);
 	}
 	spin_unlock(&delayed_refs->lock);
-out:
+
 	WARN_ON(num_refs == 0);
 	if (refs)
 		*refs = num_refs;