linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: Adam Borowski <kilobyte@angband.pl>
Cc: Zoltan <zoltan1980@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: Is it safe to use btrfs on top of different types of devices?
Date: Wed, 18 Oct 2017 10:30:37 -0400	[thread overview]
Message-ID: <18794def-4e82-df32-82d3-27bd22c974d3@gmail.com> (raw)
In-Reply-To: <20171018115905.f5ndvyp5rcu4ykhv@angband.pl>

On 2017-10-18 07:59, Adam Borowski wrote:
> On Wed, Oct 18, 2017 at 07:30:55AM -0400, Austin S. Hemmelgarn wrote:
>> On 2017-10-17 16:21, Adam Borowski wrote:
>>>>> It's a single-device filesystem, thus disconnects are obviously fatal.  But,
>>>>> they never caused even a single bit of damage (as scrub goes), thus proving
>>>>> btrfs handles this kind of disconnects well.  Unlike times past, the kernel
>>>>> doesn't get confused thus no reboot is needed, merely an unmount, "service
>>>>> nbd-client restart", mount, restart the rebuild jobs.
>>>> That's expected behavior though.  _Single_ device BTRFS has nothing to get
>>>> out of sync most of the time, the only time there's any possibility of an
>>>> issue is when you die after writing the first copy of a block that's in a
>>>> dup profile chunk, but even that is not very likely to cause problems
>>>> (you'll just lose at most the last <commit-time> worth of data).
>>>
>>> How come?  In a DUP profile, the writes are: chunk 1, chunk2, barrier,
>>> superblock.  The two prior writes may be arbitrarily reordered -- both
>>> between each other or even individual sectors inside the chunks, but unless
>>> the disk lies about barriers, there's no way to have any corruption, thus
>>> running scrub is not needed.
>> If the device dies after writing chunk 1 but before the barrier, you end up
>> needing scrub.  How much of a failure window is present is largely a
>> function of how fast the device is, but there is a failure window there.
> 
> CoW is there to ensure there is _no_ failure window.  The new content
> doesn't matter until there are live pointers to it -- from the filesystem's
> point of view we merely scribbled something on an unused part of the block
> device.  Only after all pieces are in place (as ensured by the barrier), the
> superblock is updated with a reference to the new metadata->data chain.
Even with CoW there _IS_ a failure window.  At a bare minimum, when 
updating the root of the tree which has multiple copies, you have a 
failure window.  This window could admittedly be significantly reduced 
for multi-device setups if we actually parallelized writes properly, but 
it would still be there.
> 
> Thus, no matter when a disconnect happens, after a crash you get either
> uncorrupted old version or uncorrupted new version.
> 
> No scrub is ever needed for this reason on single device or on RAID1 that
> didn't run degraded.
The whole conversation started regarding a RAID1 array that's 
functionally guaranteed to run degraded on a regular basis.

  reply	other threads:[~2017-10-18 14:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-14 19:00 Is it safe to use btrfs on top of different types of devices? Zoltán Ivánfi
2017-10-15  0:19 ` Peter Grandi
2017-10-15  3:42 ` Duncan
2017-10-15  8:30 ` Zoltán Ivánfi
2017-10-15 12:05   ` Duncan
2017-10-16 11:53   ` Austin S. Hemmelgarn
2017-10-16 16:57     ` Zoltan
2017-10-16 17:27       ` Austin S. Hemmelgarn
2017-10-17  1:14         ` Adam Borowski
2017-10-17 11:26           ` Austin S. Hemmelgarn
2017-10-17 11:42             ` Zoltan
2017-10-17 12:40               ` Austin S. Hemmelgarn
2017-10-17 17:06                 ` Adam Borowski
2017-10-17 19:19                   ` Austin S. Hemmelgarn
2017-10-17 20:21                     ` Adam Borowski
2017-10-17 21:56                       ` Zoltán Ivánfi
2017-10-18  4:44                         ` Duncan
2017-10-18 14:07                         ` Peter Grandi
2017-10-18 11:30                       ` Austin S. Hemmelgarn
2017-10-18 11:59                         ` Adam Borowski
2017-10-18 14:30                           ` Austin S. Hemmelgarn [this message]
2017-10-18  4:50                     ` Duncan
2017-10-18 13:53               ` Peter Grandi
2017-10-18 14:30                 ` Austin S. Hemmelgarn
2017-10-19 11:01                   ` Peter Grandi
2017-10-19 12:32                     ` Austin S. Hemmelgarn
2017-10-19 18:39                       ` Peter Grandi
2017-10-20 11:53                         ` Austin S. Hemmelgarn
2017-10-19 13:48                     ` Zoltan
2017-10-19 14:27                       ` Austin S. Hemmelgarn
2017-10-19 14:42                         ` Zoltan
2017-10-19 15:07                           ` Austin S. Hemmelgarn
2017-10-19 18:00                         ` Peter Grandi
2017-10-19 17:56                       ` Peter Grandi
2017-10-19 18:59                         ` Peter Grandi

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=18794def-4e82-df32-82d3-27bd22c974d3@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=kilobyte@angband.pl \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zoltan1980@gmail.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).