diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:42 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-14 14:16:49 -0700 |
commit | acb1e3f7d1650778fcf39421f50705da99f2697e (patch) | |
tree | 89a194e4039595f246ffe4fb41325b7d68fb60e4 /Documentation | |
parent | a91178eba222968e0b96605444b4d6735455cd52 (diff) |
vfs: introduce new file range exchange ioctl
Introduce a new ioctl to handle swapping ranges of bytes between files.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/filesystems/vfs.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index 6cd6953e175b..02ce5d779972 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -1030,6 +1030,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); int (*fadvise)(struct file *, loff_t, loff_t, int); }; @@ -1148,6 +1150,20 @@ otherwise noted. ok with the implementation shortening the request length to satisfy alignment or EOF requirements (or any other reason). +``xchg_file_range`` + called by the ioctl(2) system call for FIEXCHANGE_RANGE to exchange the + contents of two file ranges. An implementation should exchange + fxr.length bytes starting at fxr.file1_offset in file1 with the same + number of bytes starting at fxr.file2_offset in file2. Refer to + fiexchange.h file for more information. Implementations must call + generic_xchg_file_range_prep to prepare the two files prior to taking + locks; they must call generic_xchg_file_range_check_fresh once the + inode is locked to abort the call if file2 has changed; and they must + update the inode change and mod times of both files as part of the + metadata update. The timestamp updates must be done atomically as part + of the data exchange operation to ensure correctness of the freshness + check. + ``fadvise`` possibly called by the fadvise64() system call. |