Remove init_mode and use metadata.is_volatile instead

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
Rafal Stefanowski 2020-12-18 02:05:00 +01:00
parent 88b97df16d
commit d3b61e474c
4 changed files with 3 additions and 42 deletions

View File

@ -128,7 +128,7 @@ static void _ocf_discard_finish_step(struct ocf_request *req)
if (req->discard.handled < req->discard.nr_sects)
req->io_if = &_io_if_discard_step;
else if (req->cache->device->init_mode != ocf_init_mode_metadata_volatile)
else if (!req->cache->metadata.is_volatile)
req->io_if = &_io_if_discard_flush_cache;
else
req->io_if = &_io_if_discard_core;

View File

@ -610,7 +610,7 @@ static void ocf_metadata_init_layout(struct ocf_cache *cache,
ENV_BUG_ON(layout >= ocf_metadata_layout_max || layout < 0);
/* Initialize metadata location interface*/
if (cache->device->init_mode == ocf_init_mode_metadata_volatile)
if (cache->metadata.is_volatile)
layout = ocf_metadata_layout_seq;
cache->metadata.layout = layout;
}
@ -668,7 +668,7 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
/* Default type for metadata RAW container */
raw->raw_type = metadata_raw_type_ram;
if (cache->device->init_mode == ocf_init_mode_metadata_volatile) {
if (cache->metadata.is_volatile) {
raw->raw_type = metadata_raw_type_volatile;
} else if (i == metadata_segment_collision &&
ocf_volume_is_atomic(&cache->device->volume)) {

View File

@ -94,9 +94,6 @@ struct ocf_cache_attach_context {
uint64_t volume_size;
/*!< size of the device in cache lines */
enum ocf_mngt_cache_init_mode init_mode;
/*!< cache init mode */
/**
* @brief initialization state (in case of error, it is used to know
* which assets have to be deallocated in premature exit from function
@ -612,8 +609,6 @@ static void _ocf_mngt_attach_cache_device(ocf_pipeline_t pipeline,
context->flags.device_alloc = true;
cache->device->init_mode = context->init_mode;
/* Prepare UUID of cache volume */
type = ocf_ctx_get_volume_type(cache->owner, context->cfg.volume_type);
if (!type) {
@ -1829,12 +1824,6 @@ static void _ocf_mngt_cache_attach(ocf_cache_t cache,
context->cache = cache;
context->cfg = *cfg;
if (cache->metadata.is_volatile) {
context->init_mode = ocf_init_mode_metadata_volatile;
} else {
context->init_mode = ocf_init_mode_init;
}
OCF_PL_NEXT_RET(pipeline);
}
@ -1867,7 +1856,6 @@ static void _ocf_mngt_cache_load(ocf_cache_t cache,
context->cache = cache;
context->cfg = *cfg;
context->init_mode = ocf_init_mode_load;
OCF_PL_NEXT_RET(pipeline);
}

View File

@ -40,31 +40,6 @@ struct ocf_trace {
env_atomic64 trace_seq_ref;
};
/**
* @brief Initialization mode of cache instance
*/
enum ocf_mngt_cache_init_mode {
/**
* @brief Set up an SSD as new caching device
*/
ocf_init_mode_init,
/**
* @brief Set up an SSD as new caching device without saving cache
* metadata on SSD.
*
* When using this initialization mode, after shutdown, loading cache
* is not possible
*/
ocf_init_mode_metadata_volatile,
/**
* @brief Load pre-existing SSD cache state and set all parameters
* to previous configurations
*/
ocf_init_mode_load,
};
/* Cache device */
struct ocf_cache_device {
struct ocf_volume volume;
@ -88,8 +63,6 @@ struct ocf_cache_device {
struct ocf_cache_line_concurrency *cache_line;
} concurrency;
enum ocf_mngt_cache_init_mode init_mode;
struct ocf_superblock_runtime *runtime_meta;
};