0001
0002
0003
0004
0005
0006 #ifndef __XFS_IOMAP_H__
0007 #define __XFS_IOMAP_H__
0008
0009 #include <linux/iomap.h>
0010
0011 struct xfs_inode;
0012 struct xfs_bmbt_irec;
0013
0014 int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
0015 xfs_fileoff_t count_fsb, unsigned int flags,
0016 struct xfs_bmbt_irec *imap);
0017 int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
0018 xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
0019 xfs_fileoff_t end_fsb);
0020
0021 int xfs_bmbt_to_iomap(struct xfs_inode *ip, struct iomap *iomap,
0022 struct xfs_bmbt_irec *imap, unsigned int mapping_flags,
0023 u16 iomap_flags);
0024
0025 int xfs_zero_range(struct xfs_inode *ip, loff_t pos, loff_t len,
0026 bool *did_zero);
0027 int xfs_truncate_page(struct xfs_inode *ip, loff_t pos, bool *did_zero);
0028
0029 static inline xfs_filblks_t
0030 xfs_aligned_fsb_count(
0031 xfs_fileoff_t offset_fsb,
0032 xfs_filblks_t count_fsb,
0033 xfs_extlen_t extsz)
0034 {
0035 if (extsz) {
0036 xfs_extlen_t align;
0037
0038 div_u64_rem(offset_fsb, extsz, &align);
0039 if (align)
0040 count_fsb += align;
0041 div_u64_rem(count_fsb, extsz, &align);
0042 if (align)
0043 count_fsb += extsz - align;
0044 }
0045
0046 return count_fsb;
0047 }
0048
0049 extern const struct iomap_ops xfs_buffered_write_iomap_ops;
0050 extern const struct iomap_ops xfs_direct_write_iomap_ops;
0051 extern const struct iomap_ops xfs_read_iomap_ops;
0052 extern const struct iomap_ops xfs_seek_iomap_ops;
0053 extern const struct iomap_ops xfs_xattr_iomap_ops;
0054 extern const struct iomap_ops xfs_dax_write_iomap_ops;
0055
0056 #endif