diff mbox series

btrfs: avoid unnecessary bio dereference at run_one_async_done()

Message ID f0e1ad9fd2ed3e76e041e3f19f493de3e9771057.1741278026.git.fdmanana@suse.com (mailing list archive)
State New
Headers show
Series btrfs: avoid unnecessary bio dereference at run_one_async_done() | expand

Commit Message

Filipe Manana March 6, 2025, 4:21 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

We have dereferenced the async_submit_bio structure and extracted the bio
pointer into a local variable, so there's no need to dereference it again
when calling btrfs_bio_end_io(). Just use "bio->bi_status" instead of the
longer expression "async->bbio->bio.bi_status".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba March 6, 2025, 6:33 p.m. UTC | #1
On Thu, Mar 06, 2025 at 04:21:06PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> We have dereferenced the async_submit_bio structure and extracted the bio
> pointer into a local variable, so there's no need to dereference it again
> when calling btrfs_bio_end_io(). Just use "bio->bi_status" instead of the
> longer expression "async->bbio->bio.bi_status".
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
Qu Wenruo March 6, 2025, 9:44 p.m. UTC | #2
在 2025/3/7 02:51, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> We have dereferenced the async_submit_bio structure and extracted the bio
> pointer into a local variable, so there's no need to dereference it again
> when calling btrfs_bio_end_io(). Just use "bio->bi_status" instead of the
> longer expression "async->bbio->bio.bi_status".
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

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

Thanks,
Qu

> ---
>   fs/btrfs/bio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
> index 375cae2fbcad..8c2eee1f1878 100644
> --- a/fs/btrfs/bio.c
> +++ b/fs/btrfs/bio.c
> @@ -573,7 +573,7 @@ static void run_one_async_done(struct btrfs_work *work, bool do_free)
>
>   	/* If an error occurred we just want to clean up the bio and move on. */
>   	if (bio->bi_status) {
> -		btrfs_bio_end_io(async->bbio, async->bbio->bio.bi_status);
> +		btrfs_bio_end_io(async->bbio, bio->bi_status);
>   		return;
>   	}
>
diff mbox series

Patch

diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index 375cae2fbcad..8c2eee1f1878 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -573,7 +573,7 @@  static void run_one_async_done(struct btrfs_work *work, bool do_free)
 
 	/* If an error occurred we just want to clean up the bio and move on. */
 	if (bio->bi_status) {
-		btrfs_bio_end_io(async->bbio, async->bbio->bio.bi_status);
+		btrfs_bio_end_io(async->bbio, bio->bi_status);
 		return;
 	}