xref: /openbmc/linux/fs/xfs/xfs_buf_item.h (revision a266ef69)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
4  * All Rights Reserved.
5  */
6 #ifndef	__XFS_BUF_ITEM_H__
7 #define	__XFS_BUF_ITEM_H__
8 
9 /* kernel only definitions */
10 
11 struct xfs_buf;
12 struct xfs_mount;
13 
14 /* buf log item flags */
15 #define	XFS_BLI_HOLD		(1u << 0)
16 #define	XFS_BLI_DIRTY		(1u << 1)
17 #define	XFS_BLI_STALE		(1u << 2)
18 #define	XFS_BLI_LOGGED		(1u << 3)
19 #define	XFS_BLI_INODE_ALLOC_BUF	(1u << 4)
20 #define XFS_BLI_STALE_INODE	(1u << 5)
21 #define	XFS_BLI_INODE_BUF	(1u << 6)
22 #define	XFS_BLI_ORDERED		(1u << 7)
23 
24 #define XFS_BLI_FLAGS \
25 	{ XFS_BLI_HOLD,		"HOLD" }, \
26 	{ XFS_BLI_DIRTY,	"DIRTY" }, \
27 	{ XFS_BLI_STALE,	"STALE" }, \
28 	{ XFS_BLI_LOGGED,	"LOGGED" }, \
29 	{ XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
30 	{ XFS_BLI_STALE_INODE,	"STALE_INODE" }, \
31 	{ XFS_BLI_INODE_BUF,	"INODE_BUF" }, \
32 	{ XFS_BLI_ORDERED,	"ORDERED" }
33 
34 /*
35  * This is the in core log item structure used to track information
36  * needed to log buffers.  It tracks how many times the lock has been
37  * locked, and which 128 byte chunks of the buffer are dirty.
38  */
39 struct xfs_buf_log_item {
40 	struct xfs_log_item	bli_item;	/* common item structure */
41 	struct xfs_buf		*bli_buf;	/* real buffer pointer */
42 	unsigned int		bli_flags;	/* misc flags */
43 	unsigned int		bli_recur;	/* lock recursion count */
44 	atomic_t		bli_refcount;	/* cnt of tp refs */
45 	int			bli_format_count;	/* count of headers */
46 	struct xfs_buf_log_format *bli_formats;	/* array of in-log header ptrs */
47 	struct xfs_buf_log_format __bli_format;	/* embedded in-log header */
48 };
49 
50 int	xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
51 void	xfs_buf_item_done(struct xfs_buf *bp);
52 void	xfs_buf_item_relse(struct xfs_buf *);
53 bool	xfs_buf_item_put(struct xfs_buf_log_item *);
54 void	xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
55 bool	xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
56 void	xfs_buf_inode_iodone(struct xfs_buf *);
57 void	xfs_buf_inode_io_fail(struct xfs_buf *bp);
58 #ifdef CONFIG_XFS_QUOTA
59 void	xfs_buf_dquot_iodone(struct xfs_buf *);
60 void	xfs_buf_dquot_io_fail(struct xfs_buf *bp);
61 #else
62 static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
63 {
64 }
65 static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
66 {
67 }
68 #endif /* CONFIG_XFS_QUOTA */
69 void	xfs_buf_iodone(struct xfs_buf *);
70 bool	xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
71 
72 extern struct kmem_cache	*xfs_buf_item_cache;
73 
74 #endif	/* __XFS_BUF_ITEM_H__ */
75