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 { 42efe2330fSChristoph 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 *); 53664ffb8aSChristoph Hellwig void xfs_buf_item_done(struct xfs_buf *bp); 541da177e4SLinus Torvalds void xfs_buf_item_relse(struct xfs_buf *); 5595808459SBrian Foster bool xfs_buf_item_put(struct xfs_buf_log_item *); 5670a20655SCarlos Maiolino void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint); 576453c65dSBrian Foster bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *); 58f593bf14SDave Chinner void xfs_buf_inode_iodone(struct xfs_buf *); 59664ffb8aSChristoph Hellwig void xfs_buf_inode_io_fail(struct xfs_buf *bp); 60664ffb8aSChristoph Hellwig #ifdef CONFIG_XFS_QUOTA 610c7e5afbSDave Chinner void xfs_buf_dquot_iodone(struct xfs_buf *); 62664ffb8aSChristoph Hellwig void xfs_buf_dquot_io_fail(struct xfs_buf *bp); 63664ffb8aSChristoph Hellwig #else 64664ffb8aSChristoph Hellwig static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp) 65664ffb8aSChristoph Hellwig { 66664ffb8aSChristoph Hellwig } 67664ffb8aSChristoph Hellwig static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp) 68664ffb8aSChristoph Hellwig { 69664ffb8aSChristoph Hellwig } 70664ffb8aSChristoph Hellwig #endif /* CONFIG_XFS_QUOTA */ 71b01d1461SDave Chinner void xfs_buf_iodone(struct xfs_buf *); 728a6453a8SDarrick J. Wong bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec); 731da177e4SLinus Torvalds 74*182696fbSDarrick J. Wong extern struct kmem_cache *xfs_buf_item_cache; 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds #endif /* __XFS_BUF_ITEM_H__ */ 77