lvol: pass lvol store to vbdev_lvol_create()
All of the call sites already have a lvs pointer; there's no need to look up the lvs by UUID again. Change-Id: Icef54d84e7c89f682ea47f10b282839ab4237ce0 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/389892 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
5aae23aa08
commit
f5acc37221
@ -702,18 +702,12 @@ end:
|
||||
}
|
||||
|
||||
int
|
||||
vbdev_lvol_create(uuid_t uuid, const char *name, size_t sz,
|
||||
vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, size_t sz,
|
||||
spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg)
|
||||
{
|
||||
struct spdk_lvol_with_handle_req *req;
|
||||
struct spdk_lvol_store *lvs;
|
||||
int rc;
|
||||
|
||||
lvs = vbdev_get_lvol_store_by_uuid(uuid);
|
||||
if (lvs == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
req = calloc(1, sizeof(*req));
|
||||
if (req == NULL) {
|
||||
return -ENOMEM;
|
||||
|
@ -52,7 +52,7 @@ int vbdev_lvs_create(struct spdk_bdev *base_bdev, const char *name, uint32_t clu
|
||||
void vbdev_lvs_destruct(struct spdk_lvol_store *lvs, spdk_lvs_op_complete cb_fn, void *cb_arg);
|
||||
void vbdev_lvs_unload(struct spdk_lvol_store *lvs, spdk_lvs_op_complete cb_fn, void *cb_arg);
|
||||
|
||||
int vbdev_lvol_create(uuid_t uuid, const char *name, size_t sz,
|
||||
int vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, size_t sz,
|
||||
spdk_lvol_op_with_handle_complete cb_fn,
|
||||
void *cb_arg);
|
||||
|
||||
|
@ -336,7 +336,7 @@ spdk_rpc_construct_lvol_bdev(struct spdk_jsonrpc_request *request,
|
||||
|
||||
sz = (size_t)req.size;
|
||||
|
||||
rc = vbdev_lvol_create(lvs->uuid, req.lvol_name, sz, _spdk_rpc_construct_lvol_bdev_cb, request);
|
||||
rc = vbdev_lvol_create(lvs, req.lvol_name, sz, _spdk_rpc_construct_lvol_bdev_cb, request);
|
||||
if (rc < 0) {
|
||||
goto invalid;
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ ut_lvs_destroy(void)
|
||||
|
||||
/* Suuccessfully create lvol, which should be unloaded with lvs later */
|
||||
g_lvolerrno = -1;
|
||||
rc = vbdev_lvol_create(lvs->uuid, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
rc = vbdev_lvol_create(lvs, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(g_lvolerrno == 0);
|
||||
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
|
||||
@ -526,7 +526,6 @@ ut_lvs_destroy(void)
|
||||
static void
|
||||
ut_lvol_init(void)
|
||||
{
|
||||
uuid_t wrong_uuid;
|
||||
int sz = 10;
|
||||
int rc;
|
||||
|
||||
@ -542,18 +541,12 @@ ut_lvol_init(void)
|
||||
g_lvs_bdev->bdev = g_base_bdev;
|
||||
|
||||
uuid_generate_time(g_lvs->uuid);
|
||||
uuid_generate_time(wrong_uuid);
|
||||
|
||||
/* Incorrect uuid set */
|
||||
g_lvolerrno = 0;
|
||||
rc = vbdev_lvol_create(wrong_uuid, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
CU_ASSERT(rc == -ENODEV);
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_spdk_lvol_pairs, g_lvs_bdev, lvol_stores);
|
||||
|
||||
/* Successful lvol create */
|
||||
g_lvolerrno = -1;
|
||||
rc = vbdev_lvol_create(g_lvs->uuid, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
rc = vbdev_lvol_create(g_lvs, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
SPDK_CU_ASSERT_FATAL(rc == 0);
|
||||
CU_ASSERT(g_lvol != NULL);
|
||||
CU_ASSERT(g_lvolerrno == 0);
|
||||
@ -703,7 +696,7 @@ ut_lvol_resize(void)
|
||||
|
||||
/* Successful lvol create */
|
||||
g_lvolerrno = -1;
|
||||
rc = vbdev_lvol_create(g_lvs->uuid, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
rc = vbdev_lvol_create(g_lvs, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(g_lvolerrno == 0);
|
||||
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
|
||||
@ -761,7 +754,7 @@ ut_lvs_unload(void)
|
||||
|
||||
/* Suuccessfully create lvol, which should be destroyed with lvs later */
|
||||
g_lvolerrno = -1;
|
||||
rc = vbdev_lvol_create(lvs->uuid, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
rc = vbdev_lvol_create(lvs, "lvol", sz, vbdev_lvol_create_complete, NULL);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(g_lvolerrno == 0);
|
||||
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user