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
11struct xfs_buf;
12struct 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 */
39struct 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
50int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
51void xfs_buf_item_done(struct xfs_buf *bp);
52void xfs_buf_item_put(struct xfs_buf_log_item *bip);
53void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
54bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
55void xfs_buf_inode_iodone(struct xfs_buf *);
56#ifdef CONFIG_XFS_QUOTA
57void xfs_buf_dquot_iodone(struct xfs_buf *);
58#else
59static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
60{
61}
62#endif /* CONFIG_XFS_QUOTA */
63void xfs_buf_iodone(struct xfs_buf *);
64bool xfs_buf_log_check_iovec(struct kvec *iovec);
65
66unsigned int xfs_buf_inval_log_space(unsigned int map_count,
67 unsigned int blocksize);
68
69extern struct kmem_cache *xfs_buf_item_cache;
70
71#endif /* __XFS_BUF_ITEM_H__ */
72

source code of linux/fs/xfs/xfs_buf_item.h