Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@infradead.org>, Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PoC PATCH 00/11] btrfs: scrub: rework to get rid of the complex bio formshaping
Date: Tue, 6 Dec 2022 17:29:59 +0800	[thread overview]
Message-ID: <36b85b39-bd88-d374-cd55-a7eea62a1686@gmx.com> (raw)
In-Reply-To: <Y48ADI5Qa2Wt+/JR@infradead.org>



On 2022/12/6 16:40, Christoph Hellwig wrote:
> On Tue, Dec 06, 2022 at 04:23:27PM +0800, Qu Wenruo wrote:
>> TL;DR
>> The current scrub code is way too complex for future expansion.
>>
>> Current scrub code has a complex system to manage its in-flight bios.
> 
>  From my own ventures into that code I have to agree.
> 
>> This behavior is designed to improve scrub performance, but has a lot of
>> disadvantage too:
> 
> Just curious:  any idea how it was supposed to improve performance?
> Because the code does not actually look particularly optimized in terms
> of I/O patterns.

I'm not 100% sure, but my educated guess is, it's just merging bios.

- Merge physically adjacent read/writes into one scrub_bio
   This will mostly help RAID0/RAID10/RAID5 scrubbing.
   As although logically each stripe is only 64K, this allows scrub
   to assemble all read/writes into a larger bio instead always split
   them at stripe boundary.

   However the effectiveness should not be that huge, as the scrub_bio
   size is only slightly increased from 64K to 128K.

I'd argue that if the extents are all interleaved, then my 
always-read-64K behavior would be better.

> 
>> Furthermore, all work will done in a submit-and-wait fashion, reducing
>> the delayed calls/jumps to minimal.
> 
> I think even with this overall scheme we could do a bit of async
> state machine if needed.

Yes, the infrastructure is already here.

In raid56, we need to scrub the data stripes first.
In that case, scrub2_stripe_group is introduced, and use workqueue for 
each stripe to scrub.

So if later we determine the current read-64K-then-next behavior is not 
fast enough, we can use scrub2_stripe_group to run several stripes at once.

>  But then again scrube is not the main
> I/O fast path, so in doubt we can just throw more threads at the
> problem if that becomes too complicated.

Exactly.

I'd do some benchmark later to show the difference.

Thanks,
Qu

  reply	other threads:[~2022-12-06  9:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  8:23 [PoC PATCH 00/11] btrfs: scrub: rework to get rid of the complex bio formshaping Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 01/11] btrfs: scrub: introduce the structure for new BTRFS_STRIPE_LEN based interface Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 02/11] btrfs: scrub: introduce a helper to find and fill the sector info for a scrub2_stripe Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 03/11] btrfs: scrub: introduce a helper to verify one scrub2_stripe Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 04/11] btrfs: scrub: add the repair function for scrub2_stripe Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 05/11] btrfs: scrub: add a writeback helper " Qu Wenruo
2022-12-06  8:45   ` Christoph Hellwig
2022-12-06  8:23 ` [PoC PATCH 06/11] btrfs: scrub: add the error reporting " Qu Wenruo
2022-12-06 18:48   ` kernel test robot
2022-12-06  8:23 ` [PoC PATCH 07/11] btrfs: scrub: add raid56 P/Q scrubbing support Qu Wenruo
2022-12-27 10:45   ` kernel test robot
2022-12-06  8:23 ` [PoC PATCH 08/11] btrfs: scrub: use dedicated super block verification function to scrub one super block Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 09/11] btrfs: scrub: switch to the new scrub2_stripe based infrastructure Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 10/11] btrfs: scrub: cleanup the old scrub_parity infrastructure Qu Wenruo
2022-12-06  8:23 ` [PoC PATCH 11/11] btrfs: scrub: cleanup scrub_extent() and its related functions Qu Wenruo
2022-12-06  8:40 ` [PoC PATCH 00/11] btrfs: scrub: rework to get rid of the complex bio formshaping Christoph Hellwig
2022-12-06  9:29   ` Qu Wenruo [this message]
2022-12-13 22:08 ` Josef Bacik

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=36b85b39-bd88-d374-cd55-a7eea62a1686@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=hch@infradead.org \
    --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