examples/nvme_fio_plugin: error out on unsupported blocksize

According to the SPDK nvme fio plugin documentation:

"Blocksize should be set as the sum of data and metadata.
For example, if data blocksize is 512 Byte, host generated
PI metadata is 8 Byte, then blocksize in fio configure file
should be 520 Byte."

Error out if this requirement is not satisfied.
This requirement does not apply for the separate metadata case.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I730a83beb6a85695c8a4b80995340b4064375d5a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5557
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Niklas Cassel 2020-12-13 19:43:47 +01:00 committed by Tomasz Zawadzki
parent d80b4f4287
commit dffb272c1a

View File

@ -400,6 +400,14 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
fio_qpair->extended_lba ? "extended lba" : "separate metadata");
}
if (spdk_nvme_ns_supports_extended_lba(ns) &&
(spdk_nvme_ns_get_extended_sector_size(ns) != td->o.bs[DDIR_READ] ||
spdk_nvme_ns_get_extended_sector_size(ns) != td->o.bs[DDIR_WRITE])) {
SPDK_ERRLOG("--bs has to be equal to LBA data size + Metadata size\n");
g_error = true;
return;
}
f->real_file_size = spdk_nvme_ns_get_size(fio_qpair->ns);
if (f->real_file_size <= 0) {
g_error = true;