xfs_exchrange.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /* Update the mtime/cmtime of file1 and file2 */
  9. #define __XFS_EXCHANGE_RANGE_UPD_CMTIME1 (1ULL << 63)
  10. #define __XFS_EXCHANGE_RANGE_UPD_CMTIME2 (1ULL << 62)
  11. /* Freshness check required */
  12. #define __XFS_EXCHANGE_RANGE_CHECK_FRESH2 (1ULL << 61)
  13. #define XFS_EXCHANGE_RANGE_PRIV_FLAGS (__XFS_EXCHANGE_RANGE_UPD_CMTIME1 | \
  14. __XFS_EXCHANGE_RANGE_UPD_CMTIME2 | \
  15. __XFS_EXCHANGE_RANGE_CHECK_FRESH2)
  16. struct xfs_exchrange {
  17. struct file *file1;
  18. struct file *file2;
  19. loff_t file1_offset;
  20. loff_t file2_offset;
  21. u64 length;
  22. u64 flags; /* XFS_EXCHANGE_RANGE flags */
  23. /* file2 metadata for freshness checks */
  24. u64 file2_ino;
  25. struct timespec64 file2_mtime;
  26. struct timespec64 file2_ctime;
  27. u32 file2_gen;
  28. };
  29. long xfs_ioc_exchange_range(struct file *file,
  30. struct xfs_exchange_range __user *argp);
  31. long xfs_ioc_start_commit(struct file *file,
  32. struct xfs_commit_range __user *argp);
  33. long xfs_ioc_commit_range(struct file *file,
  34. struct xfs_commit_range __user *argp);
  35. struct xfs_exchmaps_req;
  36. void xfs_exchrange_ilock(struct xfs_trans *tp, struct xfs_inode *ip1,
  37. struct xfs_inode *ip2);
  38. void xfs_exchrange_iunlock(struct xfs_inode *ip1, struct xfs_inode *ip2);
  39. int xfs_exchrange_estimate(struct xfs_exchmaps_req *req);
  40. #endif /* __XFS_EXCHRANGE_H__ */