From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>,
Naohiro Aota <Naohiro.Aota@wdc.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: new scrub code vs zoned file systems
Date: Wed, 31 May 2023 13:25:14 +0000 [thread overview]
Message-ID: <821003e3-b457-90ba-e733-8c2fdd0c3b3c@wdc.com> (raw)
In-Reply-To: <20230531132032.GA30016@lst.de>
On 31.05.23 15:20, Christoph Hellwig wrote:
> On Wed, May 31, 2023 at 01:10:55PM +0000, Johannes Thumshirn wrote:
>> So it looks like we're calling btrfs_lookup_ordered_extent() with a NULL
>> inode.
>>
>> This actually makes sense as the current scrub code does not have an inode
>> in the bbio so:
>>
>> btrfs_simple_end_io(bio)
>> `-> btrfs_record_physical_zoned(btrfs_bio(bio))
>> `-> btrfs_lookup_ordered_extent(bbio->inode, ...)
>> `-> tree = &inode->ordered_tree;
>> spin_lock_irqsave(&tree->lock, flags); <--- BOOM
>>
>> We don't really need the inode in the zoned code, but the ordered_extent.
>>
>> I've just quickly skimmed over "add an ordered_extent pointer to struct
>> btrfs_bio v2" but didn't find anything that adds it for scrub writes as well.
>
> That is correct, but as far as I can tell it is just the symptom.
>
> The underlying issue is that the scrub code has no zone awareness at
> all, and just tries to rewrite sectors in place. The old code OTOH
> tried to always migrate the entire BG (aka zone).
>
Hmm at least flush_scrub_stripes() should not go into the simple write
path at all:
[...]
/*
* Submit the repaired sectors. For zoned case, we cannot do repair
* in-place, but queue the bg to be relocated.
*/
if (btrfs_is_zoned(fs_info)) {
for (int i = 0; i < nr_stripes; i++) {
stripe = &sctx->stripes[i];
if (!bitmap_empty(&stripe->error_bitmap, stripe->nr_sectors)) {
btrfs_repair_one_zone(fs_info,
sctx->stripes[0].bg->start);
break;
}
}
} else {
for (int i = 0; i < nr_stripes; i++) {
unsigned long repaired;
stripe = &sctx->stripes[i];
bitmap_andnot(&repaired, &stripe->init_error_bitmap,
&stripe->error_bitmap, stripe->nr_sectors);
scrub_write_sectors(sctx, stripe, repaired, false);
}
}
next prev parent reply other threads:[~2023-05-31 13:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 12:52 new scrub code vs zoned file systems Christoph Hellwig
2023-05-31 13:10 ` Johannes Thumshirn
2023-05-31 13:20 ` Christoph Hellwig
2023-05-31 13:25 ` Johannes Thumshirn [this message]
2023-05-31 13:30 ` Christoph Hellwig
2023-05-31 14:04 ` Johannes Thumshirn
2023-05-31 14:17 ` Christoph Hellwig
2023-06-01 2:09 ` Qu Wenruo
2023-06-01 4:40 ` Christoph Hellwig
2023-06-01 5:00 ` Qu Wenruo
2023-06-01 5:17 ` Naohiro Aota
2023-06-01 5:21 ` Naohiro Aota
2023-06-01 7:21 ` Qu Wenruo
2023-06-01 7:27 ` Christoph Hellwig
2023-06-01 8:46 ` Qu Wenruo
2023-06-01 5:22 ` Christoph Hellwig
2023-06-01 5:34 ` Christoph Hellwig
2023-06-01 5:45 ` Qu Wenruo
2023-06-01 5:47 ` Christoph Hellwig
2023-05-31 22:25 ` Qu Wenruo
2023-05-31 22:48 ` Qu Wenruo
2023-06-01 4:53 ` Christoph Hellwig
2023-06-01 5:04 ` 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=821003e3-b457-90ba-e733-8c2fdd0c3b3c@wdc.com \
--to=johannes.thumshirn@wdc.com \
--cc=Naohiro.Aota@wdc.com \
--cc=hch@lst.de \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.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