xfs_buf_item.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_BUF_ITEM_H__
  19. #define __XFS_BUF_ITEM_H__
  20. /* kernel only definitions */
  21. /* buf log item flags */
  22. #define XFS_BLI_HOLD 0x01
  23. #define XFS_BLI_DIRTY 0x02
  24. #define XFS_BLI_STALE 0x04
  25. #define XFS_BLI_LOGGED 0x08
  26. #define XFS_BLI_INODE_ALLOC_BUF 0x10
  27. #define XFS_BLI_STALE_INODE 0x20
  28. #define XFS_BLI_INODE_BUF 0x40
  29. #define XFS_BLI_ORDERED 0x80
  30. #define XFS_BLI_FLAGS \
  31. { XFS_BLI_HOLD, "HOLD" }, \
  32. { XFS_BLI_DIRTY, "DIRTY" }, \
  33. { XFS_BLI_STALE, "STALE" }, \
  34. { XFS_BLI_LOGGED, "LOGGED" }, \
  35. { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
  36. { XFS_BLI_STALE_INODE, "STALE_INODE" }, \
  37. { XFS_BLI_INODE_BUF, "INODE_BUF" }, \
  38. { XFS_BLI_ORDERED, "ORDERED" }
  39. struct xfs_buf;
  40. struct xfs_mount;
  41. struct xfs_buf_log_item;
  42. /*
  43. * This is the in core log item structure used to track information
  44. * needed to log buffers. It tracks how many times the lock has been
  45. * locked, and which 128 byte chunks of the buffer are dirty.
  46. */
  47. typedef struct xfs_buf_log_item {
  48. xfs_log_item_t bli_item; /* common item structure */
  49. struct xfs_buf *bli_buf; /* real buffer pointer */
  50. unsigned int bli_flags; /* misc flags */
  51. unsigned int bli_recur; /* lock recursion count */
  52. atomic_t bli_refcount; /* cnt of tp refs */
  53. int bli_format_count; /* count of headers */
  54. struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */
  55. struct xfs_buf_log_format __bli_format; /* embedded in-log header */
  56. } xfs_buf_log_item_t;
  57. int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
  58. void xfs_buf_item_relse(struct xfs_buf *);
  59. void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
  60. uint xfs_buf_item_dirty(xfs_buf_log_item_t *);
  61. void xfs_buf_attach_iodone(struct xfs_buf *,
  62. void(*)(struct xfs_buf *, xfs_log_item_t *),
  63. xfs_log_item_t *);
  64. void xfs_buf_iodone_callbacks(struct xfs_buf *);
  65. void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *);
  66. extern kmem_zone_t *xfs_buf_item_zone;
  67. #endif /* __XFS_BUF_ITEM_H__ */