Commit 971ec012 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

bdevperf: Add hide_metadata option



Add hide_metadata option to the bdevperf tool as a global option.
Verify the option by adding a simple test with three DIF configuration.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I20696a07fe8334473854377c38d2ac7516af494f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25145


Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent 894d5af2
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ static const char *g_bdevperf_conf_file = NULL;
static double g_zipf_theta;
static bool g_random_map = false;
static bool g_unique_writes = false;
static bool g_hide_metadata = false;

static struct spdk_cpuset g_all_cpuset;
static struct spdk_poller *g_perf_timer = NULL;
@@ -1863,6 +1864,7 @@ bdevperf_construct_job(struct spdk_bdev *bdev, struct job_config *config,
		       struct spdk_thread *thread)
{
	struct bdevperf_job *job;
	struct spdk_bdev_open_opts opts = {};
	struct bdevperf_task *task;
	int block_size, data_block_size;
	int rc;
@@ -1884,7 +1886,11 @@ bdevperf_construct_job(struct spdk_bdev *bdev, struct job_config *config,
		return -ENOMEM;
	}

	rc = spdk_bdev_open_ext(job->name, true, bdevperf_bdev_removed, job, &job->bdev_desc);
	spdk_bdev_open_opts_init(&opts, sizeof(opts));
	opts.hide_metadata = g_hide_metadata;

	rc = spdk_bdev_open_ext_v2(job->name, true, bdevperf_bdev_removed, job, &opts,
				   &job->bdev_desc);
	if (rc != 0) {
		fprintf(stderr, "Could not open leaf bdev %s, error=%d\n", job->name, rc);
		bdevperf_job_free(job);
@@ -2809,6 +2815,8 @@ bdevperf_parse_arg(int ch, char *arg)
		g_io_size = (int)size;
	} else if (ch == 'U') {
		g_unique_writes = true;
	} else if (ch == 'N') {
		g_hide_metadata = true;
	} else {
		tmp = spdk_strtoll(arg, 10);
		if (tmp < 0) {
@@ -2875,6 +2883,7 @@ bdevperf_usage(void)
	printf(" -E                        share per lcore thread among jobs. Available only if -j is not used.\n");
	printf(" -J                        File name to open with append mode and log JSON RPC calls.\n");
	printf(" -U                        generate unique data for each write I/O, has no effect on non-write I/O\n");
	printf(" -N                        Enable hide_metadata option to each bdev\n");
}

static void
@@ -2998,7 +3007,7 @@ main(int argc, char **argv)
	opts.rpc_addr = NULL;
	opts.shutdown_cb = spdk_bdevperf_shutdown_cb;

	if ((rc = spdk_app_parse_args(argc, argv, &opts, "Zzfq:o:t:w:k:CEF:J:M:P:S:T:Xlj:DU", NULL,
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "Zzfq:o:t:w:k:CEF:J:M:P:S:T:Xlj:DUN", NULL,
				      bdevperf_parse_arg, bdevperf_usage)) !=
	    SPDK_APP_PARSE_ARGS_SUCCESS) {
		return rc;
+39 −0
Original line number Diff line number Diff line
@@ -609,6 +609,44 @@ function stat_test_suite() {
	trap - SIGINT SIGTERM EXIT
}

# Create three types of DIF configuration, 512 + 8, 512 + 16 (DIF is first 8bytes), and
# 512 + 16 (DIF is last 8 bytes)
function dif_insert_strip_test_suite() {
	DIF_DEV_1="Malloc_DIF_1"
	DIF_DEV_2="Malloc_DIF_2"
	DIF_DEV_3="Malloc_DIF_3"

	"$rootdir/build/examples/bdevperf" -z -m 0xf -q 32 -o 4096 -w randrw -M 50 -t 5 -C -N "$env_ctx" &
	DIF_PID=$!
	echo "Process bdev DIF insert/strip testing pid: $DIF_PID"
	trap 'cleanup; killprocess $DIF_PID; exit 1' SIGINT SIGTERM EXIT
	waitforlisten $DIF_PID

	$rpc_py bdev_malloc_create -b $DIF_DEV_1 1 512 -m 8 -t 1 -f 0 -i
	waitforbdev $DIF_DEV_1
	$rpc_py bdev_malloc_create -b $DIF_DEV_2 1 512 -m 16 -t 1 -f 0 -i
	waitforbdev $DIF_DEV_2
	$rpc_py bdev_malloc_create -b $DIF_DEV_3 1 512 -m 16 -t 1 -f 0 -i -d
	waitforbdev $DIF_DEV_3

	$rootdir/examples/bdev/bdevperf/bdevperf.py perform_tests &
	sleep 10

	# Bdevperf is expected to be there because DIF error should not happen.
	if kill -0 $DIF_PID; then
		echo "Process is existed. Pid: $DIF_PID"
	else
		echo "Process exited unexpectedly. Pid: $DIF_PID"
		exit 1
	fi

	$rpc_py bdev_malloc_delete $DIF_DEV_1
	$rpc_py bdev_malloc_delete $DIF_DEV_2
	$rpc_py bdev_malloc_delete $DIF_DEV_3
	killprocess $DIF_PID
	trap - SIGINT SIGTERM EXIT
}

function bdev_gpt_uuid() {
	local bdev

@@ -788,6 +826,7 @@ if [[ $test_type == bdev ]]; then
	run_test "bdev_qd_sampling" qd_sampling_test_suite "$env_ctx"
	run_test "bdev_error" error_test_suite "$env_ctx"
	run_test "bdev_stat" stat_test_suite "$env_ctx"
	run_test "bdev_dif_insert_strip" dif_insert_strip_test_suite "$env_ctx"
fi

if [[ $test_type == gpt ]]; then