Commit 595173aa authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I49d0b6e6d61df65d4eb31c402f98cc4300482e20
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/639


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent a4335feb
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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,8 +1121,10 @@ bdevperf_construct_targets(void)
		}
	}

	if (--g_bdev_count == 0) {
		bdevperf_construct_targets_tasks();
	}
}

static int
io_target_group_create(void *io_device, void *ctx_buf)