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