xfs_buf_item.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
  4. * All Rights Reserved.
  5. */
  6. #ifndef __XFS_BUF_ITEM_H__
  7. #define __XFS_BUF_ITEM_H__
  8. /* kernel only definitions */
  9. struct xfs_buf;
  10. struct xfs_mount;
  11. /* buf log item flags */
  12. #define XFS_BLI_HOLD (1u << 0)
  13. #define XFS_BLI_DIRTY (1u << 1)
  14. #define XFS_BLI_STALE (1u << 2)
  15. #define XFS_BLI_LOGGED (1u << 3)
  16. #define XFS_BLI_INODE_ALLOC_BUF (1u << 4)
  17. #define XFS_BLI_STALE_INODE (1u << 5)
  18. #define XFS_BLI_INODE_BUF (1u << 6)
  19. #define XFS_BLI_ORDERED (1u << 7)
  20. #define XFS_BLI_FLAGS \
  21. { XFS_BLI_HOLD, "HOLD" }, \
  22. { XFS_BLI_DIRTY, "DIRTY" }, \
  23. { XFS_BLI_STALE, "STALE" }, \
  24. { XFS_BLI_LOGGED, "LOGGED" }, \
  25. { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
  26. { XFS_BLI_STALE_INODE, "STALE_INODE" }, \
  27. { XFS_BLI_INODE_BUF, "INODE_BUF" }, \
  28. { XFS_BLI_ORDERED, "ORDERED" }
  29. /*
  30. * This is the in core log item structure used to track information
  31. * needed to log buffers. It tracks how many times the lock has been
  32. * locked, and which 128 byte chunks of the buffer are dirty.
  33. */
  34. struct xfs_buf_log_item {
  35. struct xfs_log_item bli_item; /* common item structure */
  36. struct xfs_buf *bli_buf; /* real buffer pointer */
  37. unsigned int bli_flags; /* misc flags */
  38. unsigned int bli_recur; /* lock recursion count */
  39. atomic_t bli_refcount; /* cnt of tp refs */
  40. int bli_format_count; /* count of headers */
  41. struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */
  42. struct xfs_buf_log_format __bli_format; /* embedded in-log header */
  43. };
  44. int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
  45. void xfs_buf_item_done(struct xfs_buf *bp);
  46. void xfs_buf_item_relse(struct xfs_buf *);
  47. bool xfs_buf_item_put(struct xfs_buf_log_item *);
  48. void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
  49. bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
  50. void xfs_buf_inode_iodone(struct xfs_buf *);
  51. void xfs_buf_inode_io_fail(struct xfs_buf *bp);
  52. #ifdef CONFIG_XFS_QUOTA
  53. void xfs_buf_dquot_iodone(struct xfs_buf *);
  54. void xfs_buf_dquot_io_fail(struct xfs_buf *bp);
  55. #else
  56. static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
  57. {
  58. }
  59. static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
  60. {
  61. }
  62. #endif /* CONFIG_XFS_QUOTA */
  63. void xfs_buf_iodone(struct xfs_buf *);
  64. bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
  65. extern struct kmem_cache *xfs_buf_item_cache;
  66. #endif /* __XFS_BUF_ITEM_H__ */