test/bdevperf: construct a function bdevperf_end_task.
Extracting codes to a function, makes the more clear. Signed-off-by: yidong0635 <dongx.yi@intel.com> Change-Id: I49ae7b4f07ebacbeaf0c03941aeefc4657317e3b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5304 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
a085705f9f
commit
5986a1b42a
@ -429,6 +429,21 @@ bdevperf_job_end(void *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bdevperf_end_task(struct bdevperf_task *task)
|
||||
{
|
||||
struct bdevperf_job *job = task->job;
|
||||
|
||||
TAILQ_INSERT_TAIL(&job->task_list, task, link);
|
||||
if (job->is_draining) {
|
||||
if (job->current_queue_depth == 0) {
|
||||
spdk_put_io_channel(job->ch);
|
||||
spdk_bdev_close(job->bdev_desc);
|
||||
spdk_thread_send_msg(g_master_thread, bdevperf_job_end, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bdevperf_queue_io_wait_with_cb(struct bdevperf_task *task, spdk_bdev_io_wait_cb cb_fn)
|
||||
{
|
||||
@ -474,17 +489,7 @@ bdevperf_abort_complete(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg
|
||||
}
|
||||
|
||||
spdk_bdev_free_io(bdev_io);
|
||||
|
||||
/* Return task to free list because abort is submitted on demand. */
|
||||
TAILQ_INSERT_TAIL(&job->task_list, task, link);
|
||||
|
||||
if (job->is_draining) {
|
||||
if (job->current_queue_depth == 0) {
|
||||
spdk_put_io_channel(job->ch);
|
||||
spdk_bdev_close(job->bdev_desc);
|
||||
spdk_thread_send_msg(g_master_thread, bdevperf_job_end, NULL);
|
||||
}
|
||||
}
|
||||
bdevperf_end_task(task);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -550,12 +555,7 @@ bdevperf_complete(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
|
||||
if (!job->is_draining) {
|
||||
bdevperf_submit_single(job, task);
|
||||
} else {
|
||||
TAILQ_INSERT_TAIL(&job->task_list, task, link);
|
||||
if (job->current_queue_depth == 0) {
|
||||
spdk_put_io_channel(job->ch);
|
||||
spdk_bdev_close(job->bdev_desc);
|
||||
spdk_thread_send_msg(g_master_thread, bdevperf_job_end, NULL);
|
||||
}
|
||||
bdevperf_end_task(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user