Remove metadata bits manipulation abstraction
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
98cba1603f
commit
05c0826c0f
@ -2788,6 +2788,62 @@ static const struct ocf_metadata_iface metadata_hash_iface = {
|
|||||||
|
|
||||||
#include "metadata_bit.h"
|
#include "metadata_bit.h"
|
||||||
|
|
||||||
|
#define _ocf_metadata_funcs_5arg(what) \
|
||||||
|
bool ocf_metadata_##what(struct ocf_cache *cache, \
|
||||||
|
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all) \
|
||||||
|
{ \
|
||||||
|
switch (cache->metadata.settings.size) { \
|
||||||
|
case ocf_cache_line_size_4: \
|
||||||
|
return _ocf_metadata_##what##_u8(cache, line, start, stop, all); \
|
||||||
|
case ocf_cache_line_size_8: \
|
||||||
|
return _ocf_metadata_##what##_u16(cache, line, start, stop, all); \
|
||||||
|
case ocf_cache_line_size_16: \
|
||||||
|
return _ocf_metadata_##what##_u32(cache, line, start, stop, all); \
|
||||||
|
case ocf_cache_line_size_32: \
|
||||||
|
return _ocf_metadata_##what##_u64(cache, line, start, stop, all); \
|
||||||
|
case ocf_cache_line_size_64: \
|
||||||
|
return _ocf_metadata_##what##_u128(cache, line, start, stop, all); \
|
||||||
|
case ocf_cache_line_size_none: \
|
||||||
|
default: \
|
||||||
|
ENV_BUG_ON(1); \
|
||||||
|
return false; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
|
||||||
|
|
||||||
|
#define _ocf_metadata_funcs_4arg(what) \
|
||||||
|
bool ocf_metadata_##what(struct ocf_cache *cache, \
|
||||||
|
ocf_cache_line_t line, uint8_t start, uint8_t stop) \
|
||||||
|
{ \
|
||||||
|
switch (cache->metadata.settings.size) { \
|
||||||
|
case ocf_cache_line_size_4: \
|
||||||
|
return _ocf_metadata_##what##_u8(cache, line, start, stop); \
|
||||||
|
case ocf_cache_line_size_8: \
|
||||||
|
return _ocf_metadata_##what##_u16(cache, line, start, stop); \
|
||||||
|
case ocf_cache_line_size_16: \
|
||||||
|
return _ocf_metadata_##what##_u32(cache, line, start, stop); \
|
||||||
|
case ocf_cache_line_size_32: \
|
||||||
|
return _ocf_metadata_##what##_u64(cache, line, start, stop); \
|
||||||
|
case ocf_cache_line_size_64: \
|
||||||
|
return _ocf_metadata_##what##_u128(cache, line, start, stop); \
|
||||||
|
case ocf_cache_line_size_none: \
|
||||||
|
default: \
|
||||||
|
ENV_BUG_ON(1); \
|
||||||
|
return false; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
|
||||||
|
#define _ocf_metadata_funcs(what) \
|
||||||
|
_ocf_metadata_funcs_5arg(test_##what) \
|
||||||
|
_ocf_metadata_funcs_4arg(test_out_##what) \
|
||||||
|
_ocf_metadata_funcs_4arg(clear_##what) \
|
||||||
|
_ocf_metadata_funcs_4arg(set_##what) \
|
||||||
|
_ocf_metadata_funcs_5arg(test_and_set_##what) \
|
||||||
|
_ocf_metadata_funcs_5arg(test_and_clear_##what)
|
||||||
|
|
||||||
|
_ocf_metadata_funcs(dirty)
|
||||||
|
_ocf_metadata_funcs(valid)
|
||||||
|
|
||||||
static void ocf_metadata_hash_init_iface(struct ocf_cache *cache,
|
static void ocf_metadata_hash_init_iface(struct ocf_cache *cache,
|
||||||
ocf_metadata_layout_t layout)
|
ocf_metadata_layout_t layout)
|
||||||
{
|
{
|
||||||
@ -2802,104 +2858,6 @@ static void ocf_metadata_hash_init_iface(struct ocf_cache *cache,
|
|||||||
iface->layout = layout;
|
iface->layout = layout;
|
||||||
|
|
||||||
/* Initialize bit status function */
|
/* Initialize bit status function */
|
||||||
|
|
||||||
switch (cache->metadata.settings.size) {
|
|
||||||
case ocf_cache_line_size_4:
|
|
||||||
iface->test_dirty = _ocf_metadata_test_dirty_u8;
|
|
||||||
iface->test_out_dirty = _ocf_metadata_test_out_dirty_u8;
|
|
||||||
iface->clear_dirty = _ocf_metadata_clear_dirty_u8;
|
|
||||||
iface->set_dirty = _ocf_metadata_set_dirty_u8;
|
|
||||||
iface->test_and_set_dirty = _ocf_metadata_test_and_set_dirty_u8;
|
|
||||||
iface->test_and_clear_dirty =
|
|
||||||
_ocf_metadata_test_and_clear_dirty_u8;
|
|
||||||
iface->test_valid = _ocf_metadata_test_valid_u8;
|
|
||||||
iface->test_out_valid = _ocf_metadata_test_out_valid_u8;
|
|
||||||
iface->clear_valid = _ocf_metadata_clear_valid_u8;
|
|
||||||
iface->set_valid = _ocf_metadata_set_valid_u8;
|
|
||||||
iface->test_and_set_valid = _ocf_metadata_test_and_set_valid_u8;
|
|
||||||
iface->test_and_clear_valid =
|
|
||||||
_ocf_metadata_test_and_clear_valid_u8;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ocf_cache_line_size_8:
|
|
||||||
iface->test_dirty = _ocf_metadata_test_dirty_u16;
|
|
||||||
iface->test_out_dirty = _ocf_metadata_test_out_dirty_u16;
|
|
||||||
iface->clear_dirty = _ocf_metadata_clear_dirty_u16;
|
|
||||||
iface->set_dirty = _ocf_metadata_set_dirty_u16;
|
|
||||||
iface->test_and_set_dirty =
|
|
||||||
_ocf_metadata_test_and_set_dirty_u16;
|
|
||||||
iface->test_and_clear_dirty =
|
|
||||||
_ocf_metadata_test_and_clear_dirty_u16;
|
|
||||||
iface->test_valid = _ocf_metadata_test_valid_u16;
|
|
||||||
iface->test_out_valid = _ocf_metadata_test_out_valid_u16;
|
|
||||||
iface->clear_valid = _ocf_metadata_clear_valid_u16;
|
|
||||||
iface->set_valid = _ocf_metadata_set_valid_u16;
|
|
||||||
iface->test_and_set_valid =
|
|
||||||
_ocf_metadata_test_and_set_valid_u16;
|
|
||||||
iface->test_and_clear_valid =
|
|
||||||
_ocf_metadata_test_and_clear_valid_u16;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ocf_cache_line_size_16:
|
|
||||||
iface->test_dirty = _ocf_metadata_test_dirty_u32;
|
|
||||||
iface->test_out_dirty = _ocf_metadata_test_out_dirty_u32;
|
|
||||||
iface->clear_dirty = _ocf_metadata_clear_dirty_u32;
|
|
||||||
iface->set_dirty = _ocf_metadata_set_dirty_u32;
|
|
||||||
iface->test_and_set_dirty =
|
|
||||||
_ocf_metadata_test_and_set_dirty_u32;
|
|
||||||
iface->test_and_clear_dirty =
|
|
||||||
_ocf_metadata_test_and_clear_dirty_u32;
|
|
||||||
iface->test_valid = _ocf_metadata_test_valid_u32;
|
|
||||||
iface->test_out_valid = _ocf_metadata_test_out_valid_u32;
|
|
||||||
iface->clear_valid = _ocf_metadata_clear_valid_u32;
|
|
||||||
iface->set_valid = _ocf_metadata_set_valid_u32;
|
|
||||||
iface->test_and_set_valid =
|
|
||||||
_ocf_metadata_test_and_set_valid_u32;
|
|
||||||
iface->test_and_clear_valid =
|
|
||||||
_ocf_metadata_test_and_clear_valid_u32;
|
|
||||||
break;
|
|
||||||
case ocf_cache_line_size_32:
|
|
||||||
iface->test_dirty = _ocf_metadata_test_dirty_u64;
|
|
||||||
iface->test_out_dirty = _ocf_metadata_test_out_dirty_u64;
|
|
||||||
iface->clear_dirty = _ocf_metadata_clear_dirty_u64;
|
|
||||||
iface->set_dirty = _ocf_metadata_set_dirty_u64;
|
|
||||||
iface->test_and_set_dirty =
|
|
||||||
_ocf_metadata_test_and_set_dirty_u64;
|
|
||||||
iface->test_and_clear_dirty =
|
|
||||||
_ocf_metadata_test_and_clear_dirty_u64;
|
|
||||||
iface->test_valid = _ocf_metadata_test_valid_u64;
|
|
||||||
iface->test_out_valid = _ocf_metadata_test_out_valid_u64;
|
|
||||||
iface->clear_valid = _ocf_metadata_clear_valid_u64;
|
|
||||||
iface->set_valid = _ocf_metadata_set_valid_u64;
|
|
||||||
iface->test_and_set_valid =
|
|
||||||
_ocf_metadata_test_and_set_valid_u64;
|
|
||||||
iface->test_and_clear_valid =
|
|
||||||
_ocf_metadata_test_and_clear_valid_u64;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ocf_cache_line_size_64:
|
|
||||||
iface->test_dirty = _ocf_metadata_test_dirty_u128;
|
|
||||||
iface->test_out_dirty = _ocf_metadata_test_out_dirty_u128;
|
|
||||||
iface->clear_dirty = _ocf_metadata_clear_dirty_u128;
|
|
||||||
iface->set_dirty = _ocf_metadata_set_dirty_u128;
|
|
||||||
iface->test_and_set_dirty =
|
|
||||||
_ocf_metadata_test_and_set_dirty_u128;
|
|
||||||
iface->test_and_clear_dirty =
|
|
||||||
_ocf_metadata_test_and_clear_dirty_u128;
|
|
||||||
iface->test_valid = _ocf_metadata_test_valid_u128;
|
|
||||||
iface->test_out_valid = _ocf_metadata_test_out_valid_u128;
|
|
||||||
iface->clear_valid = _ocf_metadata_clear_valid_u128;
|
|
||||||
iface->set_valid = _ocf_metadata_set_valid_u128;
|
|
||||||
iface->test_and_set_valid =
|
|
||||||
_ocf_metadata_test_and_set_valid_u128;
|
|
||||||
iface->test_and_clear_valid =
|
|
||||||
_ocf_metadata_test_and_clear_valid_u128;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ENV_BUG();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -12,15 +12,29 @@
|
|||||||
* Dirty
|
* Dirty
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
bool ocf_metadata_test_dirty(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
||||||
|
bool ocf_metadata_test_out_dirty(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
||||||
|
bool ocf_metadata_clear_dirty(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
||||||
|
bool ocf_metadata_set_dirty(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
||||||
|
bool ocf_metadata_test_and_set_dirty(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
||||||
|
bool ocf_metadata_test_and_clear_dirty(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
||||||
|
|
||||||
|
bool ocf_metadata_test_valid(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
||||||
|
bool ocf_metadata_test_out_valid(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
||||||
|
bool ocf_metadata_clear_valid(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
||||||
|
bool ocf_metadata_set_valid(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
||||||
|
bool ocf_metadata_test_and_set_valid(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
||||||
|
bool ocf_metadata_test_and_clear_valid(struct ocf_cache *cache, ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
||||||
|
|
||||||
static inline void metadata_init_status_bits(struct ocf_cache *cache,
|
static inline void metadata_init_status_bits(struct ocf_cache *cache,
|
||||||
ocf_cache_line_t line)
|
ocf_cache_line_t line)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
|
|
||||||
cache->metadata.iface.clear_dirty(cache, line,
|
ocf_metadata_clear_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end);
|
cache->metadata.settings.sector_end);
|
||||||
cache->metadata.iface.clear_valid(cache, line,
|
ocf_metadata_clear_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end);
|
cache->metadata.settings.sector_end);
|
||||||
|
|
||||||
@ -33,7 +47,7 @@ static inline bool metadata_test_dirty_all(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_dirty(cache, line,
|
test = ocf_metadata_test_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, true);
|
cache->metadata.settings.sector_end, true);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
@ -47,7 +61,7 @@ static inline bool metadata_test_dirty(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_dirty(cache, line,
|
test = ocf_metadata_test_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, false);
|
cache->metadata.settings.sector_end, false);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
@ -59,7 +73,7 @@ static inline void metadata_set_dirty(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line)
|
ocf_cache_line_t line)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.set_dirty(cache, line,
|
ocf_metadata_set_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end);
|
cache->metadata.settings.sector_end);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -69,7 +83,7 @@ static inline void metadata_clear_dirty(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line)
|
ocf_cache_line_t line)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.clear_dirty(cache, line,
|
ocf_metadata_clear_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end);
|
cache->metadata.settings.sector_end);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -81,7 +95,7 @@ static inline bool metadata_test_and_clear_dirty(
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
test = cache->metadata.iface.test_and_clear_dirty(cache, line,
|
test = ocf_metadata_test_and_clear_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, false);
|
cache->metadata.settings.sector_end, false);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -95,7 +109,7 @@ static inline bool metadata_test_and_set_dirty(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
test = cache->metadata.iface.test_and_set_dirty(cache, line,
|
test = ocf_metadata_test_and_set_dirty(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, false);
|
cache->metadata.settings.sector_end, false);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -113,7 +127,7 @@ static inline bool metadata_test_dirty_sec(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_dirty(cache, line,
|
test = ocf_metadata_test_dirty(cache, line,
|
||||||
start, stop, false);
|
start, stop, false);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
|
|
||||||
@ -126,7 +140,7 @@ static inline bool metadata_test_dirty_all_sec(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_dirty(cache, line,
|
test = ocf_metadata_test_dirty(cache, line,
|
||||||
start, stop, true);
|
start, stop, true);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
|
|
||||||
@ -145,7 +159,7 @@ static inline bool metadata_test_dirty_out_sec(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_out_dirty(cache, line, start, stop);
|
test = ocf_metadata_test_out_dirty(cache, line, start, stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
|
|
||||||
return test;
|
return test;
|
||||||
@ -155,7 +169,7 @@ static inline void metadata_set_dirty_sec(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop)
|
ocf_cache_line_t line, uint8_t start, uint8_t stop)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.set_dirty(cache, line, start, stop);
|
ocf_metadata_set_dirty(cache, line, start, stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +177,7 @@ static inline void metadata_clear_dirty_sec(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop)
|
ocf_cache_line_t line, uint8_t start, uint8_t stop)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.clear_dirty(cache, line, start, stop);
|
ocf_metadata_clear_dirty(cache, line, start, stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +185,7 @@ static inline void metadata_set_dirty_sec_one(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t pos)
|
ocf_cache_line_t line, uint8_t pos)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.set_dirty(cache, line, pos, pos);
|
ocf_metadata_set_dirty(cache, line, pos, pos);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +193,7 @@ static inline void metadata_clear_dirty_sec_one(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t pos)
|
ocf_cache_line_t line, uint8_t pos)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.clear_dirty(cache, line, pos, pos);
|
ocf_metadata_clear_dirty(cache, line, pos, pos);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +204,7 @@ static inline bool metadata_test_and_clear_dirty_sec(
|
|||||||
bool test = false;
|
bool test = false;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
test = cache->metadata.iface.test_and_clear_dirty(cache, line,
|
test = ocf_metadata_test_and_clear_dirty(cache, line,
|
||||||
start, stop, false);
|
start, stop, false);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
|
|
||||||
@ -211,9 +225,9 @@ static inline bool metadata_clear_dirty_sec_changed(
|
|||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
|
|
||||||
sec_changed = cache->metadata.iface.test_dirty(cache, line,
|
sec_changed = ocf_metadata_test_dirty(cache, line,
|
||||||
start, stop, false);
|
start, stop, false);
|
||||||
*line_is_clean = !cache->metadata.iface.clear_dirty(cache, line,
|
*line_is_clean = !ocf_metadata_clear_dirty(cache, line,
|
||||||
start, stop);
|
start, stop);
|
||||||
|
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -234,9 +248,9 @@ static inline bool metadata_set_dirty_sec_changed(
|
|||||||
bool sec_changed;
|
bool sec_changed;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
sec_changed = !cache->metadata.iface.test_dirty(cache, line,
|
sec_changed = !ocf_metadata_test_dirty(cache, line,
|
||||||
start, stop, true);
|
start, stop, true);
|
||||||
*line_was_dirty = cache->metadata.iface.set_dirty(cache, line, start,
|
*line_was_dirty = ocf_metadata_set_dirty(cache, line, start,
|
||||||
stop);
|
stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
|
|
||||||
@ -253,7 +267,7 @@ static inline bool metadata_test_valid_any(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_valid(cache, line,
|
test = ocf_metadata_test_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, false);
|
cache->metadata.settings.sector_end, false);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
@ -267,7 +281,7 @@ static inline bool metadata_test_valid(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_valid(cache, line,
|
test = ocf_metadata_test_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, true);
|
cache->metadata.settings.sector_end, true);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
@ -279,7 +293,7 @@ static inline void metadata_set_valid(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line)
|
ocf_cache_line_t line)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.set_valid(cache, line,
|
ocf_metadata_set_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end);
|
cache->metadata.settings.sector_end);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -289,7 +303,7 @@ static inline void metadata_clear_valid(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line)
|
ocf_cache_line_t line)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.clear_valid(cache, line,
|
ocf_metadata_clear_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end);
|
cache->metadata.settings.sector_end);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -301,7 +315,7 @@ static inline bool metadata_test_and_clear_valid(
|
|||||||
bool test = false;
|
bool test = false;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
test = cache->metadata.iface.test_and_clear_valid(cache, line,
|
test = ocf_metadata_test_and_clear_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, true);
|
cache->metadata.settings.sector_end, true);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -315,7 +329,7 @@ static inline bool metadata_test_and_set_valid(struct ocf_cache *cache,
|
|||||||
bool test = false;
|
bool test = false;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
test = cache->metadata.iface.test_and_set_valid(cache, line,
|
test = ocf_metadata_test_and_set_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, true);
|
cache->metadata.settings.sector_end, true);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
@ -333,7 +347,7 @@ static inline bool metadata_test_valid_sec(struct ocf_cache *cache,
|
|||||||
bool test;
|
bool test;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_valid(cache, line,
|
test = ocf_metadata_test_valid(cache, line,
|
||||||
start, stop, true);
|
start, stop, true);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
|
|
||||||
@ -347,7 +361,7 @@ static inline bool metadata_test_valid_any_out_sec(
|
|||||||
bool test = false;
|
bool test = false;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_RD();
|
OCF_METADATA_BITS_LOCK_RD();
|
||||||
test = cache->metadata.iface.test_out_valid(cache, line,
|
test = ocf_metadata_test_out_valid(cache, line,
|
||||||
start, stop);
|
start, stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_RD();
|
OCF_METADATA_BITS_UNLOCK_RD();
|
||||||
|
|
||||||
@ -374,7 +388,7 @@ static inline bool metadata_set_valid_sec_changed(
|
|||||||
bool was_any_valid;
|
bool was_any_valid;
|
||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
was_any_valid = cache->metadata.iface.set_valid(cache, line,
|
was_any_valid = ocf_metadata_set_valid(cache, line,
|
||||||
start, stop);
|
start, stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
|
|
||||||
@ -385,7 +399,7 @@ static inline void metadata_clear_valid_sec(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop)
|
ocf_cache_line_t line, uint8_t start, uint8_t stop)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.clear_valid(cache, line, start, stop);
|
ocf_metadata_clear_valid(cache, line, start, stop);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +407,7 @@ static inline void metadata_clear_valid_sec_one(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t pos)
|
ocf_cache_line_t line, uint8_t pos)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.clear_valid(cache, line, pos, pos);
|
ocf_metadata_clear_valid(cache, line, pos, pos);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +415,7 @@ static inline void metadata_set_valid_sec_one(struct ocf_cache *cache,
|
|||||||
ocf_cache_line_t line, uint8_t pos)
|
ocf_cache_line_t line, uint8_t pos)
|
||||||
{
|
{
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
cache->metadata.iface.set_valid(cache, line, pos, pos);
|
ocf_metadata_set_valid(cache, line, pos, pos);
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -419,11 +433,11 @@ static inline bool metadata_clear_valid_sec_changed(
|
|||||||
|
|
||||||
OCF_METADATA_BITS_LOCK_WR();
|
OCF_METADATA_BITS_LOCK_WR();
|
||||||
|
|
||||||
was_any_valid = cache->metadata.iface.test_valid(cache, line,
|
was_any_valid = ocf_metadata_test_valid(cache, line,
|
||||||
cache->metadata.settings.sector_start,
|
cache->metadata.settings.sector_start,
|
||||||
cache->metadata.settings.sector_end, false);
|
cache->metadata.settings.sector_end, false);
|
||||||
|
|
||||||
*is_valid = cache->metadata.iface.clear_valid(cache, line,
|
*is_valid = ocf_metadata_clear_valid(cache, line,
|
||||||
start, stop);
|
start, stop);
|
||||||
|
|
||||||
OCF_METADATA_BITS_UNLOCK_WR();
|
OCF_METADATA_BITS_UNLOCK_WR();
|
||||||
|
@ -315,43 +315,6 @@ struct ocf_metadata_iface {
|
|||||||
struct ocf_metadata_status*
|
struct ocf_metadata_status*
|
||||||
(*wr_status_access)(struct ocf_cache *cache,
|
(*wr_status_access)(struct ocf_cache *cache,
|
||||||
ocf_cache_line_t line);
|
ocf_cache_line_t line);
|
||||||
|
|
||||||
bool (*test_dirty)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
|
||||||
|
|
||||||
bool (*test_out_dirty)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
|
||||||
|
|
||||||
bool (*clear_dirty)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
|
||||||
|
|
||||||
bool (*set_dirty)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
|
||||||
|
|
||||||
bool (*test_and_set_dirty)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
|
||||||
|
|
||||||
bool (*test_and_clear_dirty)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
|
||||||
|
|
||||||
|
|
||||||
bool (*test_valid)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
|
||||||
|
|
||||||
bool (*test_out_valid)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
|
||||||
|
|
||||||
bool (*clear_valid)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
|
||||||
|
|
||||||
bool (*set_valid)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop);
|
|
||||||
|
|
||||||
bool (*test_and_set_valid)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
|
||||||
|
|
||||||
bool (*test_and_clear_valid)(struct ocf_cache *cache,
|
|
||||||
ocf_cache_line_t line, uint8_t start, uint8_t stop, bool all);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ocf_cache_line_settings {
|
struct ocf_cache_line_settings {
|
||||||
|
Loading…
Reference in New Issue
Block a user