1
0

xfs_buf_item.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_put(struct xfs_buf_log_item *bip);
  47. void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
  48. bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
  49. void xfs_buf_inode_iodone(struct xfs_buf *);
  50. #ifdef CONFIG_XFS_QUOTA
  51. void xfs_buf_dquot_iodone(struct xfs_buf *);
  52. #else
  53. static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
  54. {
  55. }
  56. #endif /* CONFIG_XFS_QUOTA */
  57. void xfs_buf_iodone(struct xfs_buf *);
  58. bool xfs_buf_log_check_iovec(struct kvec *iovec);
  59. unsigned int xfs_buf_inval_log_space(unsigned int map_count,
  60. unsigned int blocksize);
  61. extern struct kmem_cache *xfs_buf_item_cache;
  62. #endif /* __XFS_BUF_ITEM_H__ */