]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: introduce new file range exchange ioctl
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:34 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:00:59 +0000 (17:00 -0700)
commitc352ca6fe727ac5a5dd4d58f70ce7b69b0f195be
tree0efa4e252a2b29ab46386a5890b4dbb78842cac8
parenta995c2d7f6b9281afc7df2cefb832f36d33b4223
xfs: introduce new file range exchange ioctl

Source kernel commit: 9a64d9b3109d01cca0b83c1d36538b7a37c5284e

Introduce a new ioctl to handle exchanging ranges of bytes
between files.  The goal here is to perform the exchange atomically with
respect to applications -- either they see the file contents before the
exchange or they see that A-B is now B-A, even if the kernel crashes.

My original goal with all this code was to make it so that online repair
can build a replacement directory or xattr structure in a temporary file
and commit the repair by atomically exchanging all the data blocks
between the two files.  However, I needed a way to test this mechanism
thoroughly, so I've been evolving an ioctl interface since then.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_fs.h