Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 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 | |
| 9 | #include <linux/iomap.h> |
| 10 | |
| 11 | struct xfs_inode; |
| 12 | struct xfs_bmbt_irec; |
| 13 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [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); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 16 | int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool); |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 17 | xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip, |
| 18 | xfs_fileoff_t end_fsb); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 19 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 20 | int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *, |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 21 | struct xfs_bmbt_irec *, u16); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 22 | |
| 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 | |
| 32 | div_u64_rem(offset_fsb, extsz, &align); |
| 33 | if (align) |
| 34 | count_fsb += align; |
| 35 | div_u64_rem(count_fsb, extsz, &align); |
| 36 | if (align) |
| 37 | count_fsb += extsz - align; |
| 38 | } |
| 39 | |
| 40 | return count_fsb; |
| 41 | } |
| 42 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 43 | extern const struct iomap_ops xfs_buffered_write_iomap_ops; |
| 44 | extern const struct iomap_ops xfs_direct_write_iomap_ops; |
| 45 | extern const struct iomap_ops xfs_read_iomap_ops; |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 46 | extern const struct iomap_ops xfs_seek_iomap_ops; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 47 | extern const struct iomap_ops xfs_xattr_iomap_ops; |
| 48 | |
| 49 | #endif /* __XFS_IOMAP_H__*/ |