This resets count_pages_variable on cache-detach, so during the following
cache-attach metadata size is calculated properly.
Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
During core remove/detach ocf_cleaner_refcnt_freeze was called only
when cache was attached, but ocf_cleaner_refcnt_unfreeze was called
regardless of cache state.
Signed-off-by: Daniel Madej <daniel.madej@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>
The flag isn't reset before retraversation so it might be true even if cache
line was reparted in the meantime
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Resetting cache_error/core_error in ocf_req_forward_* functions may lead
to overwriting already reported error if the forward is being done in the
loop.
To avoid this potential problem, introduce set of forward init functions
intended to be called before the entire forward operation, which resets
the error code and sets a forward callback.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
We skip cleaning the mapping and moving the cache line to the free list
in a situation when there are waiters on the cache line lock.
Refrain from decrementing core stats in that situation as well, and let
repart of the waiter request do the updates as needed.
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>
The fewer (atomic variable accesses on IO path) the better fare
Signed-off-by: Roel Apfelbaum <roel.apfelbaum@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
UBSAN: array-index-out-of-bounds in src/ocf_request.c:230:44
index 1 is out of range for type 'ocf_map_info [*]'
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
`req->error` should be modified by the request's owner only; hence, if
the request has been allocated to handle IO (i.e. it's not an internal OCF
request) only engines can change it
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 one is quite special, because it can be called before cache is
instantiated, which means we can not allocate the request using
ocf_req_new_mngt() due to absence of mngt_queue. For that reason we
simply allocate request using env_zalloc() and then release it with
env_free(). The lifecycle of the request is very straightforward and
the only used fields are forward counter and callback.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
It's intended to be used in a context, where cache is not initialized
and the io_queue is not available yet.
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>