diff --git a/src/cleaning/cleaning.c b/src/cleaning/cleaning.c index 5964f81..ff8ea80 100644 --- a/src/cleaning/cleaning.c +++ b/src/cleaning/cleaning.c @@ -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); } diff --git a/src/cleaning/cleaning.h b/src/cleaning/cleaning.h index bb9061e..e8dcf75 100644 --- a/src/cleaning/cleaning.h +++ b/src/cleaning/cleaning.h @@ -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 { diff --git a/src/cleaning/nop.c b/src/cleaning/nop.c new file mode 100644 index 0000000..bfa0fab --- /dev/null +++ b/src/cleaning/nop.c @@ -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); +} diff --git a/src/cleaning/nop.h b/src/cleaning/nop.h new file mode 100644 index 0000000..291483f --- /dev/null +++ b/src/cleaning/nop.h @@ -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