From: Qu Wenruo <wqu@suse.com>
To: socketpair@gmail.com, David Sterba <dsterba@suse.com>,
Chris Mason <mason@kernel.org>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] btrfs: raid56: pass REQ_META to per-device bios
Date: Sat, 7 Nov 2026 06:56:05 +1030 [thread overview]
Message-ID: <e29db0cb-2054-4894-958b-800d03ad4d79@suse.com> (raw)
In-Reply-To: <20261106-btrfs-sb-read-req-meta-v2-2-71c1afaf5c67@gmail.com>
在 2026/11/7 04:03, Mark Korenberg via B4 Relay 写道:
> From: Mark Korenberg <socketpair@gmail.com>
>
> RAID5/6 writes, and reads that need a rebuild, go through an rbio,
> which builds new per-device bios from a bare REQ_OP_READ or
> REQ_OP_WRITE. So all tree block writes on RAID5/6 lose REQ_META, while
> on the other profiles the per-device bios are clones and keep it. The
> same goes for a tree block read rebuilt from the other stripes, for
> example with a missing device.
>
> Pass REQ_META on to all per-device bios of an rbio, data and P/Q alike,
> if any bio it serves has it. Scrub and relocation do not set REQ_META,
> so their rbios stay untagged, as do rbios that only serve file data.
>
> Signed-off-by: Mark Korenberg <socketpair@gmail.com>
NACK.
One should not even use RAID56 for metadata chunks in the first place.
Nor we're any different from other RAID56 implementation.
> ---
> fs/btrfs/raid56.c | 14 +++++++++++---
> fs/btrfs/raid56.h | 7 +++++++
> 2 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index a8a8004bb14c..63b5acbf107e 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -1202,10 +1202,15 @@ static int rbio_add_io_paddrs(struct btrfs_raid_bio *rbio, struct bio_list *bio_
> }
> }
>
> - /* put a new bio on the list */
> + /*
> + * Put a new bio on the list. Every per-device bio, data and P/Q
> + * alike, serves the bios in rbio->bio_list, so it is metadata I/O if
> + * any of them is: a tree block write, or a tree block read rebuilt
> + * from the other stripes.
> + */
> bio = bio_alloc(stripe->dev->bdev,
> max(rbio->bioc->stripe_len >> PAGE_SHIFT, 1),
> - op, GFP_NOFS);
> + op | rbio->req_meta, GFP_NOFS);
> bio->bi_iter.bi_sector = disk_start >> SECTOR_SHIFT;
> bio->bi_private = rbio;
>
> @@ -1246,8 +1251,11 @@ static void index_rbio_pages(struct btrfs_raid_bio *rbio)
> struct bio *bio;
>
> spin_lock(&rbio->bio_list_lock);
> - bio_list_for_each(bio, &rbio->bio_list)
> + rbio->req_meta = 0;
> + bio_list_for_each(bio, &rbio->bio_list) {
> index_one_bio(rbio, bio);
> + rbio->req_meta |= bio->bi_opf & REQ_META;
> + }
>
> spin_unlock(&rbio->bio_list_lock);
> }
> diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
> index 8700910b8dc9..a5a0ff8e4a03 100644
> --- a/fs/btrfs/raid56.h
> +++ b/fs/btrfs/raid56.h
> @@ -139,6 +139,13 @@ struct btrfs_raid_bio {
> */
> enum btrfs_rbio_ops operation;
>
> + /*
> + * REQ_META if any bio in bio_list has it. Set under bio_list_lock by
> + * index_rbio_pages(), which runs before every assembly of per-device
> + * bios.
> + */
> + blk_opf_t req_meta;
> +
> /* How many pages there are for the full stripe including P/Q */
> u16 nr_pages;
>
>
prev parent reply other threads:[~2026-11-06 20:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 17:33 [PATCH v2 0/2] btrfs: tag tree block repair and RAID5/6 metadata I/O with REQ_META Mark Korenberg via B4 Relay
2026-11-06 17:33 ` [PATCH v2 1/2] btrfs: tag tree block repair writes " Mark Korenberg via B4 Relay
2026-11-06 20:31 ` Qu Wenruo
2026-11-06 17:33 ` [PATCH v2 2/2] btrfs: raid56: pass REQ_META to per-device bios Mark Korenberg via B4 Relay
2026-11-06 20:26 ` Qu Wenruo [this message]
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=e29db0cb-2054-4894-958b-800d03ad4d79@suse.com \
--to=wqu@suse.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=socketpair@gmail.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
all inboxes | Powered by JetHome®