Loading...
1/*
2 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_IOMAP_H__
19#define __XFS_IOMAP_H__
20
21struct xfs_inode;
22struct xfs_bmbt_irec;
23
24extern int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
25 struct xfs_bmbt_irec *, int);
26extern int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t,
27 struct xfs_bmbt_irec *);
28extern int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t, size_t,
29 struct xfs_bmbt_irec *);
30extern int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, size_t);
31
32#endif /* __XFS_IOMAP_H__*/
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
11struct xfs_inode;
12struct xfs_bmbt_irec;
13
14int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
15 struct xfs_bmbt_irec *, int);
16int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
17
18int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
19 struct xfs_bmbt_irec *, bool shared);
20xfs_extlen_t xfs_eof_alignment(struct xfs_inode *ip, xfs_extlen_t extsize);
21
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
31 div_u64_rem(offset_fsb, extsz, &align);
32 if (align)
33 count_fsb += align;
34 div_u64_rem(count_fsb, extsz, &align);
35 if (align)
36 count_fsb += extsz - align;
37 }
38
39 return count_fsb;
40}
41
42extern const struct iomap_ops xfs_iomap_ops;
43extern const struct iomap_ops xfs_seek_iomap_ops;
44extern const struct iomap_ops xfs_xattr_iomap_ops;
45
46#endif /* __XFS_IOMAP_H__*/