From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: reflink COW improvements
Date: Mon, 5 Dec 2016 18:09:09 -0800 [thread overview]
Message-ID: <20161206020908.GC8436@birch.djwong.org> (raw)
In-Reply-To: <1480971924-4864-1-git-send-email-hch@lst.de>
On Mon, Dec 05, 2016 at 10:05:21PM +0100, Christoph Hellwig wrote:
> Hi all,
>
> this series adds a few improvements to the direct I/O COW path.
>
> Note that patch 2 at this point causes a regression in xfs/214:
>
> @ -11,7 +11,7 @@
> CoW one of the files
> root -- 0 0 0 4 0 0
> nobody -- 0 0 0 1 0 0
> -fsgqa -- 3520 0 0 4 0 0
> +fsgqa -- 3072 0 0 4 0 0
> Remount the FS to see if accounting changes
> root -- 0 0 0 4 0 0
> nobody -- 0 0 0 1 0 0
>
> But I think the test golden output actually is wrong - the test
> claims it tests that we don't get blocks charged during the COW,
> but the 3520 here means 512 bytes were charged, and later in the
> golden output we actually see that going away after a remount.
I think it's correct for how the directio path used to work...
So xfs/214 writes a 1MB file and reflinks it twice, with the intent of
playing with file2. So, file2 looks like this:
dddddddddddddddd (d = existing data, data fork fork)
(cow fork)
A 512K cowextsize hint is set and we write to the last 64K of one of
the files. The old dio write code would make the usual delalloc
reservation, which rounds both up and down to the nearest cowextsize
boundary:
dddddddddddddddd (data fork)
cccccccc (cow fork)
At this point, we should be charged for 3584K -- 1MB for each of the
three files, and 512K for the CoW delalloc.
Then we call fsync, which CoWs the last 64k out to disk. Now we have:
dddddddddddddddD (D = replacement data, data fork)
ccccccc (cow fork)
The quota charge is now 3520K -- 1MB for each of the three files plus
the 448K that remains in the CoW fork anticipating a future write.
Remounting flushes out the cow fork:
dddddddddddddddD (data fork)
(cow fork)
So now the quota charge is back to an even 3072MB -- three 1MB files.
My suspicion is that since the new patchset bypasses the delalloc +
conversion dance and replaces it with allocating exactly as many blocks
as the dio write asked for + rounding up to the nearest cowextsize. In
this case, we never make the delalloc reservation between 512K and 896K,
so the repquota output says 3072K instead of 3520K.
(That said, I've been tied up in meetings all day so I haven't had a
chance to apply the patches and find out for real.)
--D
prev parent reply other threads:[~2016-12-06 2:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 21:05 reflink COW improvements Christoph Hellwig
2016-12-05 21:05 ` [PATCH 1/3] xfs: reject all unaligned direct writes to reflinked files Christoph Hellwig
2016-12-07 18:59 ` Brian Foster
2016-12-05 21:05 ` [PATCH 2/3] xfs: go straight to real allocations for direct I/O COW writes Christoph Hellwig
2016-12-07 19:00 ` Brian Foster
2016-12-07 19:37 ` Christoph Hellwig
2016-12-07 19:46 ` Brian Foster
2016-12-08 4:23 ` Darrick J. Wong
2017-01-24 8:37 ` Christoph Hellwig
2017-01-24 13:50 ` Brian Foster
2017-01-24 13:59 ` Christoph Hellwig
2017-01-24 15:02 ` Brian Foster
2017-01-24 15:09 ` Christoph Hellwig
2017-01-24 16:17 ` Brian Foster
2017-01-24 16:21 ` Christoph Hellwig
2017-01-24 17:43 ` Brian Foster
2017-01-24 20:08 ` Christoph Hellwig
2017-01-24 20:10 ` Christoph Hellwig
2017-01-25 0:09 ` Darrick J. Wong
2017-01-27 17:44 ` Darrick J. Wong
2017-01-27 17:48 ` Christoph Hellwig
2016-12-05 21:05 ` [PATCH 3/3] xfs: allocate direct I/O COW blocks in iomap_begin Christoph Hellwig
2016-12-06 2:09 ` Darrick J. Wong [this message]
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=20161206020908.GC8436@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=hch@lst.de \
--cc=linux-xfs@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;
as well as URLs for NNTP newsgroup(s).