linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Christoph Hellwig <hch@lst.de>,
	Naohiro Aota <naohiro.aota@wdc.com>, Qu Wenruo <wqu@suse.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 06/11] btrfs: implement RST version of scrub
Date: Fri, 15 Sep 2023 16:11:34 +0200	[thread overview]
Message-ID: <20230915141133.GA2747@suse.cz> (raw)
In-Reply-To: <33f4c547-65bc-4523-b1c0-bae0c7ad1e65@gmx.com>

On Fri, Sep 15, 2023 at 10:28:50AM +0930, Qu Wenruo wrote:
> 
> 
> On 2023/9/15 01:37, Johannes Thumshirn wrote:
> > A filesystem that uses the RAID stripe tree for logical to physical
> > address translation can't use the regular scrub path, that reads all
> > stripes and then checks if a sector is unused afterwards.
> >
> > When using the RAID stripe tree, this will result in lookup errors, as the
> > stripe tree doesn't know the requested logical addresses.
> >
> > Instead, look up stripes that are backed by the extent bitmap.
> >
> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> > ---
> >   fs/btrfs/bio.c              |  2 ++
> >   fs/btrfs/raid-stripe-tree.c |  8 ++++++-
> >   fs/btrfs/scrub.c            | 53 +++++++++++++++++++++++++++++++++++++++++++++
> >   fs/btrfs/volumes.h          |  1 +
> >   4 files changed, 63 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
> > index ddbe6f8d4ea2..bdb6e3effdbb 100644
> > --- a/fs/btrfs/bio.c
> > +++ b/fs/btrfs/bio.c
> > @@ -663,6 +663,8 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
> >   	blk_status_t ret;
> >   	int error;
> >
> > +	smap.is_scrub = !bbio->inode;
> > +
> >   	btrfs_bio_counter_inc_blocked(fs_info);
> >   	error = btrfs_map_block(fs_info, btrfs_op(bio), logical, &map_length,
> >   				&bioc, &smap, &mirror_num, 1);
> > diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c
> > index 697a6e1fd255..63bf62c33436 100644
> > --- a/fs/btrfs/raid-stripe-tree.c
> > +++ b/fs/btrfs/raid-stripe-tree.c
> > @@ -334,6 +334,11 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info,
> >   	if (!path)
> >   		return -ENOMEM;
> >
> > +	if (stripe->is_scrub) {
> > +		path->skip_locking = 1;
> > +		path->search_commit_root = 1;
> > +	}
> > +
> >   	ret = btrfs_search_slot(NULL, stripe_root, &stripe_key, path, 0, 0);
> >   	if (ret < 0)
> >   		goto free_path;
> > @@ -420,7 +425,8 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info,
> >   out:
> >   	if (ret > 0)
> >   		ret = -ENOENT;
> > -	if (ret && ret != -EIO) {
> > +	if (ret && ret != -EIO && !stripe->is_scrub) {
> > +
> 
> One extra newline.

There were way more stray newlines, you don't have to point that out
in reviews, I fix them once we have version that would not change too
much.

  reply	other threads:[~2023-09-15 14:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 16:06 [PATCH v9 00/11] btrfs: introduce RAID stripe tree Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 01/11] btrfs: add raid stripe tree definitions Johannes Thumshirn
2023-09-15  0:22   ` Qu Wenruo
2023-09-15  0:26     ` Qu Wenruo
2023-09-15  9:55       ` Johannes Thumshirn
2023-09-15 10:33         ` Qu Wenruo
2023-09-15 10:46           ` Johannes Thumshirn
2023-10-02  9:32           ` Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 02/11] btrfs: read raid-stripe-tree from disk Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 03/11] btrfs: add support for inserting raid stripe extents Johannes Thumshirn
2023-09-14 18:07   ` David Sterba
2023-09-15 10:03     ` Geert Uytterhoeven
2023-09-14 18:10   ` David Sterba
2023-09-15  0:55   ` Qu Wenruo
2023-09-19 12:13     ` Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 04/11] btrfs: delete stripe extent on extent deletion Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 05/11] btrfs: lookup physical address from stripe extent Johannes Thumshirn
2023-09-14 17:57   ` David Sterba
2023-09-14 16:07 ` [PATCH v9 06/11] btrfs: implement RST version of scrub Johannes Thumshirn
2023-09-15  0:58   ` Qu Wenruo
2023-09-15 14:11     ` David Sterba [this message]
2023-09-14 16:07 ` [PATCH v9 07/11] btrfs: zoned: allow zoned RAID Johannes Thumshirn
2023-09-14 17:59   ` David Sterba
2023-09-14 16:07 ` [PATCH v9 08/11] btrfs: add raid stripe tree pretty printer Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 09/11] btrfs: announce presence of raid-stripe-tree in sysfs Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 10/11] btrfs: add trace events for RST Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 11/11] btrfs: add raid-stripe-tree to features enabled with debug Johannes Thumshirn
2023-09-14 18:25 ` [PATCH v9 00/11] btrfs: introduce RAID stripe tree David Sterba
2023-09-20 16:23   ` 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=20230915141133.GA2747@suse.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dlemoal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=quwenruo.btrfs@gmx.com \
    --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).