[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230915141133.GA2747@suse.cz>
Date: Fri, 15 Sep 2023 16:11:34 +0200
From: David Sterba <dsterba@...e.cz>
To: Qu Wenruo <quwenruo.btrfs@....com>
Cc: Johannes Thumshirn <johannes.thumshirn@....com>,
Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Christoph Hellwig <hch@....de>,
Naohiro Aota <naohiro.aota@....com>, Qu Wenruo <wqu@...e.com>,
Damien Le Moal <dlemoal@...nel.org>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 06/11] btrfs: implement RST version of scrub
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@....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.
Powered by blists - more mailing lists