Merge tag 'docs-5.7-2' of git://git.lwn.net/linux
[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
CH
14int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
15 xfs_fileoff_t count_fsb, struct xfs_bmbt_irec *imap);
ee70daab 16int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
e696663a
CH
17xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
18 xfs_fileoff_t end_fsb);
1da177e4 19
16be1433 20int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
2492a606 21 struct xfs_bmbt_irec *, u16);
3b3dce05 22
f13eb205
CH
23static inline xfs_filblks_t
24xfs_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
0703a8e1 32 div_u64_rem(offset_fsb, extsz, &align);
f13eb205
CH
33 if (align)
34 count_fsb += align;
0703a8e1 35 div_u64_rem(count_fsb, extsz, &align);
f13eb205
CH
36 if (align)
37 count_fsb += extsz - align;
38 }
39
40 return count_fsb;
41}
42
f150b423
CH
43extern const struct iomap_ops xfs_buffered_write_iomap_ops;
44extern const struct iomap_ops xfs_direct_write_iomap_ops;
690c2a38 45extern const struct iomap_ops xfs_read_iomap_ops;
60271ab7 46extern const struct iomap_ops xfs_seek_iomap_ops;
8ff6daa1 47extern const struct iomap_ops xfs_xattr_iomap_ops;
68a9f5e7 48
1da177e4 49#endif /* __XFS_IOMAP_H__*/