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,2005 Silicon Graphics, Inc. |
| 4 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | */ |
| 6 | #ifndef __XFS_INODE_ITEM_H__ |
| 7 | #define __XFS_INODE_ITEM_H__ |
| 8 | |
Dave Chinner | 6943283 | 2013-08-12 20:49:23 +1000 | [diff] [blame] | 9 | /* kernel only definitions */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
| 11 | struct xfs_buf; |
Christoph Hellwig | a5f9be5 | 2009-12-04 10:19:07 +0000 | [diff] [blame] | 12 | struct xfs_bmbt_rec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | struct xfs_inode; |
| 14 | struct xfs_mount; |
| 15 | |
Christoph Hellwig | fd9cbe5 | 2020-04-30 12:52:19 -0700 | [diff] [blame] | 16 | struct xfs_inode_log_item { |
Christoph Hellwig | efe2330 | 2019-06-28 19:27:33 -0700 | [diff] [blame] | 17 | struct xfs_log_item ili_item; /* common portion */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | struct xfs_inode *ili_inode; /* inode ptr */ |
Dave Chinner | 1319ebe | 2020-06-29 14:48:46 -0700 | [diff] [blame^] | 19 | unsigned short ili_lock_flags; /* inode lock flags */ |
| 20 | /* |
| 21 | * The ili_lock protects the interactions between the dirty state and |
| 22 | * the flush state of the inode log item. This allows us to do atomic |
| 23 | * modifications of multiple state fields without having to hold a |
| 24 | * specific inode lock to serialise them. |
| 25 | * |
| 26 | * We need atomic changes between inode dirtying, inode flushing and |
| 27 | * inode completion, but these all hold different combinations of |
| 28 | * ILOCK and iflock and hence we need some other method of serialising |
| 29 | * updates to the flush state. |
| 30 | */ |
| 31 | spinlock_t ili_lock; /* flush state lock */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | unsigned int ili_last_fields; /* fields when flushed */ |
Christoph Hellwig | f5d8d5c | 2012-02-29 09:53:54 +0000 | [diff] [blame] | 33 | unsigned int ili_fields; /* fields to be logged */ |
Dave Chinner | fc0561c | 2015-11-03 13:14:59 +1100 | [diff] [blame] | 34 | unsigned int ili_fsync_fields; /* logged since last fsync */ |
Dave Chinner | 1319ebe | 2020-06-29 14:48:46 -0700 | [diff] [blame^] | 35 | xfs_lsn_t ili_flush_lsn; /* lsn at last flush */ |
| 36 | xfs_lsn_t ili_last_lsn; /* lsn at last transaction */ |
Christoph Hellwig | fd9cbe5 | 2020-04-30 12:52:19 -0700 | [diff] [blame] | 37 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
David Chinner | 3354040 | 2008-03-06 13:43:59 +1100 | [diff] [blame] | 39 | static inline int xfs_inode_clean(xfs_inode_t *ip) |
| 40 | { |
Christoph Hellwig | f5d8d5c | 2012-02-29 09:53:54 +0000 | [diff] [blame] | 41 | return !ip->i_itemp || !(ip->i_itemp->ili_fields & XFS_ILOG_ALL); |
David Chinner | 3354040 | 2008-03-06 13:43:59 +1100 | [diff] [blame] | 42 | } |
| 43 | |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 44 | extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); |
| 45 | extern void xfs_inode_item_destroy(struct xfs_inode *); |
Christoph Hellwig | ca30b2a | 2010-06-23 18:11:15 +1000 | [diff] [blame] | 46 | extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *); |
| 47 | extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *); |
Brian Foster | 88fc187 | 2020-05-06 13:27:40 -0700 | [diff] [blame] | 48 | extern void xfs_iflush_abort(struct xfs_inode *); |
Tim Shimmin | 6d192a9 | 2006-06-09 14:55:38 +1000 | [diff] [blame] | 49 | extern int xfs_inode_item_format_convert(xfs_log_iovec_t *, |
Darrick J. Wong | 06b1132 | 2017-10-31 12:04:24 -0700 | [diff] [blame] | 50 | struct xfs_inode_log_format *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Dave Chinner | 6943283 | 2013-08-12 20:49:23 +1000 | [diff] [blame] | 52 | extern struct kmem_zone *xfs_ili_zone; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
| 54 | #endif /* __XFS_INODE_ITEM_H__ */ |