dm-cache-block-types.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. typedef dm_block_t __bitwise dm_dblock_t;
  18. static inline dm_oblock_t to_oblock(dm_block_t b)
  19. {
  20. return (__force dm_oblock_t) b;
  21. }
  22. static inline dm_block_t from_oblock(dm_oblock_t b)
  23. {
  24. return (__force dm_block_t) b;
  25. }
  26. static inline dm_cblock_t to_cblock(uint32_t b)
  27. {
  28. return (__force dm_cblock_t) b;
  29. }
  30. static inline uint32_t from_cblock(dm_cblock_t b)
  31. {
  32. return (__force uint32_t) b;
  33. }
  34. static inline dm_dblock_t to_dblock(dm_block_t b)
  35. {
  36. return (__force dm_dblock_t) b;
  37. }
  38. static inline dm_block_t from_dblock(dm_dblock_t b)
  39. {
  40. return (__force dm_block_t) b;
  41. }
  42. #endif /* DM_CACHE_BLOCK_TYPES_H */