xref: /linux/fs/xfs/xfs_aops.h (revision 82ffd0454bd9bd57780966d47bfd56d579dd4fb3)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2005-2006 Silicon Graphics, Inc.
4  * All Rights Reserved.
5  */
6 #ifndef __XFS_AOPS_H__
7 #define __XFS_AOPS_H__
8 
9 extern struct bio_set xfs_ioend_bioset;
10 
11 /*
12  * Types of I/O for bmap clustering and I/O completion tracking.
13  *
14  * This enum is used in string mapping in xfs_trace.h; please keep the
15  * TRACE_DEFINE_ENUMs for it up to date.
16  */
17 enum {
18 	XFS_IO_HOLE,		/* covers region without any block allocation */
19 	XFS_IO_DELALLOC,	/* covers delalloc region */
20 	XFS_IO_UNWRITTEN,	/* covers allocated but uninitialized data */
21 	XFS_IO_OVERWRITE,	/* covers already allocated extent */
22 	XFS_IO_COW,		/* covers copy-on-write extent */
23 };
24 
25 #define XFS_IO_TYPES \
26 	{ XFS_IO_HOLE,			"hole" },	\
27 	{ XFS_IO_DELALLOC,		"delalloc" },	\
28 	{ XFS_IO_UNWRITTEN,		"unwritten" },	\
29 	{ XFS_IO_OVERWRITE,		"overwrite" },	\
30 	{ XFS_IO_COW,			"CoW" }
31 
32 /*
33  * Structure for buffered I/O completions.
34  */
35 struct xfs_ioend {
36 	struct list_head	io_list;	/* next ioend in chain */
37 	unsigned int		io_type;	/* delalloc / unwritten */
38 	struct inode		*io_inode;	/* file being written to */
39 	size_t			io_size;	/* size of the extent */
40 	xfs_off_t		io_offset;	/* offset in the file */
41 	struct work_struct	io_work;	/* xfsdatad work queue */
42 	struct xfs_trans	*io_append_trans;/* xact. for size update */
43 	struct bio		*io_bio;	/* bio being built */
44 	struct bio		io_inline_bio;	/* MUST BE LAST! */
45 };
46 
47 extern const struct address_space_operations xfs_address_space_operations;
48 extern const struct address_space_operations xfs_dax_aops;
49 
50 int	xfs_setfilesize(struct xfs_inode *ip, xfs_off_t offset, size_t size);
51 
52 extern void xfs_count_page_state(struct page *, int *, int *);
53 extern struct block_device *xfs_find_bdev_for_inode(struct inode *);
54 extern struct dax_device *xfs_find_daxdev_for_inode(struct inode *);
55 
56 #endif /* __XFS_AOPS_H__ */
57