From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Record error in btree_csum_one_bio()
Date: Sat, 6 Apr 2019 09:15:57 +0300 [thread overview]
Message-ID: <e8b16a1b-5363-b025-3820-b5b97d338097@suse.com> (raw)
In-Reply-To: <20190406031346.22365-1-wqu@suse.com>
On 6.04.19 г. 6:13 ч., Qu Wenruo wrote:
> Since commit 6dc4f100c175 ("block: allow bio_for_each_segment_all() to
> iterate over multi-page bvec"), break will only break the inner loop of
> bio_for_each_segment_all(), unable to break the outer loop.
Breaking of outer loop should be implemented with a goto rather than
introducing a new variable.
>
> So here we add a new variable @err to record the first error we hit, and
> return the error, so that write time checker can work as designed.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> fs/btrfs/disk-io.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 6fe9197f6ee4..9e4d129bb649 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -832,18 +832,18 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)
> {
> struct bio_vec *bvec;
> struct btrfs_root *root;
> - int i, ret = 0;
> + int i, ret = 0, err = 0;
> struct bvec_iter_all iter_all;
>
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> bio_for_each_segment_all(bvec, bio, i, iter_all) {
> root = BTRFS_I(bvec->bv_page->mapping->host)->root;
> ret = csum_dirty_buffer(root->fs_info, bvec->bv_page);
> - if (ret)
> - break;
> + if (ret && !err)
> + err = ret;
> }
>
> - return errno_to_blk_status(ret);
> + return errno_to_blk_status(err);
> }
>
> static blk_status_t btree_submit_bio_start(void *private_data, struct bio *bio,
>
next prev parent reply other threads:[~2019-04-06 6:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-06 3:13 [PATCH] btrfs: Record error in btree_csum_one_bio() Qu Wenruo
2019-04-06 6:15 ` Nikolay Borisov [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-04-06 10:20 Qu Wenruo
2019-04-08 16:49 ` 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=e8b16a1b-5363-b025-3820-b5b97d338097@suse.com \
--to=nborisov@suse.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;
as well as URLs for NNTP newsgroup(s).