Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / fs / xfs / xfs_buf_item.h
CommitLineData
0b61f8a4 1// SPDX-License-Identifier: GPL-2.0
1da177e4 2/*
7b718769
NS
3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
1da177e4
LT
5 */
6#ifndef __XFS_BUF_ITEM_H__
7#define __XFS_BUF_ITEM_H__
8
a8da0da2 9/* kernel only definitions */
77c1a08f 10
581b4484
DC
11struct xfs_buf;
12struct xfs_mount;
13
a8da0da2 14/* buf log item flags */
581b4484
DC
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)
1da177e4 23
0b1b213f
CH
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" }, \
ccf7c23f 30 { XFS_BLI_STALE_INODE, "STALE_INODE" }, \
5f6bed76
DC
31 { XFS_BLI_INODE_BUF, "INODE_BUF" }, \
32 { XFS_BLI_ORDERED, "ORDERED" }
0b1b213f 33
1da177e4
LT
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 */
70a20655 39struct xfs_buf_log_item {
efe2330f 40 struct xfs_log_item bli_item; /* common item structure */
1da177e4
LT
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 */
372cc85e
DC
45 int bli_format_count; /* count of headers */
46 struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */
b9438173 47 struct xfs_buf_log_format __bli_format; /* embedded in-log header */
70a20655 48};
1da177e4 49
f79af0b9 50int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
664ffb8a 51void xfs_buf_item_done(struct xfs_buf *bp);
1da177e4 52void xfs_buf_item_relse(struct xfs_buf *);
95808459 53bool xfs_buf_item_put(struct xfs_buf_log_item *);
70a20655 54void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
6453c65d 55bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
f593bf14 56void xfs_buf_inode_iodone(struct xfs_buf *);
664ffb8a
CH
57void xfs_buf_inode_io_fail(struct xfs_buf *bp);
58#ifdef CONFIG_XFS_QUOTA
0c7e5afb 59void xfs_buf_dquot_iodone(struct xfs_buf *);
664ffb8a
CH
60void xfs_buf_dquot_io_fail(struct xfs_buf *bp);
61#else
62static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
63{
64}
65static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
66{
67}
68#endif /* CONFIG_XFS_QUOTA */
b01d1461 69void xfs_buf_iodone(struct xfs_buf *);
8a6453a8 70bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
1da177e4 71
182696fb 72extern struct kmem_cache *xfs_buf_item_cache;
1da177e4
LT
73
74#endif /* __XFS_BUF_ITEM_H__ */