initializing completion twice replaced with reinit
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
This commit is contained in:
parent
562834f4f8
commit
e7a9f29d36
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright(c) 2012-2021 Intel Corporation
|
* Copyright(c) 2012-2022 Intel Corporation
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -148,13 +148,26 @@ static int _cache_mngt_async_caller_set_result(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void _cache_mngt_async_context_init_common(
|
||||||
|
struct _cache_mngt_async_context *context)
|
||||||
|
{
|
||||||
|
spin_lock_init(&context->lock);
|
||||||
|
context->result = 0;
|
||||||
|
context->compl_func = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void _cache_mngt_async_context_init(
|
static inline void _cache_mngt_async_context_init(
|
||||||
struct _cache_mngt_async_context *context)
|
struct _cache_mngt_async_context *context)
|
||||||
{
|
{
|
||||||
init_completion(&context->cmpl);
|
init_completion(&context->cmpl);
|
||||||
spin_lock_init(&context->lock);
|
_cache_mngt_async_context_init_common(context);
|
||||||
context->result = 0;
|
}
|
||||||
context->compl_func = NULL;
|
|
||||||
|
static inline void _cache_mngt_async_context_reinit(
|
||||||
|
struct _cache_mngt_async_context *context)
|
||||||
|
{
|
||||||
|
reinit_completion(&context->cmpl);
|
||||||
|
_cache_mngt_async_context_init_common(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _cache_mngt_lock_complete(ocf_cache_t cache, void *priv, int error)
|
static void _cache_mngt_lock_complete(ocf_cache_t cache, void *priv, int error)
|
||||||
@ -2374,8 +2387,7 @@ out_module_put:
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
reinit_completion(&context->async.cmpl);
|
_cache_mngt_async_context_reinit(&context->async);
|
||||||
context->async.result = 0;
|
|
||||||
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
|
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
|
||||||
context);
|
context);
|
||||||
rollback_result = wait_for_completion_interruptible(&context->async.cmpl);
|
rollback_result = wait_for_completion_interruptible(&context->async.cmpl);
|
||||||
@ -2540,7 +2552,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg,
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
err:
|
err:
|
||||||
_cache_mngt_async_context_init(&context->async);
|
_cache_mngt_async_context_reinit(&context->async);
|
||||||
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
|
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
|
||||||
context);
|
context);
|
||||||
rollback_result = wait_for_completion_interruptible(&context->async.cmpl);
|
rollback_result = wait_for_completion_interruptible(&context->async.cmpl);
|
||||||
|
Loading…
Reference in New Issue
Block a user