Calling completions function in nop cleaning policy.

Unlocking cache and putting queue are perormed in cleaning completion, so all
cleaning policies has to call completion.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-03-08 04:43:19 -05:00
parent d86e253fe9
commit b611c0e67a
4 changed files with 35 additions and 8 deletions

View File

@ -5,6 +5,7 @@
#include "cleaning.h"
#include "alru.h"
#include "nop.h"
#include "acp.h"
#include "../ocf_priv.h"
#include "../ocf_cache_priv.h"
@ -13,11 +14,10 @@
#include "../metadata/metadata.h"
#include "../ocf_queue_priv.h"
#define SLEEP_TIME_MS (1000)
struct cleaning_policy_ops cleaning_policy_ops[ocf_cleaning_max] = {
[ocf_cleaning_nop] = {
.name = "nop",
.perform_cleaning = cleaning_nop_perform_cleaning,
},
[ocf_cleaning_alru] = {
.setup = cleaning_policy_alru_setup,
@ -110,7 +110,6 @@ static void ocf_cleaner_run_complete(ocf_cleaner_t cleaner, uint32_t interval)
cleaner->end(cleaner, interval);
ocf_queue_put(cleaner->io_queue);
cleaner->io_queue = NULL;
}
void ocf_cleaner_run(ocf_cleaner_t cleaner, ocf_queue_t queue)
@ -150,9 +149,6 @@ void ocf_cleaner_run(ocf_cleaner_t cleaner, ocf_queue_t queue)
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,
ocf_cleaner_run_complete);
}
cleaning_policy_ops[clean_type].perform_cleaning(cache,
ocf_cleaner_run_complete);
}

View File

@ -14,6 +14,8 @@
#define CLEANING_POLICY_CONFIG_BYTES 256
#define CLEANING_POLICY_TYPE_MAX 4
#define SLEEP_TIME_MS (1000)
struct ocf_request;
struct cleaning_policy_config {

14
src/cleaning/nop.c Normal file
View File

@ -0,0 +1,14 @@
/*
* Copyright(c) 2012-2018 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#include "ocf/ocf.h"
#include "nop.h"
#include "../ocf_cache_priv.h"
void cleaning_nop_perform_cleaning(ocf_cache_t cache, ocf_cleaner_end_t cmpl)
{
uint32_t interval = SLEEP_TIME_MS;
cmpl(&cache->cleaner, interval);
}

15
src/cleaning/nop.h Normal file
View File

@ -0,0 +1,15 @@
/*
* Copyright(c) 2012-2018 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __LAYER_CLEANING_POLICY_NOP_H__
#define __LAYER_CLEANING_POLICY_NOP_H__
#include "cleaning.h"
#include "nop_structs.h"
void cleaning_nop_perform_cleaning(ocf_cache_t cache, ocf_cleaner_end_t cmpl);
#endif