fio_plugin/nvme: add Bit Bucket SGL with READ support

For the purpose to enable the stress test with Bit Bucket SGL,
here we added one new parameters: "bit_bucket_data_len".
For testing it, user should set "enable_sgl=1" and
"bit_bucket_data_len=4096".  This means total 4096 Bytes of
data will be described by Bit Bucket SGL, note that the value
should be less than block size specified in the fio command
line.

We will count the Bit Bucket data from the beginning of each
I/O for simplification.

Currently it's only valid for READ test. User can see the
performance improvement when enabled the Bit Bucket.

Change-Id: Ia481a324c25942d6ca051c71cb90f87d21955259
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1623
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Changpeng Liu 2020-03-26 00:30:04 -04:00 committed by Tomasz Zawadzki
parent b55279d485
commit 22a1acce97

View File

@ -57,6 +57,7 @@
static bool g_spdk_env_initialized;
static int g_spdk_enable_sgl = 0;
static uint32_t g_spdk_sge_size = 4096;
static uint32_t g_spdk_bit_bucket_data_len = 0;
static uint32_t g_spdk_pract_flag;
static uint32_t g_spdk_prchk_flags;
static uint32_t g_spdk_md_per_io_size = 4096;
@ -69,6 +70,7 @@ struct spdk_fio_options {
int shm_id;
int enable_sgl;
int sge_size;
int bit_bucket_data_len;
char *hostnqn;
int pi_act;
char *pi_chk;
@ -84,6 +86,9 @@ struct spdk_fio_request {
/** Offset in current iovec, fio only uses 1 vector */
uint32_t iov_offset;
/** Amount of data used for Bit Bucket SGL */
uint32_t bit_bucket_data_len;
/** Context for NVMe PI */
struct spdk_dif_ctx dif_ctx;
/** Separate metadata buffer pointer */
@ -413,6 +418,7 @@ static int spdk_fio_setup(struct thread_data *td)
opts.shm_id = fio_options->shm_id;
g_spdk_enable_sgl = fio_options->enable_sgl;
g_spdk_sge_size = fio_options->sge_size;
g_spdk_bit_bucket_data_len = fio_options->bit_bucket_data_len;
parse_pract_flag(fio_options->pi_act);
g_spdk_md_per_io_size = spdk_max(fio_options->md_per_io_size, 4096);
g_spdk_apptag = (uint16_t)fio_options->apptag;
@ -748,6 +754,7 @@ spdk_nvme_io_reset_sgl(void *ref, uint32_t sgl_offset)
struct spdk_fio_request *fio_req = (struct spdk_fio_request *)ref;
fio_req->iov_offset = sgl_offset;
fio_req->bit_bucket_data_len = 0;
}
static int
@ -756,6 +763,7 @@ spdk_nvme_io_next_sge(void *ref, void **address, uint32_t *length)
struct spdk_fio_request *fio_req = (struct spdk_fio_request *)ref;
struct io_u *io_u = fio_req->io;
uint32_t iov_len;
uint32_t bit_bucket_len;
*address = io_u->buf;
@ -769,8 +777,19 @@ spdk_nvme_io_next_sge(void *ref, void **address, uint32_t *length)
iov_len = g_spdk_sge_size;
}
if (fio_req->bit_bucket_data_len < g_spdk_bit_bucket_data_len) {
assert(g_spdk_bit_bucket_data_len < io_u->xfer_buflen);
*address = (void *)UINT64_MAX;
bit_bucket_len = g_spdk_bit_bucket_data_len - fio_req->bit_bucket_data_len;
if (iov_len > bit_bucket_len) {
iov_len = bit_bucket_len;
}
fio_req->bit_bucket_data_len += iov_len;
}
fio_req->iov_offset += iov_len;
*length = iov_len;
return 0;
}
@ -1037,6 +1056,16 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "bit_bucket_data_len",
.lname = "Amount of data used for Bit Bucket",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, bit_bucket_data_len),
.def = "0",
.help = "Bit Bucket Data Length for READ commands (disabled by default)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "hostnqn",
.lname = "Host NQN to use when connecting to controllers.",