xfs_extfree_item.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /* kernel only EFI/EFD definitions */
  21. struct xfs_mount;
  22. struct kmem_zone;
  23. /*
  24. * Max number of extents in fast allocation path.
  25. */
  26. #define XFS_EFI_MAX_FAST_EXTENTS 16
  27. /*
  28. * Define EFI flag bits. Manipulated by set/clear/test_bit operators.
  29. */
  30. #define XFS_EFI_RECOVERED 1
  31. /*
  32. * This is the "extent free intention" log item. It is used to log the fact
  33. * that some extents need to be free. It is used in conjunction with the
  34. * "extent free done" log item described below.
  35. *
  36. * The EFI is reference counted so that it is not freed prior to both the EFI
  37. * and EFD being committed and unpinned. This ensures that when the last
  38. * reference goes away the EFI will always be in the AIL as it has been
  39. * unpinned, regardless of whether the EFD is processed before or after the EFI.
  40. */
  41. typedef struct xfs_efi_log_item {
  42. xfs_log_item_t efi_item;
  43. atomic_t efi_refcount;
  44. atomic_t efi_next_extent;
  45. unsigned long efi_flags; /* misc flags */
  46. xfs_efi_log_format_t efi_format;
  47. } xfs_efi_log_item_t;
  48. /*
  49. * This is the "extent free done" log item. It is used to log
  50. * the fact that some extents earlier mentioned in an efi item
  51. * have been freed.
  52. */
  53. typedef struct xfs_efd_log_item {
  54. xfs_log_item_t efd_item;
  55. xfs_efi_log_item_t *efd_efip;
  56. uint efd_next_extent;
  57. xfs_efd_log_format_t efd_format;
  58. } xfs_efd_log_item_t;
  59. /*
  60. * Max number of extents in fast allocation path.
  61. */
  62. #define XFS_EFD_MAX_FAST_EXTENTS 16
  63. extern struct kmem_zone *xfs_efi_zone;
  64. extern struct kmem_zone *xfs_efd_zone;
  65. xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint);
  66. xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *,
  67. uint);
  68. int xfs_efi_copy_format(xfs_log_iovec_t *buf,
  69. xfs_efi_log_format_t *dst_efi_fmt);
  70. void xfs_efi_item_free(xfs_efi_log_item_t *);
  71. #endif /* __XFS_EXTFREE_ITEM_H__ */