public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: hmsjwzb <hmsjwzb@zoho.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: some help for improvement in btrfs
Date: Tue, 16 Aug 2022 13:38:04 +0800	[thread overview]
Message-ID: <7553372e-1485-63ae-d3f1-e9e0a318b2f6@gmx.com> (raw)
In-Reply-To: <4691b710-3d71-bd26-d00a-66cc398f57c5@zoho.com>



On 2022/8/16 10:47, hmsjwzb wrote:
> Hi Qu,
>
> Sorry for interrupt you so many times.
>
> As for
> 	scrub level checks at RAID56 substripe write time.
>
> Is this feature available in latest linux-next branch?

Nope, no one is working on that, thus no patches at all.

> Or may I need to get patches from mail list.
> What is the core function of this feature ?

The following small script would explain it pretty well:

   mkfs.btrfs -f -m raid5 -d raid5 -b 1G $dev1 $dev2 $dev3
   mount $dev1 $mnt

   xfs_io -f -c "pwrite -S 0xee 0 64K" $mnt/file1
   sync
   umount $mnt

   # Currupt data stripe 1 of full stripe of above 64K write
   xfs_io -f -c "pwrite -S 0xff 119865344 64K" $dev1

   mount $dev1 $mnt

   # Do a new write into data stripe 2,
   # We will trigger a RMW, which will use on-disk (corrupted) data to
   # generate new P/Q.
   xfs_io -f -c "pwrite -S 0xee 0 64K" -c sync $mnt/file2

   # Now we can no longer read file1, as its data is corrupted, and
   # above write generated new P/Q using corrupted data stripe 1,
   # preventing us to recover the data stripe 1.
   cat $mnt/file1 > /dev/null
   umount $mnt

Above script is the best way to demonstrate the "destructive RMW".
Although this is not btrfs specific (other RAID56 is also affected),
it's definitely a real problem.

There are several different directions to solve it:

- A way to add CSUM for P/Q stripes
   In theory this should be the easiest way implementation wise.
   We can easily know if a P/Q stripe is correct, then before doing
   RMW, we verify the result of P/Q.
   If the result doesn't match, we know some data stripe(s) are
   corrupted, then rebuild the data first before write.

   Unfortunately, this needs a on-disk format.

- Full stripe verification before writes
   This means, before we submit sub-stripe writes, we use some scrub like
   method to verify all data stripes first.
   Then we can do recovery if needed, then do writes.

   Unfortunately, scrub-like checks has quite some limitations.
   Regular scrub only works on RO block groups, thus extent tree and csum
   tree are consistent.
   But for RAID56 writes, we have no such luxury, I'm not 100% sure if
   this can even pass stress tests.

Thanks,
Qu

>
> I think I may use qemu and gdb to get basic understanding about this feature.
>
> Thanks,
> Flint
>
> On 8/15/22 04:54, Qu Wenruo wrote:
>> scrub level checks at RAID56 substripe write time.

       reply	other threads:[~2022-08-16  8:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fb056073-5bd6-6143-9699-4a5af1bd496d@zoho.com>
     [not found] ` <655f97cc-64e6-9f57-5394-58f9c3b83a6f@gmx.com>
     [not found]   ` <40b209eb-9048-da0c-e776-5e143ab38571@zoho.com>
     [not found]     ` <72a78cc 0-4524-47e7-803c-7d094b8713ee@gmx.com>
     [not found]     ` <72a78cc0-4524-47e7-803c-7d094b8713ee@gmx.com>
     [not found]       ` <00984321-3006-764d-c29e-1304f89652ae@zoho.com>
     [not found]         ` <18300547-1811-e9da-252e-f9476dca078c@gmx.com>
     [not found]           ` <4691b710-3d71-bd 26-d00a-66cc398f57c5@zoho.com>
     [not found]           ` <4691b710-3d71-bd26-d00a-66cc398f57c5@zoho.com>
2022-08-16  5:38             ` Qu Wenruo [this message]
2022-09-06  8:02               ` some help for improvement in btrfs hmsjwzb
2022-09-06  8:37                 ` Qu Wenruo
2022-09-07  8:24                   ` hmsjwzb
2022-09-07  8:46                     ` Qu Wenruo
2022-09-08  9:21                       ` hmsjwzb
2022-09-08  9:28                         ` Qu Wenruo
2022-09-06  8:59                 ` delete whole file system Kengo.M
2022-09-06  9:12                   ` Hugo Mills
2022-09-06 10:28                     ` Kengo.M

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=7553372e-1485-63ae-d3f1-e9e0a318b2f6@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=hmsjwzb@zoho.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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