Loading...
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 *ip, xfs_fileoff_t offset_fsb,
15 xfs_fileoff_t count_fsb, unsigned int flags,
16 struct xfs_bmbt_irec *imap, u64 *sequence);
17int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
18xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
19 xfs_fileoff_t end_fsb);
20
21u64 xfs_iomap_inode_sequence(struct xfs_inode *ip, u16 iomap_flags);
22int xfs_bmbt_to_iomap(struct xfs_inode *ip, struct iomap *iomap,
23 struct xfs_bmbt_irec *imap, unsigned int mapping_flags,
24 u16 iomap_flags, u64 sequence_cookie);
25
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
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
39 div_u64_rem(offset_fsb, extsz, &align);
40 if (align)
41 count_fsb += align;
42 div_u64_rem(count_fsb, extsz, &align);
43 if (align)
44 count_fsb += extsz - align;
45 }
46
47 return count_fsb;
48}
49
50extern const struct iomap_ops xfs_buffered_write_iomap_ops;
51extern const struct iomap_ops xfs_page_mkwrite_iomap_ops;
52extern const struct iomap_ops xfs_direct_write_iomap_ops;
53extern const struct iomap_ops xfs_read_iomap_ops;
54extern const struct iomap_ops xfs_seek_iomap_ops;
55extern const struct iomap_ops xfs_xattr_iomap_ops;
56extern const struct iomap_ops xfs_dax_write_iomap_ops;
57
58#endif /* __XFS_IOMAP_H__*/
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
24int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
25 struct xfs_bmbt_irec *, int);
26int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t,
27 struct xfs_bmbt_irec *);
28int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t,
29 struct xfs_bmbt_irec *);
30int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, size_t);
31
32#endif /* __XFS_IOMAP_H__*/