Switching mechanism for promotion policies

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial
2019-08-26 13:52:11 +02:00
parent e3a20c0da0
commit a1d3cf0c4d
12 changed files with 252 additions and 26 deletions

View File

@@ -24,6 +24,7 @@
#include "ocf_cleaner.h"
#include "cleaning/alru.h"
#include "cleaning/acp.h"
#include "promotion/nhit.h"
#include "ocf_metadata.h"
#include "ocf_metadata_updater.h"
#include "ocf_io_class.h"

View File

@@ -778,7 +778,7 @@ int ocf_mngt_cache_cleaning_set_param(ocf_cache_t cache, ocf_cleaning_t type,
* @param[in] cache Cache handle
* @param[in] type Cleaning policy type
* @param[in] param_id Cleaning policy parameter id
* @param[in] param_value Variable to store parameter value
* @param[out] param_value Variable to store parameter value
*
* @retval 0 Parameter has been get successfully
* @retval Non-zero Error occurred and parameter has not been get
@@ -786,6 +786,55 @@ int ocf_mngt_cache_cleaning_set_param(ocf_cache_t cache, ocf_cleaning_t type,
int ocf_mngt_cache_cleaning_get_param(ocf_cache_t cache,ocf_cleaning_t type,
uint32_t param_id, uint32_t *param_value);
/**
* @brief Set promotion policy in given cache
*
* @attention This changes only runtime state. To make changes persistent
* use function ocf_mngt_cache_save().
*
* @param[in] cache Cache handle
* @param[in] type Promotion policy type
*
* @retval 0 Policy has been set successfully
* @retval Non-zero Error occurred and policy has not been set
*/
int ocf_mngt_cache_promotion_set_policy(ocf_cache_t cache, ocf_promotion_t type);
/**
* @brief Get promotion policy in given cache
*
* @param[in] cache Cache handle
*
* @retval Currently set promotion policy type
*/
ocf_promotion_t ocf_mngt_cache_promotion_get_policy(ocf_cache_t cache);
/**
* @brief Set promotion policy parameter for given cache
*
* @param[in] cache Cache handle
* @param[in] param_id Promotion policy parameter id
* @param[in] param_value Promotion policy parameter value
*
* @retval 0 Parameter has been set successfully
* @retval Non-zero Error occurred and parameter has not been set
*/
int ocf_mngt_cache_promotion_set_param(ocf_cache_t cache, uint8_t param_id,
uint64_t param_value);
/**
* @brief Get promotion policy parameter for given cache
*
* @param[in] cache Cache handle
* @param[in] param_id Promotion policy parameter id
* @param[out] param_value Variable to store parameter value
*
* @retval 0 Parameter has been retrieved successfully
* @retval Non-zero Error occurred and parameter has not been retrieved
*/
int ocf_mngt_cache_promotion_get_param(ocf_cache_t cache, uint8_t param_id,
uint64_t *param_value);
/**
* @brief IO class configuration
*/

23
inc/promotion/nhit.h Normal file
View File

@@ -0,0 +1,23 @@
/*
* Copyright(c) 2019 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __OCF_PROMOTION_NHIT_H__
#define __OCF_PROMOTION_NHIT_H__
enum nhit_param {
nhit_insertion_threshold,
nhit_trigger_threshold,
nhit_param_max
};
#define NHIT_MIN_THRESHOLD 2
#define NHIT_MAX_THRESHOLD 1000
#define NHIT_THRESHOLD_DEFAULT 3
#define NHIT_MIN_TRIGGER 0
#define NHIT_MAX_TRIGGER 100
#define NHIT_TRIGGER_DEFAULT 80
#endif /* __OCF_PROMOTION_NHIT_H__ */