Merge tag 'for-5.1/block-post-20190315' of git://git.kernel.dk/linux-block
[linux-2.6-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
0799a3e8 14int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
a206c817 15 struct xfs_bmbt_irec *, int);
ee70daab 16int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
1da177e4 17
16be1433
CH
18int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
19 struct xfs_bmbt_irec *, bool shared);
f7ca3522 20xfs_extlen_t xfs_eof_alignment(struct xfs_inode *ip, xfs_extlen_t extsize);
3b3dce05 21
f13eb205
CH
22static inline xfs_filblks_t
23xfs_aligned_fsb_count(
24 xfs_fileoff_t offset_fsb,
25 xfs_filblks_t count_fsb,
26 xfs_extlen_t extsz)
27{
28 if (extsz) {
29 xfs_extlen_t align;
30
0703a8e1 31 div_u64_rem(offset_fsb, extsz, &align);
f13eb205
CH
32 if (align)
33 count_fsb += align;
0703a8e1 34 div_u64_rem(count_fsb, extsz, &align);
f13eb205
CH
35 if (align)
36 count_fsb += extsz - align;
37 }
38
39 return count_fsb;
40}
41
8ff6daa1 42extern const struct iomap_ops xfs_iomap_ops;
60271ab7 43extern const struct iomap_ops xfs_seek_iomap_ops;
8ff6daa1 44extern const struct iomap_ops xfs_xattr_iomap_ops;
68a9f5e7 45
1da177e4 46#endif /* __XFS_IOMAP_H__*/