xref: /openbmc/linux/fs/xfs/xfs_inode_item.h (revision 82842fee)
10b61f8a4SDave Chinner // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
37b718769SNathan Scott  * Copyright (c) 2000,2005 Silicon Graphics, Inc.
47b718769SNathan Scott  * All Rights Reserved.
51da177e4SLinus Torvalds  */
61da177e4SLinus Torvalds #ifndef	__XFS_INODE_ITEM_H__
71da177e4SLinus Torvalds #define	__XFS_INODE_ITEM_H__
81da177e4SLinus Torvalds 
969432832SDave Chinner /* kernel only definitions */
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds struct xfs_buf;
12a5f9be58SChristoph Hellwig struct xfs_bmbt_rec;
131da177e4SLinus Torvalds struct xfs_inode;
141da177e4SLinus Torvalds struct xfs_mount;
151da177e4SLinus Torvalds 
16fd9cbe51SChristoph Hellwig struct xfs_inode_log_item {
17efe2330fSChristoph Hellwig 	struct xfs_log_item	ili_item;	   /* common portion */
181da177e4SLinus Torvalds 	struct xfs_inode	*ili_inode;	   /* inode ptr */
191319ebefSDave Chinner 	unsigned short		ili_lock_flags;	   /* inode lock flags */
20*82842feeSDave Chinner 	unsigned int		ili_dirty_flags;   /* dirty in current tx */
211319ebefSDave Chinner 	/*
221319ebefSDave Chinner 	 * The ili_lock protects the interactions between the dirty state and
231319ebefSDave Chinner 	 * the flush state of the inode log item. This allows us to do atomic
241319ebefSDave Chinner 	 * modifications of multiple state fields without having to hold a
251319ebefSDave Chinner 	 * specific inode lock to serialise them.
261319ebefSDave Chinner 	 *
271319ebefSDave Chinner 	 * We need atomic changes between inode dirtying, inode flushing and
281319ebefSDave Chinner 	 * inode completion, but these all hold different combinations of
29718ecc50SDave Chinner 	 * ILOCK and IFLUSHING and hence we need some other method of
30718ecc50SDave Chinner 	 * serialising updates to the flush state.
311319ebefSDave Chinner 	 */
321319ebefSDave Chinner 	spinlock_t		ili_lock;	   /* flush state lock */
331da177e4SLinus Torvalds 	unsigned int		ili_last_fields;   /* fields when flushed */
34f5d8d5c4SChristoph Hellwig 	unsigned int		ili_fields;	   /* fields to be logged */
35fc0561ceSDave Chinner 	unsigned int		ili_fsync_fields;  /* logged since last fsync */
361319ebefSDave Chinner 	xfs_lsn_t		ili_flush_lsn;	   /* lsn at last flush */
375f9b4b0dSDave Chinner 	xfs_csn_t		ili_commit_seq;	   /* last transaction commit */
38fd9cbe51SChristoph Hellwig };
391da177e4SLinus Torvalds 
xfs_inode_clean(struct xfs_inode * ip)40aac855abSDave Chinner static inline int xfs_inode_clean(struct xfs_inode *ip)
4133540408SDavid Chinner {
42f5d8d5c4SChristoph Hellwig 	return !ip->i_itemp || !(ip->i_itemp->ili_fields & XFS_ILOG_ALL);
4333540408SDavid Chinner }
4433540408SDavid Chinner 
45a844f451SNathan Scott extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
46a844f451SNathan Scott extern void xfs_inode_item_destroy(struct xfs_inode *);
4788fc1879SBrian Foster extern void xfs_iflush_abort(struct xfs_inode *);
48d2d7c047SDave Chinner extern void xfs_iflush_shutdown_abort(struct xfs_inode *);
496d192a9bSTim Shimmin extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
5006b11321SDarrick J. Wong 					 struct xfs_inode_log_format *);
511da177e4SLinus Torvalds 
52182696fbSDarrick J. Wong extern struct kmem_cache	*xfs_ili_cache;
531da177e4SLinus Torvalds 
541da177e4SLinus Torvalds #endif	/* __XFS_INODE_ITEM_H__ */
55