test: Add check to bdevperf to fail if IO size is not a block multiple

For those with fat fingers or really bad vision... previously bdevperf
would take a bogus size and try to make it work, if you used the verify
feature this could (or would in my case) result in a data miscompare.

Change-Id: Id5d4c4130c3d3c0606d6a243d2ca278e539684e9
Signed-off-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/425883
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Paul Luse 2018-09-17 19:44:33 -07:00 committed by Changpeng Liu
parent 6c275b7a63
commit 8e54e10c4f

5
test/bdev/bdevperf/bdevperf.c Normal file → Executable file
View File

@ -231,8 +231,9 @@ bdevperf_construct_targets(void)
target->current_queue_depth = 0;
target->offset_in_ios = 0;
target->io_size_blocks = g_io_size / spdk_bdev_get_block_size(bdev);
if (target->io_size_blocks == 0) {
SPDK_ERRLOG("IO size (%d) is bigger than blocksize of bdev %s (%"PRIu32")\n",
if (target->io_size_blocks == 0 ||
(g_io_size % spdk_bdev_get_block_size(bdev)) != 0) {
SPDK_ERRLOG("IO size (%d) is bigger than blocksize of bdev %s (%"PRIu32") or not a blocksize multiple\n",
g_io_size, spdk_bdev_get_name(bdev), spdk_bdev_get_block_size(bdev));
spdk_bdev_close(target->bdev_desc);
free(target->name);