ocf: accept optional base in bottom adapter

Interpret volume->open() options as our vbdev_ocf_base struct.
This is used during metadata probe procedure, when there is no
  vbdev configurations created, so we need to pass base structure
  as option.

This patch is a prepartion for persistant metadata support,
  and it does not change current behavior.

Change-Id: I0b7435df1692d8b3028931c6c9fc50d2d84b2557
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455415
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Vitaliy Mysak 2019-05-23 20:47:11 +00:00 committed by Jim Harris
parent 4f31e10705
commit fec9d4146b

View File

@ -47,11 +47,15 @@ static int
vbdev_ocf_volume_open(ocf_volume_t volume, void *opts)
{
struct vbdev_ocf_base **priv = ocf_volume_get_priv(volume);
struct vbdev_ocf_base *base = vbdev_ocf_get_base_by_name(ocf_volume_get_uuid(volume)->data);
struct vbdev_ocf_base *base;
if (base == NULL) {
assert(false);
return -EINVAL;
if (opts) {
base = opts;
} else {
base = vbdev_ocf_get_base_by_name(ocf_volume_get_uuid(volume)->data);
if (base == NULL) {
return -ENODEV;
}
}
*priv = base;