ocf: serialize base bdev names in OCF UUID
Use OCF per-volume UUID field to serialize bdev names. This is going to be used during cache load to find out which bdevs we want to attach. Note that there is in fact "user_metadata" buffor that is also stored in cache metadata, but we cannot use it because its size is limited to 64 bytes. UUID in OCF terms is not standarized and is meant to be used to store custom immutable data. This change preparation for persistent metadata support. Functionality is not changed. (everything works the same way) Change-Id: Ia9204fae29106f5b816d93a6771425a223d6c028 Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455414 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
1292ef24e7
commit
4003ebf73c
@ -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 */
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user