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