Merge pull request #369 from mmichal10/async-stop-compl
Before stop wait for start to be finished
This commit is contained in:
commit
6bb4dde213
@ -58,9 +58,11 @@ struct cas_classifier;
|
|||||||
struct cache_priv {
|
struct cache_priv {
|
||||||
uint64_t core_id_bitmap[DIV_ROUND_UP(OCF_CORE_MAX, 8*sizeof(uint64_t))];
|
uint64_t core_id_bitmap[DIV_ROUND_UP(OCF_CORE_MAX, 8*sizeof(uint64_t))];
|
||||||
struct cas_classifier *classifier;
|
struct cas_classifier *classifier;
|
||||||
|
struct work_struct start_worker;
|
||||||
struct _cache_mngt_stop_context *stop_context;
|
struct _cache_mngt_stop_context *stop_context;
|
||||||
atomic_t flush_interrupt_enabled;
|
atomic_t flush_interrupt_enabled;
|
||||||
ocf_queue_t mngt_queue;
|
ocf_queue_t mngt_queue;
|
||||||
|
void *attach_context;
|
||||||
ocf_queue_t io_queues[];
|
ocf_queue_t io_queues[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -434,7 +434,6 @@ struct _cache_mngt_attach_context {
|
|||||||
struct ocf_mngt_cache_device_config *device_cfg;
|
struct ocf_mngt_cache_device_config *device_cfg;
|
||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
int ocf_start_error;
|
int ocf_start_error;
|
||||||
struct work_struct work;
|
|
||||||
struct task_struct *rollback_thread;
|
struct task_struct *rollback_thread;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -1695,8 +1694,9 @@ static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv,
|
|||||||
|
|
||||||
static void cache_start_finalize(struct work_struct *work)
|
static void cache_start_finalize(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct _cache_mngt_attach_context *ctx =
|
struct cache_priv *cache_priv =
|
||||||
container_of(work, struct _cache_mngt_attach_context, work);
|
container_of(work, struct cache_priv, start_worker);
|
||||||
|
struct _cache_mngt_attach_context *ctx = cache_priv->attach_context;
|
||||||
int result;
|
int result;
|
||||||
ocf_cache_t cache = ctx->cache;
|
ocf_cache_t cache = ctx->cache;
|
||||||
|
|
||||||
@ -1734,6 +1734,7 @@ static void cache_start_finalize(struct work_struct *work)
|
|||||||
static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv, int error)
|
static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv, int error)
|
||||||
{
|
{
|
||||||
struct _cache_mngt_attach_context *ctx = priv;
|
struct _cache_mngt_attach_context *ctx = priv;
|
||||||
|
struct cache_priv *cache_priv = ocf_cache_get_priv(cache);
|
||||||
int caller_status = _cache_mngt_async_callee_peek_result(&ctx->async);
|
int caller_status = _cache_mngt_async_callee_peek_result(&ctx->async);
|
||||||
|
|
||||||
if (caller_status || error) {
|
if (caller_status || error) {
|
||||||
@ -1750,8 +1751,7 @@ static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv, int error)
|
|||||||
} else {
|
} else {
|
||||||
_cache_mngt_log_cache_device_path(cache, ctx->device_cfg);
|
_cache_mngt_log_cache_device_path(cache, ctx->device_cfg);
|
||||||
|
|
||||||
INIT_WORK(&ctx->work, cache_start_finalize);
|
schedule_work(&cache_priv->start_worker);
|
||||||
schedule_work(&ctx->work);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1773,6 +1773,7 @@ static int _cache_mngt_cache_priv_init(ocf_cache_t cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
atomic_set(&cache_priv->flush_interrupt_enabled, 1);
|
atomic_set(&cache_priv->flush_interrupt_enabled, 1);
|
||||||
|
INIT_WORK(&cache_priv->start_worker , cache_start_finalize);
|
||||||
|
|
||||||
ocf_cache_set_priv(cache, cache_priv);
|
ocf_cache_set_priv(cache, cache_priv);
|
||||||
|
|
||||||
@ -1899,6 +1900,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg,
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
cache_priv = ocf_cache_get_priv(cache);
|
cache_priv = ocf_cache_get_priv(cache);
|
||||||
|
cache_priv->attach_context = context;
|
||||||
|
|
||||||
if (load) {
|
if (load) {
|
||||||
ocf_mngt_cache_load(cache, device_cfg,
|
ocf_mngt_cache_load(cache, device_cfg,
|
||||||
@ -1914,6 +1916,9 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg,
|
|||||||
if (result != -KCAS_ERR_WAITING_INTERRUPTED)
|
if (result != -KCAS_ERR_WAITING_INTERRUPTED)
|
||||||
kfree(context);
|
kfree(context);
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
cache_priv->attach_context = NULL;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
err:
|
err:
|
||||||
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
|
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
|
||||||
@ -2153,6 +2158,7 @@ int cache_mngt_exit_instance(const char *cache_name, size_t name_len, int flush)
|
|||||||
|
|
||||||
cache_priv = ocf_cache_get_priv(cache);
|
cache_priv = ocf_cache_get_priv(cache);
|
||||||
mngt_queue = cache_priv->mngt_queue;
|
mngt_queue = cache_priv->mngt_queue;
|
||||||
|
cancel_work_sync(&cache_priv->start_worker);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush cache. Flushing may take a long time, so we allow user
|
* Flush cache. Flushing may take a long time, so we allow user
|
||||||
|
Loading…
Reference in New Issue
Block a user