[PATCHSET v6.0 5/5] xfs: reflink with large realtime extents

Darrick J. Wong
2024-12-13T00:57:59Z

Hi all,

Now that we've landed support for reflink on the realtime device for
cases where the rt extent size is the same as the fs block size, enhance
the reflink code further to support cases where the rt extent size is a
power-of-two multiple of the fs block size. This enables us to do data
block sharing (for example) for much larger allocation units by dirtying
pagecache around shared extents and expanding writeback to write back
shared extents fully.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

This has been running on the djcloud for months with no problems. Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=realtime-reflink-extsize

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=realtime-reflink-extsize

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=realtime-reflink-extsize
---
Commits in this patchset:
* vfs: explicitly pass the block size to the remap prep function
* iomap: allow zeroing of written extents beyond EOF
* xfs: convert partially written rt file extents to completely written
* xfs: enable CoW when rt extent size is larger than 1 block
* xfs: forcibly convert unwritten blocks within an rt extent before sharing
* xfs: add some tracepoints for writeback
* xfs: extend writeback requests to handle rt cow correctly
* xfs: enable extent size hints for CoW when rtextsize > 1
* xfs: allow reflink on the rt volume when extent size is larger than 1 rt block
* xfs: fix integer overflow when validating extent size hints
* xfs: support realtime reflink with an extent size that isn't a power of 2
---
fs/dax.c | 5 +
fs/gfs2/bmap.c | 2
fs/iomap/buffered-io.c | 25 +++-
fs/remap_range.c | 30 +++--
fs/xfs/libxfs/xfs_bmap.c | 22 +++
fs/xfs/libxfs/xfs_inode_buf.c | 20 +--
fs/xfs/libxfs/xfs_rtbitmap.h | 12 ++
fs/xfs/xfs_aops.c | 57 ++++++++-
fs/xfs/xfs_bmap_util.c | 182 ++++++++++++++++++++++++++++
fs/xfs/xfs_bmap_util.h | 7 +
fs/xfs/xfs_file.c | 270 +++++++++++++++++++++++++++++++++++++++++
fs/xfs/xfs_file.h | 3
fs/xfs/xfs_inode.h | 6 +
fs/xfs/xfs_iomap.c | 27 ++++
fs/xfs/xfs_iops.c | 29 ++++
fs/xfs/xfs_reflink.c | 248 +++++++++++++++++++++++++++++++++-----
fs/xfs/xfs_reflink.h | 2
fs/xfs/xfs_rtalloc.c | 4 -
fs/xfs/xfs_super.c | 9 -
fs/xfs/xfs_trace.h | 50 +++++++-
include/linux/fs.h | 3
include/linux/iomap.h | 6 +
22 files changed, 925 insertions(+), 94 deletions(-)