From fec9d4146b61cbb13057c7bc8a801c006a6435a7 Mon Sep 17 00:00:00 2001 From: Vitaliy Mysak Date: Thu, 23 May 2019 20:47:11 +0000 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455415 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Darek Stojaczyk Reviewed-by: Tomasz Zawadzki --- lib/bdev/ocf/volume.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/bdev/ocf/volume.c b/lib/bdev/ocf/volume.c index 72a4328434..aa7b15d317 100644 --- a/lib/bdev/ocf/volume.c +++ b/lib/bdev/ocf/volume.c @@ -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;