Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@lst.de>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/5] btrfs: do not return errors from btrfs_submit_metadata_bio
Date: Sat, 16 Apr 2022 06:40:41 +0800	[thread overview]
Message-ID: <6ff6b834-d916-43b3-aa58-b6f7512682c2@gmx.com> (raw)
In-Reply-To: <20220415143328.349010-4-hch@lst.de>



On 2022/4/15 22:33, Christoph Hellwig wrote:
> btrfs_submit_metadata_bio already calls ->bi_end_io on error and the
> caller must ignore the return value, so remove it.

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

I think your cleanup is doing the first step towards a proper defined
behavior on how we should handle bios: just fire and forget.

Thanks,
Qu
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   fs/btrfs/disk-io.c | 26 ++++++++++----------------
>   fs/btrfs/disk-io.h |  4 ++--
>   2 files changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 28b9cf020b8df..9c488224edc73 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -920,8 +920,8 @@ static bool should_async_write(struct btrfs_fs_info *fs_info,
>   	return true;
>   }
>
> -blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
> -				       int mirror_num)
> +void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
> +			       int mirror_num)
>   {
>   	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
>   	blk_status_t ret;
> @@ -933,14 +933,12 @@ blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
>   		 */
>   		ret = btrfs_bio_wq_end_io(fs_info, bio,
>   					  BTRFS_WQ_ENDIO_METADATA);
> -		if (ret)
> -			goto out_w_error;
> -		ret = btrfs_map_bio(fs_info, bio, mirror_num);
> +		if (!ret)
> +			ret = btrfs_map_bio(fs_info, bio, mirror_num);
>   	} else if (!should_async_write(fs_info, BTRFS_I(inode))) {
>   		ret = btree_csum_one_bio(bio);
> -		if (ret)
> -			goto out_w_error;
> -		ret = btrfs_map_bio(fs_info, bio, mirror_num);
> +		if (!ret)
> +			ret = btrfs_map_bio(fs_info, bio, mirror_num);
>   	} else {
>   		/*
>   		 * kthread helpers are used to submit writes so that
> @@ -950,14 +948,10 @@ blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
>   					  0, btree_submit_bio_start);
>   	}
>
> -	if (ret)
> -		goto out_w_error;
> -	return 0;
> -
> -out_w_error:
> -	bio->bi_status = ret;
> -	bio_endio(bio);
> -	return ret;
> +	if (ret) {
> +		bio->bi_status = ret;
> +		bio_endio(bio);
> +	}
>   }
>
>   #ifdef CONFIG_MIGRATION
> diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
> index 56607abe75aa4..1312d93c02edb 100644
> --- a/fs/btrfs/disk-io.h
> +++ b/fs/btrfs/disk-io.h
> @@ -87,8 +87,8 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
>   int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
>   				   struct page *page, u64 start, u64 end,
>   				   int mirror);
> -blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
> -				       int mirror_num);
> +void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
> +			       int mirror_num);
>   #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
>   struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info);
>   #endif

  reply	other threads:[~2022-04-15 22:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 14:33 minor bio submission cleanups Christoph Hellwig
2022-04-15 14:33 ` [PATCH 1/5] btrfs: move btrfs_readpage to extent_io.c Christoph Hellwig
2022-04-15 14:33 ` [PATCH 2/5] btrfs: remove the unused bio_flags argument to btrfs_submit_metadata_bio Christoph Hellwig
2022-04-15 22:35   ` Qu Wenruo
2022-04-15 14:33 ` [PATCH 3/5] btrfs: do not return errors from btrfs_submit_metadata_bio Christoph Hellwig
2022-04-15 22:40   ` Qu Wenruo [this message]
2022-04-15 14:33 ` [PATCH 4/5] btrfs: do not return errors from btrfs_submit_compressed_read Christoph Hellwig
2022-04-15 22:48   ` Qu Wenruo
2022-04-16  4:49     ` Christoph Hellwig
2022-04-16  6:48       ` Qu Wenruo
2022-04-20 20:45       ` David Sterba
2022-04-15 14:33 ` [PATCH 5/5] btrfs: do not return errors from submit_bio_hook_t instances Christoph Hellwig
2022-04-15 22:49   ` Qu Wenruo
2022-04-15 22:44 ` minor bio submission cleanups Qu Wenruo
2022-04-16  4:46   ` Christoph Hellwig
2022-04-18  7:23 ` Nikolay Borisov
2022-04-20 19:28 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ff6b834-d916-43b3-aa58-b6f7512682c2@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox