Add option to disable cleaner
This allows to avoid allocating cleaner metadata section and effectively save up to 20% of metadata memory footprint. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -638,7 +638,8 @@ static void ocf_metadata_flush_unlock_collision_page(
|
||||
* Initialize hash metadata interface
|
||||
*/
|
||||
int ocf_metadata_init_variable_size(struct ocf_cache *cache,
|
||||
uint64_t device_size, ocf_cache_line_size_t line_size)
|
||||
uint64_t device_size, ocf_cache_line_size_t line_size,
|
||||
bool cleaner_disabled)
|
||||
{
|
||||
int result = 0;
|
||||
uint32_t i = 0;
|
||||
@@ -688,6 +689,12 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
|
||||
raw->raw_type = metadata_raw_type_atomic;
|
||||
}
|
||||
|
||||
if (i == metadata_segment_cleaning && cleaner_disabled) {
|
||||
raw->entry_size = 0;
|
||||
raw->entries_in_page = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Entry size configuration */
|
||||
raw->entry_size
|
||||
= ocf_metadata_get_element_size(i, line_size);
|
||||
@@ -715,6 +722,9 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
|
||||
*/
|
||||
for (i = metadata_segment_variable_size_start;
|
||||
i < metadata_segment_max; i++) {
|
||||
if (i == metadata_segment_cleaning && cleaner_disabled)
|
||||
continue;
|
||||
|
||||
if (i == metadata_segment_collision) {
|
||||
lock_page =
|
||||
ocf_metadata_flush_lock_collision_page;
|
||||
@@ -779,6 +789,7 @@ finalize:
|
||||
|
||||
cache->conf_meta->cachelines = ctrl->cachelines;
|
||||
cache->conf_meta->line_size = line_size;
|
||||
cache->conf_meta->cleaner_disabled = cleaner_disabled;
|
||||
|
||||
ocf_metadata_raw_info(cache, ctrl);
|
||||
|
||||
@@ -1620,6 +1631,7 @@ static void ocf_metadata_load_properties_cmpl(
|
||||
properties.shutdown_status = superblock->clean_shutdown;
|
||||
properties.dirty_flushed = superblock->dirty_flushed;
|
||||
properties.cache_name = superblock->name;
|
||||
properties.cleaner_disabled = superblock->cleaner_disabled;
|
||||
|
||||
OCF_CMPL_RET(priv, 0, &properties);
|
||||
}
|
||||
|
@@ -41,10 +41,12 @@ int ocf_metadata_init(struct ocf_cache *cache,
|
||||
* @param cache - Cache instance
|
||||
* @param device_size - Device size in bytes
|
||||
* @param cache_line_size Cache line size
|
||||
* @param cleaner_disabled Cleaner is disabled
|
||||
* @return 0 - Operation success otherwise failure
|
||||
*/
|
||||
int ocf_metadata_init_variable_size(struct ocf_cache *cache,
|
||||
uint64_t device_size, ocf_cache_line_size_t cache_line_size);
|
||||
uint64_t device_size, ocf_cache_line_size_t line_size,
|
||||
bool cleaner_disabled);
|
||||
|
||||
/**
|
||||
* @brief Initialize collision table
|
||||
@@ -201,6 +203,7 @@ struct ocf_metadata_load_properties {
|
||||
ocf_cache_mode_t cache_mode;
|
||||
ocf_cache_line_size_t line_size;
|
||||
char *cache_name;
|
||||
bool cleaner_disabled;
|
||||
};
|
||||
|
||||
typedef void (*ocf_metadata_load_properties_end_t)(void *priv, int error,
|
||||
|
@@ -18,6 +18,8 @@ ocf_metadata_get_cleaning_policy(struct ocf_cache *cache,
|
||||
struct ocf_metadata_ctrl *ctrl
|
||||
= (struct ocf_metadata_ctrl *) cache->metadata.priv;
|
||||
|
||||
ENV_BUG_ON(cache->conf_meta->cleaner_disabled);
|
||||
|
||||
return ocf_metadata_raw_wr_access(cache,
|
||||
&(ctrl->raw_desc[metadata_segment_cleaning]), line);
|
||||
}
|
||||
|
@@ -110,8 +110,11 @@ static void ocf_metadata_store_segment(ocf_pipeline_t pipeline,
|
||||
int ocf_metadata_validate_superblock(ocf_ctx_t ctx,
|
||||
struct ocf_superblock_config *superblock)
|
||||
{
|
||||
const char *segment_name;
|
||||
uint32_t crc;
|
||||
|
||||
segment_name = ocf_metadata_segment_names[metadata_segment_sb_config];
|
||||
|
||||
if (superblock->magic_number != CACHE_MAGIC_NUMBER) {
|
||||
ocf_log(ctx, log_info, "Cannot detect pre-existing metadata\n");
|
||||
return -OCF_ERR_NO_METADATA;
|
||||
@@ -178,6 +181,14 @@ int ocf_metadata_validate_superblock(ocf_ctx_t ctx,
|
||||
return -OCF_ERR_INVAL;
|
||||
}
|
||||
|
||||
if (superblock->cleaner_disabled &&
|
||||
superblock->cleaning_policy_type != ocf_cleaning_nop) {
|
||||
ocf_log(ctx, log_err, "Loading %s: cleaner is disabled, but "
|
||||
"cleaning policy is not set to nop!\n",
|
||||
segment_name);
|
||||
return -OCF_ERR_INVAL;
|
||||
}
|
||||
|
||||
if (superblock->promotion_policy_type < 0 ||
|
||||
superblock->promotion_policy_type >=
|
||||
ocf_promotion_max) {
|
||||
|
@@ -45,6 +45,7 @@ struct ocf_superblock_config {
|
||||
unsigned long valid_core_bitmap[(OCF_CORE_MAX /
|
||||
(sizeof(unsigned long) * 8)) + 1];
|
||||
|
||||
bool cleaner_disabled;
|
||||
ocf_cleaning_t cleaning_policy_type;
|
||||
struct cleaning_policy_config cleaning[CLEANING_POLICY_TYPE_MAX];
|
||||
|
||||
|
Reference in New Issue
Block a user