Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 3 | * Copyright (c) 2003-2005 Silicon Graphics, Inc. |
| 4 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #ifndef __XFS_IOMAP_H__ |
| 7 | #define __XFS_IOMAP_H__ |
| 8 | |
Christoph Hellwig | 68a9f5e | 2016-06-21 09:53:44 +1000 | [diff] [blame] | 9 | #include <linux/iomap.h> |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | struct xfs_inode; |
| 12 | struct xfs_bmbt_irec; |
| 13 | |
Christoph Hellwig | e696663 | 2019-10-30 12:24:59 -0700 | [diff] [blame] | 14 | int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb, |
| 15 | xfs_fileoff_t count_fsb, struct xfs_bmbt_irec *imap); |
Eryu Guan | ee70daa | 2017-09-21 11:26:18 -0700 | [diff] [blame] | 16 | int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool); |
Christoph Hellwig | e696663 | 2019-10-30 12:24:59 -0700 | [diff] [blame] | 17 | xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip, |
| 18 | xfs_fileoff_t end_fsb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Christoph Hellwig | 16be143 | 2019-02-18 09:38:46 -0800 | [diff] [blame] | 20 | int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *, |
Christoph Hellwig | 2492a60 | 2019-10-17 13:12:02 -0700 | [diff] [blame] | 21 | struct xfs_bmbt_irec *, u16); |
Christoph Hellwig | 3b3dce0 | 2016-06-21 09:52:47 +1000 | [diff] [blame] | 22 | |
Christoph Hellwig | f13eb20 | 2017-02-06 10:42:26 -0800 | [diff] [blame] | 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 | |
Dave Chinner | 0703a8e | 2018-06-08 09:54:22 -0700 | [diff] [blame] | 32 | div_u64_rem(offset_fsb, extsz, &align); |
Christoph Hellwig | f13eb20 | 2017-02-06 10:42:26 -0800 | [diff] [blame] | 33 | if (align) |
| 34 | count_fsb += align; |
Dave Chinner | 0703a8e | 2018-06-08 09:54:22 -0700 | [diff] [blame] | 35 | div_u64_rem(count_fsb, extsz, &align); |
Christoph Hellwig | f13eb20 | 2017-02-06 10:42:26 -0800 | [diff] [blame] | 36 | if (align) |
| 37 | count_fsb += extsz - align; |
| 38 | } |
| 39 | |
| 40 | return count_fsb; |
| 41 | } |
| 42 | |
Christoph Hellwig | f150b42 | 2019-10-19 09:09:46 -0700 | [diff] [blame] | 43 | extern const struct iomap_ops xfs_buffered_write_iomap_ops; |
| 44 | extern const struct iomap_ops xfs_direct_write_iomap_ops; |
Christoph Hellwig | 690c2a3 | 2019-10-19 09:09:45 -0700 | [diff] [blame] | 45 | extern const struct iomap_ops xfs_read_iomap_ops; |
Christoph Hellwig | 60271ab7 | 2019-02-18 09:38:46 -0800 | [diff] [blame] | 46 | extern const struct iomap_ops xfs_seek_iomap_ops; |
Christoph Hellwig | 8ff6daa | 2017-01-27 23:20:26 -0800 | [diff] [blame] | 47 | extern const struct iomap_ops xfs_xattr_iomap_ops; |
Christoph Hellwig | 68a9f5e | 2016-06-21 09:53:44 +1000 | [diff] [blame] | 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #endif /* __XFS_IOMAP_H__*/ |