From: Christoph Hellwig <hch@infradead.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>
Subject: Re: [PATCH v4 04/13] btrfs: introduce a new helper to submit write bio for scrub
Date: Sun, 26 Mar 2023 20:44:27 -0700 [thread overview]
Message-ID: <ZCERG/+o6515r06h@infradead.org> (raw)
In-Reply-To: <72f4fa26c35f2e649bc562a80a40955d745f1118.1679826088.git.wqu@suse.com>
On Sun, Mar 26, 2023 at 07:06:33PM +0800, Qu Wenruo wrote:
> + /* Caller should ensure the @bbio doesn't cross stripe boundary. */
> + ASSERT(map_length >= length);
> + if (btrfs_op(&bbio->bio) == BTRFS_MAP_WRITE && btrfs_is_zoned(fs_info)) {
> + bbio->bio.bi_opf &= ~REQ_OP_WRITE;
> + bbio->bio.bi_opf |= REQ_OP_ZONE_APPEND;
> + }
Not crossing the stripe boundary is not enough, for zone append it
also must not cross the zone append limit, which (at least in theory)
can be arbitrarily small.
> + if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
> + int data_stripes = (bioc->map_type & BTRFS_BLOCK_GROUP_RAID5) ?
> + bioc->num_stripes - 1 : bioc->num_stripes - 2;
This calculation feels like it should be in a well document simple
helper.
> + smap.physical = bioc->stripes[i].physical +
> + ((logical - bioc->full_stripe_logical) &
> + BTRFS_STRIPE_LEN_MASK);
This calculation feels like another candidate for a self contained
a well documented helper.
> + goto submit;
> + }
> + ASSERT(mirror_num <= bioc->num_stripes);
> + smap.dev = bioc->stripes[mirror_num - 1].dev;
> + smap.physical = bioc->stripes[mirror_num - 1].physical;
> +submit:
Why no else instead of the goto here? That would read a lot easier.
next prev parent reply other threads:[~2023-03-27 3:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 11:06 [PATCH v4 00/13] btrfs: scrub: use a more reader friendly code to implement scrub_simple_mirror() Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 01/13] btrfs: scrub: use dedicated super block verification function to scrub one super block Qu Wenruo
2023-03-27 3:41 ` Christoph Hellwig
2023-03-26 11:06 ` [PATCH v4 02/13] btrfs: introduce a new allocator for scrub specific btrfs_bio Qu Wenruo
2023-03-27 3:41 ` Christoph Hellwig
2023-03-26 11:06 ` [PATCH v4 03/13] btrfs: introduce a new helper to submit read bio for scrub Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 04/13] btrfs: introduce a new helper to submit write " Qu Wenruo
2023-03-27 3:44 ` Christoph Hellwig [this message]
2023-03-27 4:32 ` Qu Wenruo
2023-03-27 5:22 ` Christoph Hellwig
2023-03-27 7:52 ` Qu Wenruo
2023-03-27 18:02 ` Johannes Thumshirn
2023-03-26 11:06 ` [PATCH v4 05/13] btrfs: scrub: introduce the structure for new BTRFS_STRIPE_LEN based interface Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 06/13] btrfs: scrub: introduce a helper to find and fill the sector info for a scrub_stripe Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 07/13] btrfs: scrub: introduce a helper to verify one metadata Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 08/13] btrfs: scrub: introduce a helper to verify one scrub_stripe Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 09/13] btrfs: scrub: introduce the main read repair worker for scrub_stripe Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 10/13] btrfs: scrub: introduce a writeback helper " Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 11/13] btrfs: scrub: introduce error reporting functionality " Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 12/13] btrfs: scrub: introduce the helper to queue a stripe for scrub Qu Wenruo
2023-03-26 11:06 ` [PATCH v4 13/13] btrfs: scrub: switch scrub_simple_mirror() to scrub_stripe infrastructure Qu Wenruo
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=ZCERG/+o6515r06h@infradead.org \
--to=hch@infradead.org \
--cc=dsterba@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).