Commit b0262063 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

vbdev_lvol: Report memory domains



Update functional test to verify that lvol supports
memory domains

Signed-off-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Change-Id: I5e91eedc8879359c3add45d417b6f3eaad4d75b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11375


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent aaaf5039
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -941,6 +941,17 @@ vbdev_lvol_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_
	return;
}

static int
vbdev_lvol_get_memory_domains(void *ctx, struct spdk_memory_domain **domains, int array_size)
{
	struct spdk_lvol *lvol = ctx;
	struct spdk_bdev *base_bdev;

	base_bdev = lvol->lvol_store->bs_dev->get_base_bdev(lvol->lvol_store->bs_dev);

	return spdk_bdev_get_memory_domains(base_bdev, domains, array_size);
}

static struct spdk_bdev_fn_table vbdev_lvol_fn_table = {
	.destruct		= vbdev_lvol_unregister,
	.io_type_supported	= vbdev_lvol_io_type_supported,
@@ -948,6 +959,7 @@ static struct spdk_bdev_fn_table vbdev_lvol_fn_table = {
	.get_io_channel		= vbdev_lvol_get_io_channel,
	.dump_info_json		= vbdev_lvol_dump_info_json,
	.write_config_json	= vbdev_lvol_write_config_json,
	.get_memory_domains	= vbdev_lvol_get_memory_domains,
};

static void
+56 −18
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ if [ "$TEST_TRANSPORT" != "rdma" ]; then
	exit 0
fi

MALLOC_BDEV_SIZE=64
MALLOC_BDEV_SIZE=256
MALLOC_BLOCK_SIZE=512
subsystem="0"
rpc_py="$rootdir/scripts/rpc.py"
@@ -21,23 +21,6 @@ function gen_malloc_json() {
		    {
		      "subsystem": "bdev",
		      "config": [
		        {
		          "method": "bdev_nvme_set_options",
		          "params": {
		            "action_on_timeout": "none",
		            "timeout_us": 0,
		            "retry_count": 4,
		            "arbitration_burst": 0,
		            "low_priority_weight": 0,
		            "medium_priority_weight": 0,
		            "high_priority_weight": 0,
		            "nvme_adminq_poll_period_us": 10000,
		            "keep_alive_timeout_ms" : 10000,
		            "nvme_ioq_poll_period_us": 0,
		            "io_queue_requests": 0,
		            "delay_cmd_submit": true
		          }
		        },
		        {
		          "method": "bdev_malloc_create",
		          "params": {
@@ -58,6 +41,52 @@ function gen_malloc_json() {
	JSON
}

function gen_lvol_nvme_json() {
	local subsystem=$1

	jq . <<- JSON
		{
		  "subsystems": [
		    {
		      "subsystem": "bdev",
		      "config": [
		        {
		          "method": "bdev_nvme_attach_controller",
		          "params": {
		            "name": "Nvme${subsystem}",
		            "trtype": "$TEST_TRANSPORT",
		            "adrfam": "IPv4",
		            "traddr": "$NVMF_FIRST_TARGET_IP",
		            "trsvcid": "$NVMF_PORT",
		            "subnqn": "nqn.2016-06.io.spdk:cnode${subsystem}"
		          }
		        },
		        {
		          "method": "bdev_lvol_create_lvstore",
		          "params": {
		            "bdev_name": "Nvme${subsystem}n1",
		            "lvs_name": "lvs${subsystem}"
		          }
		        },
		        {
		          "method": "bdev_lvol_create",
		          "params": {
		            "lvol_name": "lvol${subsystem}",
		            "size": 134217728,
		            "thin_provision": true,
		            "lvs_name": "lvs${subsystem}"
		          }
		        },
		        {
		          "method": "bdev_wait_for_examine"
		        }
		      ]
		    }
		  ]
		}
	JSON
}

nvmftestinit
nvmfappstart -m 0x3

@@ -74,6 +103,15 @@ $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$subsystem -t $TEST
# test data pull/push with split against local malloc
"$rootdir/test/dma/test_dma/test_dma" -q 16 -o 4096 -w randrw -M 70 -t 5 -m 0xc --json <(gen_malloc_json) -b "Malloc0" -x pull_push -r /var/tmp/dma.sock

# test memzero with logical volumes. All clusters are unallocated, read should trigger memzero
"$rootdir/test/dma/test_dma/test_dma" -q 16 -o 4096 -w randread -M 70 -t 5 -m 0xc --json <(gen_lvol_nvme_json $subsystem) -b "lvs${subsystem}/lvol${subsystem}" -f -x memzero -r /var/tmp/dma.sock

# clear blob metadata
$rootdir/build/examples/perf -q 16 -o 4096 -w write -t 1 -r "trtype:$TEST_TRANSPORT adrfam:IPV4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT"

# test memory translation with logical volumes
"$rootdir/test/dma/test_dma/test_dma" -q 16 -o 4096 -w randrw -M 70 -t 5 -m 0xc --json <(gen_lvol_nvme_json $subsystem) -b "lvs${subsystem}/lvol${subsystem}" -f -x translate -r /var/tmp/dma.sock

trap - SIGINT SIGTERM EXIT

nvmftestfini
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ bool g_lvs_with_name_already_exists = false;
bool g_ext_api_called;

DEFINE_STUB_V(spdk_bdev_module_fini_start_done, (void));
DEFINE_STUB(spdk_bdev_get_memory_domains, int, (struct spdk_bdev *bdev,
		struct spdk_memory_domain **domains, int array_size), 0);

const struct spdk_bdev_aliases_list *
spdk_bdev_get_aliases(const struct spdk_bdev *bdev)