dm-space-map-metadata.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2011 Red Hat, Inc.
  3. *
  4. * This file is released under the GPL.
  5. */
  6. #ifndef DM_SPACE_MAP_METADATA_H
  7. #define DM_SPACE_MAP_METADATA_H
  8. #include "dm-transaction-manager.h"
  9. #define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT)
  10. /*
  11. * The metadata device is currently limited in size.
  12. *
  13. * We have one block of index, which can hold 255 index entries. Each
  14. * index entry contains allocation info about ~16k metadata blocks.
  15. */
  16. #define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64))
  17. #define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE)
  18. /*
  19. * Unfortunately we have to use two-phase construction due to the cycle
  20. * between the tm and sm.
  21. */
  22. struct dm_space_map *dm_sm_metadata_init(void);
  23. /*
  24. * Create a fresh space map.
  25. */
  26. int dm_sm_metadata_create(struct dm_space_map *sm,
  27. struct dm_transaction_manager *tm,
  28. dm_block_t nr_blocks,
  29. dm_block_t superblock);
  30. /*
  31. * Open from a previously-recorded root.
  32. */
  33. int dm_sm_metadata_open(struct dm_space_map *sm,
  34. struct dm_transaction_manager *tm,
  35. void *root_le, size_t len);
  36. #endif /* DM_SPACE_MAP_METADATA_H */