ocf: send flush during shutdown

Do management flush during OCF shutdown to write all dirty requests to cores.
Dirty requests are relevant to WriteBack mode only.

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450683 (master)

(cherry picked from commit 40cac0ecad)
Change-Id: I778a73ed8ab5659921f192f638027d513c239814
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457260
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Vitaliy Mysak 2019-04-17 18:55:31 +00:00 committed by Darek Stojaczyk
parent a2711aa354
commit 11b1e6bf4c

View File

@ -306,8 +306,40 @@ wait_for_requests(struct vbdev_ocf *vbdev)
vbdev_ocf_mngt_poll(vbdev, wait_for_requests_poll);
}
static void
flush_vbdev_cmpl(ocf_cache_t cache, void *priv, int error)
{
struct vbdev_ocf *vbdev = priv;
ocf_mngt_cache_unlock(cache);
vbdev_ocf_mngt_continue(vbdev, error);
}
static void
flush_vbdev_poll(struct vbdev_ocf *vbdev)
{
if (!ocf_cache_is_running(vbdev->ocf_cache)) {
vbdev_ocf_mngt_continue(vbdev, -EINVAL);
return;
}
if (ocf_mngt_cache_trylock(vbdev->ocf_cache)) {
return;
}
vbdev_ocf_mngt_poll(vbdev, NULL);
ocf_mngt_cache_flush(vbdev->ocf_cache, false, flush_vbdev_cmpl, vbdev);
}
static void
flush_vbdev(struct vbdev_ocf *vbdev)
{
vbdev_ocf_mngt_poll(vbdev, flush_vbdev_poll);
}
/* Procedures called during unregister */
vbdev_ocf_mngt_fn unregister_path[] = {
flush_vbdev,
wait_for_requests,
stop_vbdev,
detach_cache,