constants.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright 2023 Red Hat
  4. */
  5. #ifndef VDO_CONSTANTS_H
  6. #define VDO_CONSTANTS_H
  7. #include <linux/blkdev.h>
  8. #include "types.h"
  9. enum {
  10. /*
  11. * The maximum number of contiguous PBNs which will go to a single bio submission queue,
  12. * assuming there is more than one queue.
  13. */
  14. VDO_BIO_ROTATION_INTERVAL_LIMIT = 1024,
  15. /* The number of entries on a block map page */
  16. VDO_BLOCK_MAP_ENTRIES_PER_PAGE = 812,
  17. /* The origin of the flat portion of the block map */
  18. VDO_BLOCK_MAP_FLAT_PAGE_ORIGIN = 1,
  19. /*
  20. * The height of a block map tree. Assuming a root count of 60 and 812 entries per page,
  21. * this is big enough to represent almost 95 PB of logical space.
  22. */
  23. VDO_BLOCK_MAP_TREE_HEIGHT = 5,
  24. /* The default number of bio submission queues. */
  25. DEFAULT_VDO_BIO_SUBMIT_QUEUE_COUNT = 4,
  26. /* The number of contiguous PBNs to be submitted to a single bio queue. */
  27. DEFAULT_VDO_BIO_SUBMIT_QUEUE_ROTATE_INTERVAL = 64,
  28. /* The number of trees in the arboreal block map */
  29. DEFAULT_VDO_BLOCK_MAP_TREE_ROOT_COUNT = 60,
  30. /* The default size of the recovery journal, in blocks */
  31. DEFAULT_VDO_RECOVERY_JOURNAL_SIZE = 32 * 1024,
  32. /* The default size of each slab journal, in blocks */
  33. DEFAULT_VDO_SLAB_JOURNAL_SIZE = 224,
  34. /* Unit test minimum */
  35. MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2,
  36. /*
  37. * The initial size of lbn_operations and pbn_operations, which is based upon the expected
  38. * maximum number of outstanding VIOs. This value was chosen to make it highly unlikely
  39. * that the maps would need to be resized.
  40. */
  41. VDO_LOCK_MAP_CAPACITY = 10000,
  42. /* The maximum number of logical zones */
  43. MAX_VDO_LOGICAL_ZONES = 60,
  44. /* The maximum number of physical zones */
  45. MAX_VDO_PHYSICAL_ZONES = 16,
  46. /* The base-2 logarithm of the maximum blocks in one slab */
  47. MAX_VDO_SLAB_BITS = 23,
  48. /* The maximum number of slabs the slab depot supports */
  49. MAX_VDO_SLABS = 8192,
  50. /*
  51. * The maximum number of block map pages to load simultaneously during recovery or rebuild.
  52. */
  53. MAXIMUM_SIMULTANEOUS_VDO_BLOCK_MAP_RESTORATION_READS = 1024,
  54. /* The maximum number of entries in the slab summary */
  55. MAXIMUM_VDO_SLAB_SUMMARY_ENTRIES = MAX_VDO_SLABS * MAX_VDO_PHYSICAL_ZONES,
  56. /* The maximum number of total threads in a VDO thread configuration. */
  57. MAXIMUM_VDO_THREADS = 100,
  58. /* The maximum number of VIOs in the system at once */
  59. MAXIMUM_VDO_USER_VIOS = 2048,
  60. /* The only physical block size supported by VDO */
  61. VDO_BLOCK_SIZE = 4096,
  62. /* The number of sectors per block */
  63. VDO_SECTORS_PER_BLOCK = (VDO_BLOCK_SIZE >> SECTOR_SHIFT),
  64. /* The size of a sector that will not be torn */
  65. VDO_SECTOR_SIZE = 512,
  66. /* The physical block number reserved for storing the zero block */
  67. VDO_ZERO_BLOCK = 0,
  68. };
  69. #endif /* VDO_CONSTANTS_H */