public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christian Theune <ct@flyingcircus.io>
Cc: linux-xfs@vger.kernel.org
Subject: Re: Reading about CoW architecture / Performance Limits
Date: Mon, 9 Jan 2017 23:45:24 -0800	[thread overview]
Message-ID: <20170110074524.GI14038@birch.djwong.org> (raw)
In-Reply-To: <BC894F29-47E7-47A3-93FB-3E4EEE1DCDD5@flyingcircus.io>

On Tue, Jan 10, 2017 at 08:07:39AM +0100, Christian Theune wrote:
> Hi,
> 
> As XFS is gaining CoW support I’d like to understand the
> implementation on a specific aspect: we’re using CoW for making disk
> image backups as image files in btrfs. This has proven prohibitive
> once the chain of CoW reflinks grows too long and everything becomes
> too fragmented. btrfs has improved in some places but the issue still
> persists.

As in making snapshots of a disk image via something like
"cp --reflink=always a.img a.img.20170110" ?

> We’re currently considering to move away from CoW filesystems for our
> use case and implement a higher level strategy. I now wonder whether
> XFS will have the same issue or whether the architecture is different
> in a significant way that will avoid prohibitive performance
> regressions on long CoW chains (think: hundreds to a few thousand).

The primary strategies XFS uses to combat fragmentation are a
combination of reusing the delayed allocation mechanism to defer CoW
block allocation as long as possible in the hopes of being able to make
larger requests; and implementing the "CoW extent size hint" (default 32
blocks or 128K) which rounds the start and end of an allocation request
to the nearest $cowextsize boundary.  So for example if you write to 32
adjacent shared blocks in random order, they'll end up on disk with a
single 128K extent, if possible.

Note also that XFS only performs CoW if the block is shared, so if you
write the same shared block in a file 20 times, the first write goes to
a new block and the next 19 overwrite that new block.  There will not be
another CoW unless you reflink the file again.

> I would appreciate a pointer where to look at - I’m a coder but
> following kernel code to understand architecture hasn’t been
> successful/efficient for me in the past …

You might try reading the huge comment blocks in fs/xfs/xfs_reflink.c.

--D

> 
> Kind regards,
> Christian
> 
> --
> Christian Theune · ct@flyingcircus.io · +49 345 219401 0
> Flying Circus Internet Operations GmbH · http://flyingcircus.io
> Forsterstraße 29 · 06112 Halle (Saale) · Deutschland
> HR Stendal HRB 21169 · Geschäftsführer: Christian. Theune, Christian. Zagrodnick
> 



  reply	other threads:[~2017-01-10  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10  7:07 Reading about CoW architecture / Performance Limits Christian Theune
2017-01-10  7:45 ` Darrick J. Wong [this message]
     [not found]   ` <C97BB12C-3C30-493B-BE9A-9E8C7CB5D1A4@flyingcircus.io>
2017-01-11  7:59     ` Darrick J. Wong
     [not found]     ` <9713E613-6953-4AD3-89B1-C0EF639E771C@flyingcircus.io>
2017-01-11  8:05       ` Darrick J. Wong
2017-01-11  9:10         ` Christoph Hellwig
2017-01-11 17:52           ` Darrick J. Wong

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=20170110074524.GI14038@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=ct@flyingcircus.io \
    --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