xfs_inode_item.h 1.9 KB

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