1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (c) 2020-2024 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <djwong@kernel.org>
6 #ifndef __XFS_EXCHRANGE_H__
7 #define __XFS_EXCHRANGE_H__
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)
13 /* Freshness check required */
14 #define __XFS_EXCHANGE_RANGE_CHECK_FRESH2 (1ULL << 61)
16 #define XFS_EXCHANGE_RANGE_PRIV_FLAGS (__XFS_EXCHANGE_RANGE_UPD_CMTIME1 | \
17 __XFS_EXCHANGE_RANGE_UPD_CMTIME2 | \
18 __XFS_EXCHANGE_RANGE_CHECK_FRESH2)
20 struct xfs_exchrange
{
28 u64 flags
; /* XFS_EXCHANGE_RANGE flags */
30 /* file2 metadata for freshness checks */
32 struct timespec64 file2_mtime
;
33 struct timespec64 file2_ctime
;
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
);
44 struct xfs_exchmaps_req
;
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
);
50 int xfs_exchrange_estimate(struct xfs_exchmaps_req
*req
);
52 #endif /* __XFS_EXCHRANGE_H__ */