bdevperf: simplify bdevperf_submit_single

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I93987ed25779f016e8056f6cd472ec3da99b7d94

Reviewed-on: https://review.gerrithub.io/415073
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2018-06-13 07:04:46 -07:00
parent ed6827edbf
commit 529d9b0dec

View File

@ -391,52 +391,29 @@ bdevperf_submit_single(struct io_target *target, struct bdevperf_task *task)
task->iov.iov_len = g_io_size;
rc = spdk_bdev_writev_blocks(desc, ch, &task->iov, 1, task->offset_blocks,
target->io_size_blocks, bdevperf_verify_write_complete, task);
if (rc) {
printf("Failed to submit writev: %d\n", rc);
target->is_draining = true;
g_run_failed = true;
return;
}
} else if (g_flush) {
rc = spdk_bdev_flush_blocks(desc, ch, task->offset_blocks,
target->io_size_blocks, bdevperf_complete, task);
if (rc) {
printf("Failed to submit flush: %d\n", rc);
target->is_draining = true;
g_run_failed = true;
return;
}
} else if (g_unmap) {
rc = spdk_bdev_unmap_blocks(desc, ch, task->offset_blocks,
target->io_size_blocks, bdevperf_complete, task);
if (rc) {
printf("Failed to submit unmap: %d\n", rc);
target->is_draining = true;
g_run_failed = true;
return;
}
} else if ((g_rw_percentage == 100) ||
(g_rw_percentage != 0 && ((rand_r(&seed) % 100) < g_rw_percentage))) {
rbuf = g_zcopy ? NULL : task->buf;
rc = spdk_bdev_read_blocks(desc, ch, rbuf, task->offset_blocks,
target->io_size_blocks, bdevperf_complete, task);
if (rc) {
printf("Failed to submit read: %d\n", rc);
target->is_draining = true;
g_run_failed = true;
return;
}
} else {
task->iov.iov_base = task->buf;
task->iov.iov_len = g_io_size;
rc = spdk_bdev_writev_blocks(desc, ch, &task->iov, 1, task->offset_blocks,
target->io_size_blocks, bdevperf_complete, task);
if (rc) {
printf("Failed to submit writev: %d\n", rc);
target->is_draining = true;
g_run_failed = true;
return;
}
}
if (rc) {
printf("Failed to submit bdev_io: %d\n", rc);
target->is_draining = true;
g_run_failed = true;
return;
}
target->current_queue_depth++;