Commit 93573400 authored by Ankit Kumar's avatar Ankit Kumar Committed by Konrad Sztyber
Browse files

nvme/fio_plugin: fix check with blocksizes



As there are other ways of specifying block sizes, such as
bsrange or bssplit, the existing check which validates if
block size is either multiple of LBA size or extended LBA
is not true.
So, if bsrange is specified instead of bs, the td->o.bs[ddir]
values are initialized to default 4096. So for namespaces
formatted with extended LBA, the existing check doesn't work.
The correct check should be against td->o.min_bs[ddir] and
td->o.max_bs[ddir].

Note if only bs or blocksize option is specified, fio will
initialize min_bs and max_bs values to bs.

Change-Id: I4c546cae2c3b406851afe3edec0eed239c98e99e
Signed-off-by: default avatarAnkit Kumar <ankit.kumar@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18060


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 7d07969f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -392,11 +392,11 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,

	block_size = _nvme_get_host_buffer_sector_size(ns, fio_qpair->io_flags);
	for_each_rw_ddir(ddir) {
		if (td->o.bs[ddir] % block_size != 0) {
		if (td->o.min_bs[ddir] % block_size != 0 || td->o.max_bs[ddir] % block_size != 0) {
			if (spdk_nvme_ns_supports_extended_lba(ns)) {
				SPDK_ERRLOG("--bs has to be a multiple of (LBA data size + Metadata size)\n");
				SPDK_ERRLOG("--bs or other block size related option has to be a multiple of (LBA data size + Metadata size)\n");
			} else {
				SPDK_ERRLOG("--bs has to be a multiple of LBA data size\n");
				SPDK_ERRLOG("--bs or other block size related option has to be a multiple of LBA data size\n");
			}
			g_error = true;
			return;