xfs_bmap_item.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Oracle. All Rights Reserved.
  4. * Author: Darrick J. Wong <darrick.wong@oracle.com>
  5. */
  6. #ifndef __XFS_BMAP_ITEM_H__
  7. #define __XFS_BMAP_ITEM_H__
  8. /*
  9. * There are (currently) two pairs of bmap btree redo item types: map & unmap.
  10. * The common abbreviations for these are BUI (bmap update intent) and BUD
  11. * (bmap update done). The redo item type is encoded in the flags field of
  12. * each xfs_map_extent.
  13. *
  14. * *I items should be recorded in the *first* of a series of rolled
  15. * transactions, and the *D items should be recorded in the same transaction
  16. * that records the associated bmbt updates.
  17. *
  18. * Should the system crash after the commit of the first transaction but
  19. * before the commit of the final transaction in a series, log recovery will
  20. * use the redo information recorded by the intent items to replay the
  21. * bmbt metadata updates in the non-first transaction.
  22. */
  23. /* kernel only BUI/BUD definitions */
  24. struct xfs_mount;
  25. struct kmem_zone;
  26. /*
  27. * Max number of extents in fast allocation path.
  28. */
  29. #define XFS_BUI_MAX_FAST_EXTENTS 1
  30. /*
  31. * This is the "bmap update intent" log item. It is used to log the fact that
  32. * some reverse mappings need to change. It is used in conjunction with the
  33. * "bmap update done" log item described below.
  34. *
  35. * These log items follow the same rules as struct xfs_efi_log_item; see the
  36. * comments about that structure (in xfs_extfree_item.h) for more details.
  37. */
  38. struct xfs_bui_log_item {
  39. struct xfs_log_item bui_item;
  40. atomic_t bui_refcount;
  41. atomic_t bui_next_extent;
  42. struct xfs_bui_log_format bui_format;
  43. };
  44. static inline size_t
  45. xfs_bui_log_item_sizeof(
  46. unsigned int nr)
  47. {
  48. return offsetof(struct xfs_bui_log_item, bui_format) +
  49. xfs_bui_log_format_sizeof(nr);
  50. }
  51. /*
  52. * This is the "bmap update done" log item. It is used to log the fact that
  53. * some bmbt updates mentioned in an earlier bui item have been performed.
  54. */
  55. struct xfs_bud_log_item {
  56. struct xfs_log_item bud_item;
  57. struct xfs_bui_log_item *bud_buip;
  58. struct xfs_bud_log_format bud_format;
  59. };
  60. extern struct kmem_zone *xfs_bui_zone;
  61. extern struct kmem_zone *xfs_bud_zone;
  62. #endif /* __XFS_BMAP_ITEM_H__ */