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