Dynamic I/O queue management

- Queue allocation is now separated from starting cache.
- Queue can be created and destroyed in runtime.
- All queue ops accept queue handle instead of queue id.
- Cache stores queues as list instead of array.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Michal Mielewczyk
2019-02-15 08:12:00 -05:00
committed by Robert Baldyga
parent 1771228a46
commit e53944d472
38 changed files with 379 additions and 445 deletions

View File

@@ -536,7 +536,7 @@ static bool _acp_prepare_flush_data(struct acp_context *acp,
/* Clean at most 'flush_max_buffers' cache lines from current or newly
* selected chunk */
void cleaning_policy_acp_perform_cleaning(struct ocf_cache *cache,
void cleaning_policy_acp_perform_cleaning(ocf_cache_t cache,
ocf_cleaner_end_t cmpl)
{
struct acp_cleaning_policy_config *config;

View File

@@ -449,7 +449,7 @@ void cleaning_policy_alru_setup(struct ocf_cache *cache)
config->activity_threshold = OCF_ALRU_DEFAULT_ACTIVITY_THRESHOLD;
}
int cleaning_policy_alru_initialize(struct ocf_cache *cache, int init_metadata)
int cleaning_policy_alru_initialize(ocf_cache_t cache, int init_metadata)
{
struct ocf_user_part *part;
ocf_part_id_t part_id;

View File

@@ -11,6 +11,7 @@
#include "../ocf_ctx_priv.h"
#include "../mngt/ocf_mngt_common.h"
#include "../metadata/metadata.h"
#include "../ocf_queue_priv.h"
#define SLEEP_TIME_MS (1000)
@@ -63,11 +64,6 @@ void ocf_cleaner_set_cmpl(ocf_cleaner_t cleaner, ocf_cleaner_end_t fn)
cleaner->end = fn;
}
void ocf_cleaner_set_io_queue(ocf_cleaner_t cleaner, uint32_t io_queue)
{
cleaner->io_queue = io_queue;
}
void ocf_cleaner_set_priv(ocf_cleaner_t c, void *priv)
{
OCF_CHECK_NULL(c);
@@ -112,13 +108,21 @@ static void ocf_cleaner_run_complete(ocf_cleaner_t cleaner, uint32_t interval)
env_rwsem_up_write(&cache->lock);
cleaner->end(cleaner, interval);
ocf_queue_put(cleaner->io_queue);
cleaner->io_queue = NULL;
}
void ocf_cleaner_run(ocf_cleaner_t cleaner)
void ocf_cleaner_run(ocf_cleaner_t cleaner, ocf_queue_t queue)
{
ocf_cache_t cache = ocf_cleaner_get_cache(cleaner);
ocf_cache_t cache;
ocf_cleaning_t clean_type;
OCF_CHECK_NULL(cleaner);
OCF_CHECK_NULL(queue);
cache = ocf_cleaner_get_cache(cleaner);
/* Do not involve cleaning when cache is not running
* (error, etc.).
*/
@@ -143,6 +147,9 @@ void ocf_cleaner_run(ocf_cleaner_t cleaner)
ENV_BUG_ON(clean_type >= ocf_cleaning_max);
ocf_queue_get(queue);
cleaner->io_queue = queue;
/* Call cleaning. */
if (cleaning_policy_ops[clean_type].perform_cleaning) {
cleaning_policy_ops[clean_type].perform_cleaning(cache,

View File

@@ -59,7 +59,7 @@ extern struct cleaning_policy_ops cleaning_policy_ops[ocf_cleaning_max];
struct ocf_cleaner {
void *cleaning_policy_context;
uint32_t io_queue;
ocf_queue_t io_queue;
ocf_cleaner_end_t end;
void *priv;
};