linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Murphy <lists@colorremedies.com>
To: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
Cc: Chris Murphy <lists@colorremedies.com>,
	Hendrik Friedel <hendrik@friedels.name>,
	Tomasz Kusmierz <tom.kusmierz@gmail.com>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>,
	dave@jikos.cz
Subject: Re: Status of SMR with BTRFS
Date: Thu, 21 Jul 2016 07:34:57 -0600	[thread overview]
Message-ID: <CAJCQCtRGtax_ovqA8Xb3DzmeTp=pJkpS0J1hGpe2PongFhfSpg@mail.gmail.com> (raw)
In-Reply-To: <bf3f40ff-cb91-d0b3-e60d-27f4e14cbb37@gmail.com>

On Thu, Jul 21, 2016 at 6:46 AM, Austin S. Hemmelgarn
<ahferroin7@gmail.com> wrote:
> On 2016-07-20 15:58, Chris Murphy wrote:
>>
>> On Sun, Jul 17, 2016 at 3:08 AM, Hendrik Friedel <hendrik@friedels.name>
>> wrote:
>>
>>> Well, btrfs does write data very different to many other file systems. On
>>> every write the file is copied to another place, even if just one bit is
>>> changed. That's special and I am wondering whether that could cause
>>> problems.
>>
>>
>> It depends on the application. In practice, the program most
>> responsible for writing the file often does a faux-COW by writing a
>> whole new (temporary) file somewhere, when that operation completes,
>> it then deletes the original, and move+renames the temporary one into
>> place where the original one, doing fsync in between each of those
>> operations. I think some of this is done via VFS also. It's all much
>> more metadata centric than what Btrfs would do on its own.
>
> I'm pretty certain that the VFS itself does not do replace by rename type
> stuff.

I can't tell what does it. But so far every program I've tried: vi,
gedit, GIMP, writes out a new file - as in, it has a different inode
number and every extent has a different address. That every program
reimplements this faux-COW would kinda surprise me rather than just
letting the VFS do it for everyone. I think since ancient times
literally overwriting files is just a bad idea that pretty much
guarantees data loss of old and new data if something interrupts that
overwrite.


>BTRFS by nature technically does though, it's the same idea as a COW
> update, just at a higher level, so we're technically doing the same thing
> for every single block that changes.  The only issue I can think of in this
> context with a replace by rename is that you end up hitting the metadata
> trees twice.

Do programs have a way to communicate what portion of a data file is
modified, so that only changed blocks are COW'd? When I change a
single pixel in a 400MiB image and do a save (to overwrite the
original file), it takes just as long to overwrite as to write it out
as a new file. It'd be neat if that could be optimized but I don't see
it being the case at the moment.


-- 
Chris Murphy

  reply	other threads:[~2016-07-21 13:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 18:29 Status of SMR with BTRFS Hendrik Friedel
2016-07-15 22:15 ` Tomasz Kusmierz
2016-07-16 10:29   ` Hendrik Friedel
2016-07-17  3:09     ` Tomasz Kusmierz
2016-07-17  9:08       ` Hendrik Friedel
2016-07-17 20:48         ` Henk Slager
2016-07-18 11:22         ` Austin S. Hemmelgarn
2016-07-18 18:31           ` Hendrik Friedel
2016-07-18 18:44             ` Austin S. Hemmelgarn
2016-07-18 19:05               ` Hendrik Friedel
2016-07-18 19:30                 ` Austin S. Hemmelgarn
2016-07-18 22:29                   ` Tomasz Kusmierz
2016-07-20 19:58         ` Chris Murphy
2016-07-21 12:46           ` Austin S. Hemmelgarn
2016-07-21 13:34             ` Chris Murphy [this message]
2016-07-21 14:02               ` Andrei Borzenkov
2016-07-21 14:12               ` Austin S. Hemmelgarn
2016-07-21 14:31                 ` Chris Murphy
2016-07-21 15:35               ` Patrik Lundquist
  -- strict thread matches above, loose matches on Subject: below --
2016-07-17  8:26 Matthias Prager
2016-07-17 20:10 ` Henk Slager
2016-07-17 21:44   ` Matthias Prager
2016-07-18 18:49     ` Jukka Larja
2016-07-21 12:22 Matthias Prager

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='CAJCQCtRGtax_ovqA8Xb3DzmeTp=pJkpS0J1hGpe2PongFhfSpg@mail.gmail.com' \
    --to=lists@colorremedies.com \
    --cc=ahferroin7@gmail.com \
    --cc=dave@jikos.cz \
    --cc=hendrik@friedels.name \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=tom.kusmierz@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).