dm-cache-block-types.h 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2012 Red Hat, Inc.
  3. *
  4. * This file is released under the GPL.
  5. */
  6. #ifndef DM_CACHE_BLOCK_TYPES_H
  7. #define DM_CACHE_BLOCK_TYPES_H
  8. #include "persistent-data/dm-block-manager.h"
  9. /*----------------------------------------------------------------*/
  10. /*
  11. * It's helpful to get sparse to differentiate between indexes into the
  12. * origin device, indexes into the cache device, and indexes into the
  13. * discard bitset.
  14. */
  15. typedef dm_block_t __bitwise__ dm_oblock_t;
  16. typedef uint32_t __bitwise__ dm_cblock_t;
  17. static inline dm_oblock_t to_oblock(dm_block_t b)
  18. {
  19. return (__force dm_oblock_t) b;
  20. }
  21. static inline dm_block_t from_oblock(dm_oblock_t b)
  22. {
  23. return (__force dm_block_t) b;
  24. }
  25. static inline dm_cblock_t to_cblock(uint32_t b)
  26. {
  27. return (__force dm_cblock_t) b;
  28. }
  29. static inline uint32_t from_cblock(dm_cblock_t b)
  30. {
  31. return (__force uint32_t) b;
  32. }
  33. #endif /* DM_CACHE_BLOCK_TYPES_H */