OCF: hotremove support
Add basic handling of base devices hotremove When either core or caching device gets unregistered, the vbdev_ocf does so as well Change-Id: I05769f714bf22cb320558fed86adc8c3d8a0a185 Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Reviewed-on: https://review.gerrithub.io/c/435729 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
This commit is contained in:
parent
0487d3a4ee
commit
3ec532e1f7
@ -780,6 +780,24 @@ vbdev_ocf_module_fini(void)
|
||||
vbdev_ocf_ctx_cleanup();
|
||||
}
|
||||
|
||||
/* When base device gets unpluged this is called
|
||||
* We will unregister cache vbdev here */
|
||||
static void
|
||||
hotremove_cb(void *ctx)
|
||||
{
|
||||
struct vbdev_ocf_base *base = ctx;
|
||||
struct spdk_bdev *bdev = base->bdev;
|
||||
|
||||
if (base->parent->state.doing_finish) {
|
||||
return;
|
||||
}
|
||||
|
||||
SPDK_NOTICELOG("Deinitializing '%s' because its %s device '%s' was removed\n",
|
||||
base->parent->name, base->is_cache ? "cache" : "core", bdev->name);
|
||||
|
||||
vbdev_ocf_delete(base->parent);
|
||||
}
|
||||
|
||||
/* Open base SPDK bdev and claim it */
|
||||
static int
|
||||
attach_base(struct vbdev_ocf_base *base)
|
||||
@ -790,7 +808,7 @@ attach_base(struct vbdev_ocf_base *base)
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
status = spdk_bdev_open(base->bdev, true, NULL, NULL, &base->desc);
|
||||
status = spdk_bdev_open(base->bdev, true, hotremove_cb, base, &base->desc);
|
||||
if (status) {
|
||||
SPDK_ERRLOG("Unable to open device '%s' for writing\n", base->name);
|
||||
return status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user