diff --git a/lib/bdev/ocf/vbdev_ocf.c b/lib/bdev/ocf/vbdev_ocf.c index 943d49f9f..b055b4f47 100644 --- a/lib/bdev/ocf/vbdev_ocf.c +++ b/lib/bdev/ocf/vbdev_ocf.c @@ -1068,10 +1068,17 @@ init_vbdev_config(struct vbdev_ocf *vbdev) vbdev->cfg.core.try_add = true; } + /* Serialize bdev names in OCF UUID to interpret on future loads + * Core UUID is pair of (core bdev name, cache bdev name) + * Cache UUID is cache bdev name */ cfg->device.uuid.size = strlen(vbdev->cache.name) + 1; cfg->device.uuid.data = vbdev->cache.name; - cfg->core.uuid.size = strlen(vbdev->core.name) + 1; - cfg->core.uuid.data = vbdev->core.name; + + snprintf(vbdev->uuid, VBDEV_OCF_MD_MAX_LEN, "%s %s", + vbdev->core.name, vbdev->name); + cfg->core.uuid.size = strlen(vbdev->uuid) + 1; + cfg->core.uuid.data = vbdev->uuid; + vbdev->uuid[strlen(vbdev->core.name)] = 0; } /* Allocate vbdev structure object and add it to the global list */ diff --git a/lib/bdev/ocf/vbdev_ocf.h b/lib/bdev/ocf/vbdev_ocf.h index 16ab26e92..0b952bd5a 100644 --- a/lib/bdev/ocf/vbdev_ocf.h +++ b/lib/bdev/ocf/vbdev_ocf.h @@ -39,6 +39,8 @@ #include "spdk/bdev.h" #include "spdk/bdev_module.h" +#define VBDEV_OCF_MD_MAX_LEN 4096 + struct vbdev_ocf; /* Context for OCF queue poller @@ -169,6 +171,9 @@ struct vbdev_ocf { /* Exposed SPDK bdev. Registered in bdev layer */ struct spdk_bdev exp_bdev; + /* OCF uuid for core device of this vbdev */ + char uuid[VBDEV_OCF_MD_MAX_LEN]; + /* Link to global list of this type structures */ TAILQ_ENTRY(vbdev_ocf) tailq; };