ut/bdev: change module initialization to async

This patch changes UT so that bdev modules have async init.
It demonstrates issue with triggering assert in init path,
when bdev modules are reinitialized multiple times.

Change-Id: I9b2b16d8ac53bac6a929f6929ceedb70b250c500
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454618
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-05-15 09:39:10 -04:00 committed by Darek Stojaczyk
parent 2bbd1eb444
commit d83a3489cc
2 changed files with 8 additions and 0 deletions

View File

@ -259,11 +259,14 @@ bdev_ut_destroy_ch(void *io_device, void *ctx_buf)
g_bdev_ut_channel = NULL;
}
struct spdk_bdev_module bdev_ut_if;
static int
bdev_ut_module_init(void)
{
spdk_io_device_register(&g_bdev_ut_io_device, bdev_ut_create_ch, bdev_ut_destroy_ch,
sizeof(struct bdev_ut_channel), NULL);
spdk_bdev_module_init_done(&bdev_ut_if);
return 0;
}
@ -277,6 +280,7 @@ struct spdk_bdev_module bdev_ut_if = {
.name = "bdev_ut",
.module_init = bdev_ut_module_init,
.module_fini = bdev_ut_module_fini,
.async_init = true,
};
static void vbdev_ut_examine(struct spdk_bdev *bdev);

View File

@ -187,9 +187,12 @@ static struct spdk_bdev_fn_table fn_table = {
.submit_request = stub_submit_request,
};
struct spdk_bdev_module bdev_ut_if;
static int
module_init(void)
{
spdk_bdev_module_init_done(&bdev_ut_if);
return 0;
}
@ -214,6 +217,7 @@ struct spdk_bdev_module bdev_ut_if = {
.name = "bdev_ut",
.module_init = module_init,
.module_fini = module_fini,
.async_init = true,
.init_complete = init_complete,
.fini_start = fini_start,
};