public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC v2 00/24] xfs: add reflink and dedupe support
@ 2015-07-29 22:32 Darrick J. Wong
  2015-07-29 22:33 ` [PATCH 01/24] xfs: introduce refcount btree definitions Darrick J. Wong
                   ` (24 more replies)
  0 siblings, 25 replies; 37+ messages in thread
From: Darrick J. Wong @ 2015-07-29 22:32 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: xfs

Hi all,

This is the second revision of an RFC for adding to XFS kernel support
for mapping multiple file logical blocks to the same physical block,
more commonly known as reflinking.  The implementation a single [block
range, refcount] tree to track the reference counts of extents of
physical blocks.  There's also support code to provide the desired
copy-on-write behavior and the userland interfaces to reflink, query
the status of, and un-reflink files.

The patch set is based on the current (4.2-rc4) upstream kernel plus
Dave's reverse-map RFC patches.  There are plenty of bugs in this
code; in particular the copy-on-write code is still terrible and prone
to all sorts of amusing crashes.

To expand on that, the copy on write code is horribly broken, but I'm
posting this patchset in the hopes of getting some review of the other
pieces while I try to solve CoW.  Since "RFC(RAP)" post last month I
broke up the patches into smaller pieces, added tracepoints, and
provided longer descriptions + ASCII art of what the big algorithms
are trying to do.

What I'd like to do for CoW is to (ab|re)use the delayed allocation
code to implement copy on write.  In xfs_get_blocks we'd reserve
whatever blocks we need (or return ENOSPC to users) as in regular
delalloc; and in xfs_vm_writepage we'd use xfs_map_blocks to allocate
the forked blocks, remove the old mapping, and add in the new mapping,
which is almost what delalloc does now.  One problem I've not yet
worked around is that __block_write_begin won't call get_blocks if the
bh is already mapped, which means that we fail to make the necessary
reservations in certain cases (write file, reflink, rewrite original
file).  The current CoW patch sort of forces this to work by doing its
own reservation outside of get_blocks and delalloc, but doesn't
necessarily get it right.

At the moment, the reverse-map and reflink features are /not/
compatible.  This will be resolved soon.

The ioctl interface to XFS reflink looks surprisingly like the btrfs
ioctl interface <cough> -- you can reflink a file, reflink subranges
of a file, or dedupe subranges of files.  (Dedupe also checks file
blocks, though I have a feeling it's racy.)  To un-reflink a file,
simply chattr +C it to mark it no-cow.  xfs_fsr is a better candidate
for de-reflinking a file since it also defragments the file.

If you're going to start using this mess, you're going to want to pull
my xfsprogs dev tree[1], which itself is also based on xfsprogs
for-next and the userland rmap support bits.  I've not had time to get
reflink and rmap to work together.

I've also prepared a bunch of xfstests[2] to exercise the userland
interfaces; btrfs' reflink implementation more or less passes.

This is an extraordinary way to eat your data.  Enjoy!

Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/xfsprogs/commits/for-next
[2] https://github.com/djwong/xfstests/commits/master

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2015-08-01 22:58 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29 22:32 [RFC v2 00/24] xfs: add reflink and dedupe support Darrick J. Wong
2015-07-29 22:33 ` [PATCH 01/24] xfs: introduce refcount btree definitions Darrick J. Wong
2015-07-29 22:33 ` [PATCH 02/24] xfs: define tracepoints for refcount/reflink activities Darrick J. Wong
2015-07-29 22:33 ` [PATCH 03/24] xfs: add refcount btree stats infrastructure Darrick J. Wong
2015-07-30  0:34   ` Dave Chinner
2015-07-30 19:04     ` Darrick J. Wong
2015-07-29 22:33 ` [PATCH 04/24] xfs: refcount btree add more reserved blocks Darrick J. Wong
2015-07-30  0:35   ` Dave Chinner
2015-07-30 19:09     ` Darrick J. Wong
2015-07-29 22:33 ` [PATCH 05/24] xfs: define the on-disk refcount btree format Darrick J. Wong
2015-07-30  0:42   ` Dave Chinner
2015-07-30 22:14     ` Darrick J. Wong
2015-07-29 22:33 ` [PATCH 06/24] xfs: add refcount btree support to growfs Darrick J. Wong
2015-07-29 22:33 ` [PATCH 07/24] xfs: add refcount btree operations Darrick J. Wong
2015-07-30  0:51   ` Dave Chinner
2015-07-29 22:33 ` [PATCH 08/24] libxfs: adjust refcount of an extent of blocks in refcount btree Darrick J. Wong
2015-07-29 22:33 ` [PATCH 09/24] libxfs: adjust refcount when unmapping file blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 10/24] xfs: add refcount btree block detection to log recovery Darrick J. Wong
2015-07-29 22:34 ` [PATCH 11/24] xfs: map an inode's offset to an exact physical block Darrick J. Wong
2015-07-30  1:04   ` Dave Chinner
2015-07-30 21:09     ` Darrick J. Wong
2015-07-29 22:34 ` [PATCH 12/24] xfs: add reflink feature flag to geometry Darrick J. Wong
2015-07-29 22:34 ` [PATCH 13/24] xfs: create a separate workqueue for copy-on-write activities Darrick J. Wong
2015-07-29 22:34 ` [PATCH 14/24] xfs: implement copy-on-write for reflinked blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 15/24] xfs: handle directio " Darrick J. Wong
2015-07-29 22:34 ` [PATCH 16/24] xfs: copy-on-write reflinked blocks when zeroing ranges of blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 17/24] xfs: clear inode reflink flag when freeing blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 18/24] xfs: reflink extents from one file to another Darrick J. Wong
2015-07-29 22:35 ` [PATCH 19/24] xfs: add clone file and clone range ioctls Darrick J. Wong
2015-07-29 22:35 ` [PATCH 20/24] xfs: emulate the btrfs dedupe extent same ioctl Darrick J. Wong
2015-07-29 22:35 ` [PATCH 21/24] xfs: teach fiemap about reflink'd extents Darrick J. Wong
2015-07-29 22:35 ` [PATCH 22/24] xfs: swap inode reflink flags when swapping inode extents Darrick J. Wong
2015-08-01 12:51   ` Josef 'Jeff' Sipek
2015-07-29 22:35 ` [PATCH 23/24] xfs: support XFS_XFLAG_REFLINK (and FS_NOCOW_FL) on reflink filesystems Darrick J. Wong
2015-07-29 22:35 ` [PATCH 24/24] xfs: recognize the reflink feature bit Darrick J. Wong
2015-08-01 13:01 ` [RFC v2 00/24] xfs: add reflink and dedupe support Josef 'Jeff' Sipek
2015-08-01 22:58   ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox