bdevperf: Make bdevperf_construct_targets() asynchronous by sentinel value
Follow the idea of bdev_get_iostat in module/bdev/rpc/bdev_rpc.c. Add a global variable g_bdev_count and then set it to 1 as sentinel value in bdev_construct_targets(). Subsequent patches will make _bdevperf_construct_targets() asynchronous. Then bdevperf_construct_targets() will be truely asynchronous. This patch is too small to be an independent patch but keep to hold previous review result. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I49d0b6e6d61df65d4eb31c402f98cc4300482e20 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/639 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
a4335feb6d
commit
595173aaba
@ -1043,6 +1043,8 @@ bdevperf_construct_target(struct spdk_bdev *bdev, struct io_target_group *group)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t g_bdev_count = 0;
|
||||
|
||||
static struct io_target_group *
|
||||
get_next_io_target_group(void)
|
||||
{
|
||||
@ -1099,6 +1101,11 @@ bdevperf_construct_targets(void)
|
||||
{
|
||||
struct spdk_bdev *bdev;
|
||||
|
||||
/* Increment initial bdev_count so that it will never reach 0 in the middle
|
||||
* of iteration.
|
||||
*/
|
||||
g_bdev_count = 1;
|
||||
|
||||
if (g_target_bdev_name != NULL) {
|
||||
bdev = spdk_bdev_get_by_name(g_target_bdev_name);
|
||||
if (bdev) {
|
||||
@ -1114,7 +1121,9 @@ bdevperf_construct_targets(void)
|
||||
}
|
||||
}
|
||||
|
||||
bdevperf_construct_targets_tasks();
|
||||
if (--g_bdev_count == 0) {
|
||||
bdevperf_construct_targets_tasks();
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user