Merge branch 'next' into for-linus
[linux-block.git] / fs / xfs / xfs_iomap.h
CommitLineData
0b61f8a4 1// SPDX-License-Identifier: GPL-2.0
1da177e4 2/*
7b718769
NS
3 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
1da177e4 5 */
1da177e4
LT
6#ifndef __XFS_IOMAP_H__
7#define __XFS_IOMAP_H__
8
68a9f5e7
CH
9#include <linux/iomap.h>
10
1da177e4
LT
11struct xfs_inode;
12struct xfs_bmbt_irec;
13
e696663a 14int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
952da063 15 xfs_fileoff_t count_fsb, unsigned int flags,
304a68b9 16 struct xfs_bmbt_irec *imap, u64 *sequence);
ee70daab 17int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
e696663a
CH
18xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
19 xfs_fileoff_t end_fsb);
1da177e4 20
304a68b9 21u64 xfs_iomap_inode_sequence(struct xfs_inode *ip, u16 iomap_flags);
740fd671
CH
22int xfs_bmbt_to_iomap(struct xfs_inode *ip, struct iomap *iomap,
23 struct xfs_bmbt_irec *imap, unsigned int mapping_flags,
304a68b9 24 u16 iomap_flags, u64 sequence_cookie);
3b3dce05 25
f1ba5faf
SR
26int xfs_zero_range(struct xfs_inode *ip, loff_t pos, loff_t len,
27 bool *did_zero);
28int xfs_truncate_page(struct xfs_inode *ip, loff_t pos, bool *did_zero);
29
f13eb205
CH
30static inline xfs_filblks_t
31xfs_aligned_fsb_count(
32 xfs_fileoff_t offset_fsb,
33 xfs_filblks_t count_fsb,
34 xfs_extlen_t extsz)
35{
36 if (extsz) {
37 xfs_extlen_t align;
38
0703a8e1 39 div_u64_rem(offset_fsb, extsz, &align);
f13eb205
CH
40 if (align)
41 count_fsb += align;
0703a8e1 42 div_u64_rem(count_fsb, extsz, &align);
f13eb205
CH
43 if (align)
44 count_fsb += extsz - align;
45 }
46
47 return count_fsb;
48}
49
f150b423 50extern const struct iomap_ops xfs_buffered_write_iomap_ops;
118e021b 51extern const struct iomap_ops xfs_page_mkwrite_iomap_ops;
f150b423 52extern const struct iomap_ops xfs_direct_write_iomap_ops;
690c2a38 53extern const struct iomap_ops xfs_read_iomap_ops;
60271ab7 54extern const struct iomap_ops xfs_seek_iomap_ops;
8ff6daa1 55extern const struct iomap_ops xfs_xattr_iomap_ops;
ea6c49b7 56extern const struct iomap_ops xfs_dax_write_iomap_ops;
68a9f5e7 57
1da177e4 58#endif /* __XFS_IOMAP_H__*/