xref: /linux/fs/xfs/xfs_buf_item.h (revision efe2330fdc246a29b36f94f3c8bd8896b88dca6d)
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 
11a8da0da2SDave Chinner /* buf log item flags */
121da177e4SLinus Torvalds #define	XFS_BLI_HOLD		0x01
131da177e4SLinus Torvalds #define	XFS_BLI_DIRTY		0x02
141da177e4SLinus Torvalds #define	XFS_BLI_STALE		0x04
151da177e4SLinus Torvalds #define	XFS_BLI_LOGGED		0x08
161da177e4SLinus Torvalds #define	XFS_BLI_INODE_ALLOC_BUF	0x10
171da177e4SLinus Torvalds #define XFS_BLI_STALE_INODE	0x20
18ccf7c23fSDave Chinner #define	XFS_BLI_INODE_BUF	0x40
195f6bed76SDave Chinner #define	XFS_BLI_ORDERED		0x80
201da177e4SLinus Torvalds 
210b1b213fSChristoph Hellwig #define XFS_BLI_FLAGS \
220b1b213fSChristoph Hellwig 	{ XFS_BLI_HOLD,		"HOLD" }, \
230b1b213fSChristoph Hellwig 	{ XFS_BLI_DIRTY,	"DIRTY" }, \
240b1b213fSChristoph Hellwig 	{ XFS_BLI_STALE,	"STALE" }, \
250b1b213fSChristoph Hellwig 	{ XFS_BLI_LOGGED,	"LOGGED" }, \
260b1b213fSChristoph Hellwig 	{ XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
27ccf7c23fSDave Chinner 	{ XFS_BLI_STALE_INODE,	"STALE_INODE" }, \
285f6bed76SDave Chinner 	{ XFS_BLI_INODE_BUF,	"INODE_BUF" }, \
295f6bed76SDave Chinner 	{ XFS_BLI_ORDERED,	"ORDERED" }
300b1b213fSChristoph Hellwig 
311da177e4SLinus Torvalds 
321da177e4SLinus Torvalds struct xfs_buf;
331da177e4SLinus Torvalds struct xfs_mount;
341da177e4SLinus Torvalds struct xfs_buf_log_item;
351da177e4SLinus Torvalds 
361da177e4SLinus Torvalds /*
371da177e4SLinus Torvalds  * This is the in core log item structure used to track information
381da177e4SLinus Torvalds  * needed to log buffers.  It tracks how many times the lock has been
391da177e4SLinus Torvalds  * locked, and which 128 byte chunks of the buffer are dirty.
401da177e4SLinus Torvalds  */
4170a20655SCarlos Maiolino struct xfs_buf_log_item {
42*efe2330fSChristoph Hellwig 	struct xfs_log_item	bli_item;	/* common item structure */
431da177e4SLinus Torvalds 	struct xfs_buf		*bli_buf;	/* real buffer pointer */
441da177e4SLinus Torvalds 	unsigned int		bli_flags;	/* misc flags */
451da177e4SLinus Torvalds 	unsigned int		bli_recur;	/* lock recursion count */
461da177e4SLinus Torvalds 	atomic_t		bli_refcount;	/* cnt of tp refs */
47372cc85eSDave Chinner 	int			bli_format_count;	/* count of headers */
48372cc85eSDave Chinner 	struct xfs_buf_log_format *bli_formats;	/* array of in-log header ptrs */
49b9438173SMark Tinguely 	struct xfs_buf_log_format __bli_format;	/* embedded in-log header */
5070a20655SCarlos Maiolino };
511da177e4SLinus Torvalds 
52f79af0b9SDave Chinner int	xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
531da177e4SLinus Torvalds void	xfs_buf_item_relse(struct xfs_buf *);
5495808459SBrian Foster bool	xfs_buf_item_put(struct xfs_buf_log_item *);
5570a20655SCarlos Maiolino void	xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
566453c65dSBrian Foster bool	xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
571da177e4SLinus Torvalds void	xfs_buf_attach_iodone(struct xfs_buf *,
58*efe2330fSChristoph Hellwig 			      void(*)(struct xfs_buf *, struct xfs_log_item *),
59*efe2330fSChristoph Hellwig 			      struct xfs_log_item *);
601da177e4SLinus Torvalds void	xfs_buf_iodone_callbacks(struct xfs_buf *);
61ca30b2a7SChristoph Hellwig void	xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *);
62d3a304b6SCarlos Maiolino bool	xfs_buf_resubmit_failed_buffers(struct xfs_buf *,
63d3a304b6SCarlos Maiolino 					struct list_head *);
641da177e4SLinus Torvalds 
65a8da0da2SDave Chinner extern kmem_zone_t	*xfs_buf_item_zone;
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds #endif	/* __XFS_BUF_ITEM_H__ */
68