ocf: add loadq flag to construct path
Add new loadq flag that indicates if vbdev
should load cache instance from disk or start a new one.
This change is a preparation for persistent metadata support.
Functionality is not changed in this patch as the loadq flag is always false.
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455409 (master)
(cherry picked from commit 242564a82c
)
Change-Id: I1baac7f988e6eeadb4f365ba7bfab8019d55a753
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457263
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
c6b5afcec9
commit
8e0360cffa
@ -1064,7 +1064,8 @@ static int
|
||||
init_vbdev(const char *vbdev_name,
|
||||
const char *cache_mode_name,
|
||||
const char *cache_name,
|
||||
const char *core_name)
|
||||
const char *core_name,
|
||||
bool loadq)
|
||||
{
|
||||
struct vbdev_ocf *vbdev;
|
||||
int rc = 0;
|
||||
@ -1113,6 +1114,7 @@ init_vbdev(const char *vbdev_name,
|
||||
goto error_mem;
|
||||
}
|
||||
|
||||
vbdev->cfg.loadq = loadq;
|
||||
init_vbdev_config(vbdev);
|
||||
TAILQ_INSERT_TAIL(&g_ocf_vbdev_head, vbdev, tailq);
|
||||
return rc;
|
||||
@ -1180,7 +1182,7 @@ vbdev_ocf_init(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
status = init_vbdev(vbdev_name, modename, cache_name, core_name);
|
||||
status = init_vbdev(vbdev_name, modename, cache_name, core_name, false);
|
||||
if (status) {
|
||||
SPDK_ERRLOG("Config initialization failed with code: %d\n", status);
|
||||
}
|
||||
@ -1304,6 +1306,7 @@ vbdev_ocf_construct(const char *vbdev_name,
|
||||
const char *cache_mode_name,
|
||||
const char *cache_name,
|
||||
const char *core_name,
|
||||
bool loadq,
|
||||
void (*cb)(int, struct vbdev_ocf *, void *),
|
||||
void *cb_arg)
|
||||
{
|
||||
@ -1312,7 +1315,7 @@ vbdev_ocf_construct(const char *vbdev_name,
|
||||
struct spdk_bdev *core_bdev = spdk_bdev_get_by_name(core_name);
|
||||
struct vbdev_ocf *vbdev;
|
||||
|
||||
rc = init_vbdev(vbdev_name, cache_mode_name, cache_name, core_name);
|
||||
rc = init_vbdev(vbdev_name, cache_mode_name, cache_name, core_name, loadq);
|
||||
if (rc) {
|
||||
cb(rc, NULL, cb_arg);
|
||||
return;
|
||||
|
@ -81,6 +81,10 @@ struct vbdev_ocf_config {
|
||||
|
||||
/* Core initial config */
|
||||
struct ocf_mngt_core_config core;
|
||||
|
||||
/* Load flag, if set to true, then we will try load cache instance from disk,
|
||||
* otherwise we will create new cache on that disk */
|
||||
bool loadq;
|
||||
};
|
||||
|
||||
/* Types for management operations */
|
||||
@ -174,6 +178,7 @@ void vbdev_ocf_construct(
|
||||
const char *cache_mode_name,
|
||||
const char *cache_name,
|
||||
const char *core_name,
|
||||
bool loadq,
|
||||
void (*cb)(int, struct vbdev_ocf *, void *),
|
||||
void *cb_arg);
|
||||
|
||||
|
@ -98,7 +98,7 @@ spdk_rpc_construct_ocf_bdev(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
vbdev_ocf_construct(req.name, req.mode, req.cache_bdev_name, req.core_bdev_name,
|
||||
vbdev_ocf_construct(req.name, req.mode, req.cache_bdev_name, req.core_bdev_name, false,
|
||||
construct_cb, request);
|
||||
free_rpc_construct_ocf_bdev(&req);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user