1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Copyright (c) 2020-2024 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <djwong@kernel.org> 5 */ 6 #ifndef __XFS_EXCHRANGE_H__ 7 #define __XFS_EXCHRANGE_H__ 8 9 /* Update the mtime/cmtime of file1 and file2 */ 10 #define __XFS_EXCHANGE_RANGE_UPD_CMTIME1 (1ULL << 63) 11 #define __XFS_EXCHANGE_RANGE_UPD_CMTIME2 (1ULL << 62) 12 13 /* Freshness check required */ 14 #define __XFS_EXCHANGE_RANGE_CHECK_FRESH2 (1ULL << 61) 15 16 #define XFS_EXCHANGE_RANGE_PRIV_FLAGS (__XFS_EXCHANGE_RANGE_UPD_CMTIME1 | \ 17 __XFS_EXCHANGE_RANGE_UPD_CMTIME2 | \ 18 __XFS_EXCHANGE_RANGE_CHECK_FRESH2) 19 20 struct xfs_exchrange { 21 struct file *file1; 22 struct file *file2; 23 24 loff_t file1_offset; 25 loff_t file2_offset; 26 u64 length; 27 28 u64 flags; /* XFS_EXCHANGE_RANGE flags */ 29 30 /* file2 metadata for freshness checks */ 31 u64 file2_ino; 32 struct timespec64 file2_mtime; 33 struct timespec64 file2_ctime; 34 u32 file2_gen; 35 }; 36 37 long xfs_ioc_exchange_range(struct file *file, 38 struct xfs_exchange_range __user *argp); 39 long xfs_ioc_start_commit(struct file *file, 40 struct xfs_commit_range __user *argp); 41 long xfs_ioc_commit_range(struct file *file, 42 struct xfs_commit_range __user *argp); 43 44 struct xfs_exchmaps_req; 45 46 void xfs_exchrange_ilock(struct xfs_trans *tp, struct xfs_inode *ip1, 47 struct xfs_inode *ip2); 48 void xfs_exchrange_iunlock(struct xfs_inode *ip1, struct xfs_inode *ip2); 49 50 int xfs_exchrange_estimate(struct xfs_exchmaps_req *req); 51 52 #endif /* __XFS_EXCHRANGE_H__ */ 53