^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2000,2005 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __XFS_INODE_ITEM_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __XFS_INODE_ITEM_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /* kernel only definitions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct xfs_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct xfs_bmbt_rec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct xfs_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct xfs_mount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct xfs_inode_log_item {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct xfs_log_item ili_item; /* common portion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct xfs_inode *ili_inode; /* inode ptr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned short ili_lock_flags; /* inode lock flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * The ili_lock protects the interactions between the dirty state and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * the flush state of the inode log item. This allows us to do atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * modifications of multiple state fields without having to hold a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * specific inode lock to serialise them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * We need atomic changes between inode dirtying, inode flushing and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * inode completion, but these all hold different combinations of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * ILOCK and IFLUSHING and hence we need some other method of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * serialising updates to the flush state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) spinlock_t ili_lock; /* flush state lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned int ili_last_fields; /* fields when flushed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) unsigned int ili_fields; /* fields to be logged */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) unsigned int ili_fsync_fields; /* logged since last fsync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) xfs_lsn_t ili_flush_lsn; /* lsn at last flush */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) xfs_lsn_t ili_last_lsn; /* lsn at last transaction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static inline int xfs_inode_clean(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return !ip->i_itemp || !(ip->i_itemp->ili_fields & XFS_ILOG_ALL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) extern void xfs_inode_item_destroy(struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) extern void xfs_iflush_abort(struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct xfs_inode_log_format *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) extern struct kmem_zone *xfs_ili_zone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #endif /* __XFS_INODE_ITEM_H__ */