xfs_iomap.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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, struct xfs_bmbt_irec *imap);
  13. int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
  14. xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
  15. xfs_fileoff_t end_fsb);
  16. int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
  17. struct xfs_bmbt_irec *, u16);
  18. static inline xfs_filblks_t
  19. xfs_aligned_fsb_count(
  20. xfs_fileoff_t offset_fsb,
  21. xfs_filblks_t count_fsb,
  22. xfs_extlen_t extsz)
  23. {
  24. if (extsz) {
  25. xfs_extlen_t align;
  26. div_u64_rem(offset_fsb, extsz, &align);
  27. if (align)
  28. count_fsb += align;
  29. div_u64_rem(count_fsb, extsz, &align);
  30. if (align)
  31. count_fsb += extsz - align;
  32. }
  33. return count_fsb;
  34. }
  35. extern const struct iomap_ops xfs_buffered_write_iomap_ops;
  36. extern const struct iomap_ops xfs_direct_write_iomap_ops;
  37. extern const struct iomap_ops xfs_read_iomap_ops;
  38. extern const struct iomap_ops xfs_seek_iomap_ops;
  39. extern const struct iomap_ops xfs_xattr_iomap_ops;
  40. #endif /* __XFS_IOMAP_H__*/