xfs_iomap.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2003-2005 Silicon Graphics, Inc.
  4. * All Rights Reserved.
  5. */
  6. #ifndef __XFS_IOMAP_H__
  7. #define __XFS_IOMAP_H__
  8. #include <linux/iomap.h>
  9. struct xfs_inode;
  10. struct xfs_bmbt_irec;
  11. int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
  12. xfs_fileoff_t count_fsb, unsigned int flags,
  13. struct xfs_bmbt_irec *imap, u64 *sequence);
  14. int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
  15. xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
  16. xfs_fileoff_t end_fsb);
  17. u64 xfs_iomap_inode_sequence(struct xfs_inode *ip, u16 iomap_flags);
  18. int xfs_bmbt_to_iomap(struct xfs_inode *ip, struct iomap *iomap,
  19. struct xfs_bmbt_irec *imap, unsigned int mapping_flags,
  20. u16 iomap_flags, u64 sequence_cookie);
  21. int xfs_zero_range(struct xfs_inode *ip, loff_t pos, loff_t len,
  22. bool *did_zero);
  23. int xfs_truncate_page(struct xfs_inode *ip, loff_t pos, bool *did_zero);
  24. static inline xfs_filblks_t
  25. xfs_aligned_fsb_count(
  26. xfs_fileoff_t offset_fsb,
  27. xfs_filblks_t count_fsb,
  28. xfs_extlen_t extsz)
  29. {
  30. if (extsz) {
  31. xfs_extlen_t align;
  32. div_u64_rem(offset_fsb, extsz, &align);
  33. if (align)
  34. count_fsb += align;
  35. div_u64_rem(count_fsb, extsz, &align);
  36. if (align)
  37. count_fsb += extsz - align;
  38. }
  39. return count_fsb;
  40. }
  41. extern const struct iomap_ops xfs_buffered_write_iomap_ops;
  42. extern const struct iomap_ops xfs_page_mkwrite_iomap_ops;
  43. extern const struct iomap_ops xfs_direct_write_iomap_ops;
  44. extern const struct iomap_ops xfs_read_iomap_ops;
  45. extern const struct iomap_ops xfs_seek_iomap_ops;
  46. extern const struct iomap_ops xfs_xattr_iomap_ops;
  47. extern const struct iomap_ops xfs_dax_write_iomap_ops;
  48. #endif /* __XFS_IOMAP_H__*/