Re: [PATCH 01/18] vfs: introduce new file range exchange ioctl
From: Amir Goldstein <amir73il@gmail.com>
Date: 2021-04-01 03:33:11
Also in:
linux-fsdevel, linux-xfs
On Thu, Apr 1, 2021 at 4:13 AM Darrick J. Wong [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Darrick J. Wong <djwong@kernel.org> Introduce a new ioctl to handle swapping ranges of bytes between files. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- Documentation/filesystems/vfs.rst | 16 ++ fs/ioctl.c | 42 +++++ fs/remap_range.c | 283 +++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_fs.h | 1 include/linux/fs.h | 14 ++ include/uapi/linux/fiexchange.h | 101 +++++++++++++ 6 files changed, 456 insertions(+), 1 deletion(-) create mode 100644 include/uapi/linux/fiexchange.hdiff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index 2049bbf5e388..9f16b260bc7e 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst@@ -1006,6 +1006,8 @@ This describes how the VFS can manipulate an open file. As of kernel loff_t (*remap_file_range)(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t len, unsigned int remap_flags); + int (*xchg_file_range)(struct file *file1, struct file *file2, + struct file_xchg_range *fxr);
An obvious question: why is the xchgn_file_range op not using the unified remap_file_range() method with REMAP_XCHG_ flags? Surely replacing the remap_flags arg with struct file_remap_range. I went to look for reasons and I didn't find them. Can you share your reasons for that? Thanks, Amir.