xfs_iomap.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 *, xfs_off_t, size_t,
  12. struct xfs_bmbt_irec *, int);
  13. int xfs_iomap_write_allocate(struct xfs_inode *, int, xfs_off_t,
  14. struct xfs_bmbt_irec *, unsigned int *);
  15. int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
  16. void xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
  17. struct xfs_bmbt_irec *);
  18. xfs_extlen_t xfs_eof_alignment(struct xfs_inode *ip, xfs_extlen_t extsize);
  19. static inline xfs_filblks_t
  20. xfs_aligned_fsb_count(
  21. xfs_fileoff_t offset_fsb,
  22. xfs_filblks_t count_fsb,
  23. xfs_extlen_t extsz)
  24. {
  25. if (extsz) {
  26. xfs_extlen_t align;
  27. div_u64_rem(offset_fsb, extsz, &align);
  28. if (align)
  29. count_fsb += align;
  30. div_u64_rem(count_fsb, extsz, &align);
  31. if (align)
  32. count_fsb += extsz - align;
  33. }
  34. return count_fsb;
  35. }
  36. extern const struct iomap_ops xfs_iomap_ops;
  37. extern const struct iomap_ops xfs_xattr_iomap_ops;
  38. #endif /* __XFS_IOMAP_H__*/