From dffb272c1a82136e2accf2c6184cd7bac129b47a Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Sun, 13 Dec 2020 19:43:47 +0100 Subject: [PATCH] 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 Change-Id: I730a83beb6a85695c8a4b80995340b4064375d5a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5557 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- examples/nvme/fio_plugin/fio_plugin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 0c76e8f06..926c015ca 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -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;