The cleaning metadata has been deinitialized in the previous pipeline
step together with other services
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Unfreezing a refcnt might be a sleeping operation so it can't be called
from completion context. Moving D2C refcnt unfreeze to a separate step
in pipeline ensures that it will always be called from process context
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
The cleaning metadata has been deinitialized in the previous pipeline step
together with other services
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Flushing metadata has nothing to do with dinitializing services so it
should be a separate step in the stop pipeline
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Move flushing metadata outside cache_detinit_services(), so the function
can be shared between stop() and detach() without redundant ifs.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
The completion callback is called only in the cache stop scenario, after
flushing the metadata
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
After attaching new cache device handle all the IOs in Pass-Through mode
until all the d2c requests are completed.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
New caches are added to the list at the point where they are already
initialized and no errors are possible at this point, hence list_del() in error
handling is redundant.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
When IO queues are used for parallelized management operations,
e.g. changing cleaning policy, a deadlock may occur due to global
metadata lock interfering with taking request from IO queue,
as they might be run on the same thread. As a workaround using
a management queue specifically for such operations eliminates
this problem.
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com>
This avoids unnecessary map allocation and initialization of unused fields of
request structure. It also allows to track thier number separately from
the regular requests
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
The user is supposed to deinit/destroy it.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
The queues can be created and destroyed dynamically at any point in
the cache lifetime, and this can happen from different execution contexts,
thus there is a need to protect the queue_list with a lock.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Previously every created queue was added to io_queues list, which
made mngt_queue being used in ocf_parallelize. Change mngt_queue creation
API so that mngt_queue is not added to the list and doesn't have
unnecessary functionalities initialized.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Majority of management operations should be blocked for detached cache,
although adding and removing cores should be possible.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Stop and cache detach were already sharing contexts implicitly, which allowed
to reuse some functions in both pipelines. However, changing the context structs
could lead to not obvious bugs.
To prevent such errors both methods now share context structure explicitly
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
'stop_pipeline' filed may be reused during cache lifetime (e.g. when cache is
detached and attached again - the pipeline would be freed and then
re-allocated). Calling completion after detach before freeing the pipeline may
lead to race condition.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>