bdevperf: update target list in bdevperf_construct_target
The target list is now updated inside bdevperf_construct_target. That way, if the target is successfully created, it'll already be on the target list once this function finishes. Change-Id: I364c45005c28deadae37615b6ac85f3860fc5080 Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457089 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
535654f826
commit
5012fcc148
@ -258,14 +258,12 @@ blockdev_heads_destroy(void)
|
||||
}
|
||||
|
||||
static int
|
||||
bdevperf_construct_target(struct spdk_bdev *bdev, struct io_target **_target)
|
||||
bdevperf_construct_target(struct spdk_bdev *bdev)
|
||||
{
|
||||
struct io_target *target;
|
||||
size_t align;
|
||||
int block_size, data_block_size;
|
||||
int rc;
|
||||
|
||||
*_target = NULL;
|
||||
int rc, index;
|
||||
|
||||
if (g_unmap && !spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
|
||||
printf("Skipping %s because it does not support unmap\n", spdk_bdev_get_name(bdev));
|
||||
@ -335,32 +333,29 @@ bdevperf_construct_target(struct spdk_bdev *bdev, struct io_target **_target)
|
||||
target->reset_timer = NULL;
|
||||
TAILQ_INIT(&target->task_list);
|
||||
|
||||
*_target = target;
|
||||
/* Mapping each created target to lcore */
|
||||
index = g_target_count % spdk_env_get_core_count();
|
||||
target->next = g_head[index];
|
||||
target->lcore = g_coremap[index];
|
||||
g_head[index] = target;
|
||||
g_target_count++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
bdevperf_construct_targets(void)
|
||||
{
|
||||
int index = 0;
|
||||
struct spdk_bdev *bdev;
|
||||
struct io_target *target;
|
||||
int rc;
|
||||
|
||||
bdev = spdk_bdev_first_leaf();
|
||||
while (bdev != NULL) {
|
||||
rc = bdevperf_construct_target(bdev, &target);
|
||||
rc = bdevperf_construct_target(bdev);
|
||||
if (rc != 0) {
|
||||
return;
|
||||
}
|
||||
if (target != NULL) {
|
||||
/* Mapping each created target to lcore */
|
||||
index = g_target_count % spdk_env_get_core_count();
|
||||
target->next = g_head[index];
|
||||
target->lcore = g_coremap[index];
|
||||
g_head[index] = target;
|
||||
g_target_count++;
|
||||
}
|
||||
|
||||
bdev = spdk_bdev_next_leaf(bdev);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user