From b56f1ef5e47b740e2934ef25ea9d051bde8917d4 Mon Sep 17 00:00:00 2001
From: Matthew King <matthew.king@xilinx.com>
Date: Mon, 18 Jan 2021 16:42:09 +0000
Subject: [PATCH] Cleanup: Fix boolean arg in fio plugin.

In fio, bools are represented as ints.  They have to be read into int entries
in the options struct, or memory corruption may occur.
Also provided a default to bring it more in line with existing fio code.

Signed-off-by: Matthew King <matthew.king@xilinx.com>
Change-Id: Ib718653d6597a287bf8ff96d2fb864e46295751d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6147
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
---
 examples/bdev/fio_plugin/fio_plugin.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c
index 90f1c4bb4..8d82e0363 100644
--- a/examples/bdev/fio_plugin/fio_plugin.c
+++ b/examples/bdev/fio_plugin/fio_plugin.c
@@ -59,7 +59,7 @@ struct spdk_fio_options {
 	char *conf;
 	char *json_conf;
 	unsigned mem_mb;
-	bool mem_single_seg;
+	int mem_single_seg;
 };
 
 struct spdk_fio_request {
@@ -789,6 +789,7 @@ static struct fio_option options[] = {
 		.type		= FIO_OPT_BOOL,
 		.off1		= offsetof(struct spdk_fio_options, mem_single_seg),
 		.help		= "If set to 1, SPDK will use just a single hugetlbfs file",
+		.def            = "0",
 		.category	= FIO_OPT_C_ENGINE,
 		.group		= FIO_OPT_G_INVALID,
 	},
-- 
2.37.2.windows.2

