blob: aac0e2df06bec4c2412a8ff27787e0d89b6a6c4f [file] [log] [blame]
Joe Thornberc6b4fcb2013-03-01 22:45:51 +00001/*
2 * Copyright (C) 2012 Red Hat, Inc.
3 *
4 * This file is released under the GPL.
5 */
6
7#ifndef DM_CACHE_BLOCK_TYPES_H
8#define DM_CACHE_BLOCK_TYPES_H
9
10#include "persistent-data/dm-block-manager.h"
11
12/*----------------------------------------------------------------*/
13
14/*
15 * It's helpful to get sparse to differentiate between indexes into the
16 * origin device, indexes into the cache device, and indexes into the
17 * discard bitset.
18 */
19
20typedef dm_block_t __bitwise__ dm_oblock_t;
21typedef uint32_t __bitwise__ dm_cblock_t;
Joe Thornberc6b4fcb2013-03-01 22:45:51 +000022
23static inline dm_oblock_t to_oblock(dm_block_t b)
24{
25 return (__force dm_oblock_t) b;
26}
27
28static inline dm_block_t from_oblock(dm_oblock_t b)
29{
30 return (__force dm_block_t) b;
31}
32
33static inline dm_cblock_t to_cblock(uint32_t b)
34{
35 return (__force dm_cblock_t) b;
36}
37
38static inline uint32_t from_cblock(dm_cblock_t b)
39{
40 return (__force uint32_t) b;
41}
42
Joe Thornberc6b4fcb2013-03-01 22:45:51 +000043#endif /* DM_CACHE_BLOCK_TYPES_H */