xref: /linux/fs/xfs/xfs_buf_item.h (revision 581b4484)
10b61f8a4SDave Chinner // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
37b718769SNathan Scott  * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
47b718769SNathan Scott  * All Rights Reserved.
51da177e4SLinus Torvalds  */
61da177e4SLinus Torvalds #ifndef	__XFS_BUF_ITEM_H__
71da177e4SLinus Torvalds #define	__XFS_BUF_ITEM_H__
81da177e4SLinus Torvalds 
9a8da0da2SDave Chinner /* kernel only definitions */
10a8272ce0SDavid Chinner 
11581b4484SDave Chinner struct xfs_buf;
12581b4484SDave Chinner struct xfs_mount;
13581b4484SDave Chinner 
14a8da0da2SDave Chinner /* buf log item flags */
15581b4484SDave Chinner #define	XFS_BLI_HOLD		(1u << 0)
16581b4484SDave Chinner #define	XFS_BLI_DIRTY		(1u << 1)
17581b4484SDave Chinner #define	XFS_BLI_STALE		(1u << 2)
18581b4484SDave Chinner #define	XFS_BLI_LOGGED		(1u << 3)
19581b4484SDave Chinner #define	XFS_BLI_INODE_ALLOC_BUF	(1u << 4)
20581b4484SDave Chinner #define XFS_BLI_STALE_INODE	(1u << 5)
21581b4484SDave Chinner #define	XFS_BLI_INODE_BUF	(1u << 6)
22581b4484SDave Chinner #define	XFS_BLI_ORDERED		(1u << 7)
231da177e4SLinus Torvalds 
240b1b213fSChristoph Hellwig #define XFS_BLI_FLAGS \
250b1b213fSChristoph Hellwig 	{ XFS_BLI_HOLD,		"HOLD" }, \
260b1b213fSChristoph Hellwig 	{ XFS_BLI_DIRTY,	"DIRTY" }, \
270b1b213fSChristoph Hellwig 	{ XFS_BLI_STALE,	"STALE" }, \
280b1b213fSChristoph Hellwig 	{ XFS_BLI_LOGGED,	"LOGGED" }, \
290b1b213fSChristoph Hellwig 	{ XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
30ccf7c23fSDave Chinner 	{ XFS_BLI_STALE_INODE,	"STALE_INODE" }, \
315f6bed76SDave Chinner 	{ XFS_BLI_INODE_BUF,	"INODE_BUF" }, \
325f6bed76SDave Chinner 	{ XFS_BLI_ORDERED,	"ORDERED" }
330b1b213fSChristoph Hellwig 
341da177e4SLinus Torvalds /*
351da177e4SLinus Torvalds  * This is the in core log item structure used to track information
361da177e4SLinus Torvalds  * needed to log buffers.  It tracks how many times the lock has been
371da177e4SLinus Torvalds  * locked, and which 128 byte chunks of the buffer are dirty.
381da177e4SLinus Torvalds  */
3970a20655SCarlos Maiolino struct xfs_buf_log_item {
40efe2330fSChristoph Hellwig 	struct xfs_log_item	bli_item;	/* common item structure */
411da177e4SLinus Torvalds 	struct xfs_buf		*bli_buf;	/* real buffer pointer */
421da177e4SLinus Torvalds 	unsigned int		bli_flags;	/* misc flags */
431da177e4SLinus Torvalds 	unsigned int		bli_recur;	/* lock recursion count */
441da177e4SLinus Torvalds 	atomic_t		bli_refcount;	/* cnt of tp refs */
45372cc85eSDave Chinner 	int			bli_format_count;	/* count of headers */
46372cc85eSDave Chinner 	struct xfs_buf_log_format *bli_formats;	/* array of in-log header ptrs */
47b9438173SMark Tinguely 	struct xfs_buf_log_format __bli_format;	/* embedded in-log header */
4870a20655SCarlos Maiolino };
491da177e4SLinus Torvalds 
50f79af0b9SDave Chinner int	xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
51664ffb8aSChristoph Hellwig void	xfs_buf_item_done(struct xfs_buf *bp);
521da177e4SLinus Torvalds void	xfs_buf_item_relse(struct xfs_buf *);
5395808459SBrian Foster bool	xfs_buf_item_put(struct xfs_buf_log_item *);
5470a20655SCarlos Maiolino void	xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
556453c65dSBrian Foster bool	xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
56f593bf14SDave Chinner void	xfs_buf_inode_iodone(struct xfs_buf *);
57664ffb8aSChristoph Hellwig void	xfs_buf_inode_io_fail(struct xfs_buf *bp);
58664ffb8aSChristoph Hellwig #ifdef CONFIG_XFS_QUOTA
590c7e5afbSDave Chinner void	xfs_buf_dquot_iodone(struct xfs_buf *);
60664ffb8aSChristoph Hellwig void	xfs_buf_dquot_io_fail(struct xfs_buf *bp);
61664ffb8aSChristoph Hellwig #else
xfs_buf_dquot_iodone(struct xfs_buf * bp)62664ffb8aSChristoph Hellwig static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
63664ffb8aSChristoph Hellwig {
64664ffb8aSChristoph Hellwig }
xfs_buf_dquot_io_fail(struct xfs_buf * bp)65664ffb8aSChristoph Hellwig static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
66664ffb8aSChristoph Hellwig {
67664ffb8aSChristoph Hellwig }
68664ffb8aSChristoph Hellwig #endif /* CONFIG_XFS_QUOTA */
69b01d1461SDave Chinner void	xfs_buf_iodone(struct xfs_buf *);
708a6453a8SDarrick J. Wong bool	xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
711da177e4SLinus Torvalds 
72182696fbSDarrick J. Wong extern struct kmem_cache	*xfs_buf_item_cache;
731da177e4SLinus Torvalds 
741da177e4SLinus Torvalds #endif	/* __XFS_BUF_ITEM_H__ */
75