xfs_extfree_item.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_EXTFREE_ITEM_H__
  33. #define __XFS_EXTFREE_ITEM_H__
  34. struct xfs_mount;
  35. struct kmem_zone;
  36. typedef struct xfs_extent {
  37. xfs_dfsbno_t ext_start;
  38. xfs_extlen_t ext_len;
  39. } xfs_extent_t;
  40. /*
  41. * This is the structure used to lay out an efi log item in the
  42. * log. The efi_extents field is a variable size array whose
  43. * size is given by efi_nextents.
  44. */
  45. typedef struct xfs_efi_log_format {
  46. unsigned short efi_type; /* efi log item type */
  47. unsigned short efi_size; /* size of this item */
  48. uint efi_nextents; /* # extents to free */
  49. __uint64_t efi_id; /* efi identifier */
  50. xfs_extent_t efi_extents[1]; /* array of extents to free */
  51. } xfs_efi_log_format_t;
  52. /*
  53. * This is the structure used to lay out an efd log item in the
  54. * log. The efd_extents array is a variable size array whose
  55. * size is given by efd_nextents;
  56. */
  57. typedef struct xfs_efd_log_format {
  58. unsigned short efd_type; /* efd log item type */
  59. unsigned short efd_size; /* size of this item */
  60. uint efd_nextents; /* # of extents freed */
  61. __uint64_t efd_efi_id; /* id of corresponding efi */
  62. xfs_extent_t efd_extents[1]; /* array of extents freed */
  63. } xfs_efd_log_format_t;
  64. #ifdef __KERNEL__
  65. /*
  66. * Max number of extents in fast allocation path.
  67. */
  68. #define XFS_EFI_MAX_FAST_EXTENTS 16
  69. /*
  70. * Define EFI flags.
  71. */
  72. #define XFS_EFI_RECOVERED 0x1
  73. #define XFS_EFI_COMMITTED 0x2
  74. #define XFS_EFI_CANCELED 0x4
  75. /*
  76. * This is the "extent free intention" log item. It is used
  77. * to log the fact that some extents need to be free. It is
  78. * used in conjunction with the "extent free done" log item
  79. * described below.
  80. */
  81. typedef struct xfs_efi_log_item {
  82. xfs_log_item_t efi_item;
  83. uint efi_flags; /* misc flags */
  84. uint efi_next_extent;
  85. xfs_efi_log_format_t efi_format;
  86. } xfs_efi_log_item_t;
  87. /*
  88. * This is the "extent free done" log item. It is used to log
  89. * the fact that some extents earlier mentioned in an efi item
  90. * have been freed.
  91. */
  92. typedef struct xfs_efd_log_item {
  93. xfs_log_item_t efd_item;
  94. xfs_efi_log_item_t *efd_efip;
  95. uint efd_next_extent;
  96. xfs_efd_log_format_t efd_format;
  97. } xfs_efd_log_item_t;
  98. /*
  99. * Max number of extents in fast allocation path.
  100. */
  101. #define XFS_EFD_MAX_FAST_EXTENTS 16
  102. extern struct kmem_zone *xfs_efi_zone;
  103. extern struct kmem_zone *xfs_efd_zone;
  104. xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint);
  105. xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *,
  106. uint);
  107. void xfs_efi_item_free(xfs_efi_log_item_t *);
  108. #endif /* __KERNEL__ */
  109. #endif /* __XFS_EXTFREE_ITEM_H__ */