xfs_extfree_item.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (c) 2000,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_EXTFREE_ITEM_H__
  19. #define __XFS_EXTFREE_ITEM_H__
  20. struct xfs_mount;
  21. struct kmem_zone;
  22. typedef struct xfs_extent {
  23. xfs_dfsbno_t ext_start;
  24. xfs_extlen_t ext_len;
  25. } xfs_extent_t;
  26. /*
  27. * This is the structure used to lay out an efi log item in the
  28. * log. The efi_extents field is a variable size array whose
  29. * size is given by efi_nextents.
  30. */
  31. typedef struct xfs_efi_log_format {
  32. unsigned short efi_type; /* efi log item type */
  33. unsigned short efi_size; /* size of this item */
  34. uint efi_nextents; /* # extents to free */
  35. __uint64_t efi_id; /* efi identifier */
  36. xfs_extent_t efi_extents[1]; /* array of extents to free */
  37. } xfs_efi_log_format_t;
  38. /*
  39. * This is the structure used to lay out an efd log item in the
  40. * log. The efd_extents array is a variable size array whose
  41. * size is given by efd_nextents;
  42. */
  43. typedef struct xfs_efd_log_format {
  44. unsigned short efd_type; /* efd log item type */
  45. unsigned short efd_size; /* size of this item */
  46. uint efd_nextents; /* # of extents freed */
  47. __uint64_t efd_efi_id; /* id of corresponding efi */
  48. xfs_extent_t efd_extents[1]; /* array of extents freed */
  49. } xfs_efd_log_format_t;
  50. #ifdef __KERNEL__
  51. /*
  52. * Max number of extents in fast allocation path.
  53. */
  54. #define XFS_EFI_MAX_FAST_EXTENTS 16
  55. /*
  56. * Define EFI flags.
  57. */
  58. #define XFS_EFI_RECOVERED 0x1
  59. #define XFS_EFI_COMMITTED 0x2
  60. #define XFS_EFI_CANCELED 0x4
  61. /*
  62. * This is the "extent free intention" log item. It is used
  63. * to log the fact that some extents need to be free. It is
  64. * used in conjunction with the "extent free done" log item
  65. * described below.
  66. */
  67. typedef struct xfs_efi_log_item {
  68. xfs_log_item_t efi_item;
  69. uint efi_flags; /* misc flags */
  70. uint efi_next_extent;
  71. xfs_efi_log_format_t efi_format;
  72. } xfs_efi_log_item_t;
  73. /*
  74. * This is the "extent free done" log item. It is used to log
  75. * the fact that some extents earlier mentioned in an efi item
  76. * have been freed.
  77. */
  78. typedef struct xfs_efd_log_item {
  79. xfs_log_item_t efd_item;
  80. xfs_efi_log_item_t *efd_efip;
  81. uint efd_next_extent;
  82. xfs_efd_log_format_t efd_format;
  83. } xfs_efd_log_item_t;
  84. /*
  85. * Max number of extents in fast allocation path.
  86. */
  87. #define XFS_EFD_MAX_FAST_EXTENTS 16
  88. extern struct kmem_zone *xfs_efi_zone;
  89. extern struct kmem_zone *xfs_efd_zone;
  90. xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint);
  91. xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *,
  92. uint);
  93. void xfs_efi_item_free(xfs_efi_log_item_t *);
  94. #endif /* __KERNEL__ */
  95. #endif /* __XFS_EXTFREE_ITEM_H__ */