xfs_iomap.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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);
  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. int xfs_bmbt_to_iomap(struct xfs_inode *ip, struct iomap *iomap,
  18. struct xfs_bmbt_irec *imap, unsigned int mapping_flags,
  19. u16 iomap_flags);
  20. int xfs_zero_range(struct xfs_inode *ip, loff_t pos, loff_t len,
  21. bool *did_zero);
  22. int xfs_truncate_page(struct xfs_inode *ip, loff_t pos, bool *did_zero);
  23. static inline xfs_filblks_t
  24. xfs_aligned_fsb_count(
  25. xfs_fileoff_t offset_fsb,
  26. xfs_filblks_t count_fsb,
  27. xfs_extlen_t extsz)
  28. {
  29. if (extsz) {
  30. xfs_extlen_t align;
  31. div_u64_rem(offset_fsb, extsz, &align);
  32. if (align)
  33. count_fsb += align;
  34. div_u64_rem(count_fsb, extsz, &align);
  35. if (align)
  36. count_fsb += extsz - align;
  37. }
  38. return count_fsb;
  39. }
  40. extern const struct iomap_ops xfs_buffered_write_iomap_ops;
  41. extern const struct iomap_ops xfs_direct_write_iomap_ops;
  42. extern const struct iomap_ops xfs_read_iomap_ops;
  43. extern const struct iomap_ops xfs_seek_iomap_ops;
  44. extern const struct iomap_ops xfs_xattr_iomap_ops;
  45. extern const struct iomap_ops xfs_dax_write_iomap_ops;
  46. #endif /* __XFS_IOMAP_H__*/