examples/nvme_fio_plugin: move completion-helpers

Preparation patch for the addition of the 'initial_zone_reset' plugin-option.

Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Change-Id: I768fc207b74cfa2a516009e10fc2a4646d06ba72
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4948
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Simon A. F. Lund 2020-10-28 15:44:37 +01:00 committed by Jim Harris
parent f896aa6f10
commit 528ad3b3cf

View File

@ -254,6 +254,36 @@ get_fio_qpair(struct spdk_fio_thread *fio_thread, struct fio_file *f)
return NULL;
}
/**
* Callback function to use while processing completions until completion-indicator turns non-zero
*/
static void
pcu_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
{
int *completed = ctx;
*completed = spdk_nvme_cpl_is_error(cpl) ? -1 : 1;
}
/**
* Process Completions Until the given 'completed' indicator turns non-zero or an error occurs
*/
static int32_t
pcu(struct spdk_nvme_qpair *qpair, int *completed)
{
int32_t ret;
while (!*completed) {
ret = spdk_nvme_qpair_process_completions(qpair, 1);
if (ret < 0) {
log_err("spdk/nvme: process_compl(): ret: %d\n", ret);
return ret;
}
}
return 0;
}
#endif
static void
@ -1083,36 +1113,6 @@ spdk_fio_get_zoned_model(struct thread_data *td, struct fio_file *f, enum zbd_zo
return -EINVAL;
}
/**
* Callback function to use while processing completions until completion-indicator turns non-zero
*/
static void
pcu_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
{
int *completed = ctx;
*completed = spdk_nvme_cpl_is_error(cpl) ? -1 : 1;
}
/**
* Process Completions Until the given 'completed' indicator turns non-zero or an error occurs
*/
static int32_t
pcu(struct spdk_nvme_qpair *qpair, int *completed)
{
int32_t ret;
while (!*completed) {
ret = spdk_nvme_qpair_process_completions(qpair, 1);
if (ret < 0) {
log_err("spdk/nvme: process_compl(): ret: %d\n", ret);
return ret;
}
}
return 0;
}
static uint64_t
spdk_fio_qpair_mdts_nbytes(struct spdk_fio_qpair *fio_qpair)
{