2013-03-02 02:45:51 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This file is released under the GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DM_CACHE_BLOCK_TYPES_H
|
|
|
|
#define DM_CACHE_BLOCK_TYPES_H
|
|
|
|
|
|
|
|
#include "persistent-data/dm-block-manager.h"
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* It's helpful to get sparse to differentiate between indexes into the
|
|
|
|
* origin device, indexes into the cache device, and indexes into the
|
|
|
|
* discard bitset.
|
|
|
|
*/
|
|
|
|
|
2016-12-11 07:34:53 +03:00
|
|
|
typedef dm_block_t __bitwise dm_oblock_t;
|
|
|
|
typedef uint32_t __bitwise dm_cblock_t;
|
|
|
|
typedef dm_block_t __bitwise dm_dblock_t;
|
2013-03-02 02:45:51 +04:00
|
|
|
|
|
|
|
static inline dm_oblock_t to_oblock(dm_block_t b)
|
|
|
|
{
|
|
|
|
return (__force dm_oblock_t) b;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline dm_block_t from_oblock(dm_oblock_t b)
|
|
|
|
{
|
|
|
|
return (__force dm_block_t) b;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline dm_cblock_t to_cblock(uint32_t b)
|
|
|
|
{
|
|
|
|
return (__force dm_cblock_t) b;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t from_cblock(dm_cblock_t b)
|
|
|
|
{
|
|
|
|
return (__force uint32_t) b;
|
|
|
|
}
|
|
|
|
|
2014-11-07 17:47:07 +03:00
|
|
|
static inline dm_dblock_t to_dblock(dm_block_t b)
|
|
|
|
{
|
|
|
|
return (__force dm_dblock_t) b;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline dm_block_t from_dblock(dm_dblock_t b)
|
|
|
|
{
|
|
|
|
return (__force dm_block_t) b;
|
|
|
|
}
|
|
|
|
|
2013-03-02 02:45:51 +04:00
|
|
|
#endif /* DM_CACHE_BLOCK_TYPES_H */
|