0b61f8a4079d9 (Dave Chinner 2018-06-05 19:42:14 -0700 1) // SPDX-License-Identifier: GPL-2.0
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 2) /*
7b71876980d87 (Nathan Scott 2005-11-02 14:58:39 +1100 3) * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
7b71876980d87 (Nathan Scott 2005-11-02 14:58:39 +1100 4) * All Rights Reserved.
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 5) */
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 6) #ifndef __XFS_BUF_ITEM_H__
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 7) #define __XFS_BUF_ITEM_H__
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 8)
a8da0da25c9fd (Dave Chinner 2013-08-12 20:49:24 +1000 9) /* kernel only definitions */
77c1a08fc9ece (Dave Chinner 2012-06-22 18:50:07 +1000 10)
a8da0da25c9fd (Dave Chinner 2013-08-12 20:49:24 +1000 11) /* buf log item flags */
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 12) #define XFS_BLI_HOLD 0x01
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 13) #define XFS_BLI_DIRTY 0x02
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 14) #define XFS_BLI_STALE 0x04
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 15) #define XFS_BLI_LOGGED 0x08
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 16) #define XFS_BLI_INODE_ALLOC_BUF 0x10
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 17) #define XFS_BLI_STALE_INODE 0x20
ccf7c23fc129e (Dave Chinner 2010-05-20 23:19:42 +1000 18) #define XFS_BLI_INODE_BUF 0x40
5f6bed76c0c85 (Dave Chinner 2013-06-27 16:04:52 +1000 19) #define XFS_BLI_ORDERED 0x80
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 20)
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 21) #define XFS_BLI_FLAGS \
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 22) { XFS_BLI_HOLD, "HOLD" }, \
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 23) { XFS_BLI_DIRTY, "DIRTY" }, \
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 24) { XFS_BLI_STALE, "STALE" }, \
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 25) { XFS_BLI_LOGGED, "LOGGED" }, \
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 26) { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
ccf7c23fc129e (Dave Chinner 2010-05-20 23:19:42 +1000 27) { XFS_BLI_STALE_INODE, "STALE_INODE" }, \
5f6bed76c0c85 (Dave Chinner 2013-06-27 16:04:52 +1000 28) { XFS_BLI_INODE_BUF, "INODE_BUF" }, \
5f6bed76c0c85 (Dave Chinner 2013-06-27 16:04:52 +1000 29) { XFS_BLI_ORDERED, "ORDERED" }
0b1b213fcf3a8 (Christoph Hellwig 2009-12-14 23:14:59 +0000 30)
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 31)
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 32) struct xfs_buf;
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 33) struct xfs_mount;
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 34) struct xfs_buf_log_item;
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 35)
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 36) /*
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 37) * This is the in core log item structure used to track information
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 38) * needed to log buffers. It tracks how many times the lock has been
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 39) * locked, and which 128 byte chunks of the buffer are dirty.
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 40) */
70a20655339ab (Carlos Maiolino 2018-01-24 13:38:48 -0800 41) struct xfs_buf_log_item {
efe2330fdc246 (Christoph Hellwig 2019-06-28 19:27:33 -0700 42) struct xfs_log_item bli_item; /* common item structure */
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 43) struct xfs_buf *bli_buf; /* real buffer pointer */
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 44) unsigned int bli_flags; /* misc flags */
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 45) unsigned int bli_recur; /* lock recursion count */
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 46) atomic_t bli_refcount; /* cnt of tp refs */
372cc85ec6820 (Dave Chinner 2012-06-22 18:50:12 +1000 47) int bli_format_count; /* count of headers */
372cc85ec6820 (Dave Chinner 2012-06-22 18:50:12 +1000 48) struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */
b94381737e9c4 (Mark Tinguely 2012-12-04 17:18:03 -0600 49) struct xfs_buf_log_format __bli_format; /* embedded in-log header */
70a20655339ab (Carlos Maiolino 2018-01-24 13:38:48 -0800 50) };
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 51)
f79af0b909089 (Dave Chinner 2015-08-25 10:05:13 +1000 52) int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 53) void xfs_buf_item_done(struct xfs_buf *bp);
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 54) void xfs_buf_item_relse(struct xfs_buf *);
95808459b110f (Brian Foster 2018-09-29 13:45:26 +1000 55) bool xfs_buf_item_put(struct xfs_buf_log_item *);
70a20655339ab (Carlos Maiolino 2018-01-24 13:38:48 -0800 56) void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
6453c65d3576b (Brian Foster 2017-08-29 10:08:37 -0700 57) bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
f593bf144c7df (Dave Chinner 2020-06-29 14:48:46 -0700 58) void xfs_buf_inode_iodone(struct xfs_buf *);
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 59) void xfs_buf_inode_io_fail(struct xfs_buf *bp);
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 60) #ifdef CONFIG_XFS_QUOTA
0c7e5afbea996 (Dave Chinner 2020-06-29 14:48:46 -0700 61) void xfs_buf_dquot_iodone(struct xfs_buf *);
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 62) void xfs_buf_dquot_io_fail(struct xfs_buf *bp);
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 63) #else
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 64) static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 65) {
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 66) }
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 67) static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 68) {
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 69) }
664ffb8a429a8 (Christoph Hellwig 2020-09-01 10:55:29 -0700 70) #endif /* CONFIG_XFS_QUOTA */
b01d1461ae6d9 (Dave Chinner 2020-06-29 14:48:47 -0700 71) void xfs_buf_iodone(struct xfs_buf *);
8a6453a89dc10 (Darrick J. Wong 2020-01-13 16:33:46 -0800 72) bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 73)
a8da0da25c9fd (Dave Chinner 2013-08-12 20:49:24 +1000 74) extern kmem_zone_t *xfs_buf_item_zone;
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 75)
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 76) #endif /* __XFS_BUF_ITEM_H__ */