Commit 6b5a1d6c authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

bdev/pmem: add conf support to test in blockdev.sh



The long-term plan is to use the JSON-based configuration format, but
for now, we need a config file section to be able to test a bdev module
in blockdev.sh.

Change-Id: I2a69f7172693ed6d4939a3b938747e2a1c62ff83
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/405908


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 998b961e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -92,6 +92,12 @@ It is possible to create pmem bdev using SPDK RPC:
./scripts/rpc.py construct_pmem_bdev -n bdev_name /path/to/pmem_pool
~~~

Configuration file syntax:
~~~
[Pmem]
  Blk /path/to/pmem_pool bdev_name
~~~

## Null {#bdev_config_null}

The SPDK null bdev driver is a dummy block I/O target that discards all writes and returns undefined
+6 −0
Original line number Diff line number Diff line
@@ -152,6 +152,12 @@
  AIO /dev/sdc AIO1
  AIO /tmp/myfile AIO2 4096

# PMDK libpmemblk-based block device
[Pmem]
  # Syntax:
  #   Blk <pmemblk pool file name> <bdev name>
  Blk /path/to/pmem-pool Pmem0

# The Split virtual block device slices block devices into multiple smaller bdevs.
[Split]
  # Syntax:
+6 −0
Original line number Diff line number Diff line
@@ -42,6 +42,12 @@
  AIO /dev/sdc AIO1
  AIO /tmp/myfile AIO2 4096

# PMDK libpmemblk-based block device
[Pmem]
  # Syntax:
  #   Blk <pmemblk pool file name> <bdev name>
  Blk /path/to/pmem-pool Pmem0

# Define NVMf protocol global options
[Nvmf]
  # Set the maximum number of submission and completion queues per session.
+6 −0
Original line number Diff line number Diff line
@@ -43,6 +43,12 @@
  #AIO /dev/sdb AIO0
  #AIO /dev/sdc AIO1

# PMDK libpmemblk-based block device
[Pmem]
  # Syntax:
  #   Blk <pmemblk pool file name> <bdev name>
  Blk /path/to/pmem-pool Pmem0

# Users may change this section to create a different number or size of
#  malloc LUNs.
# If the system has hardware DMA engine, it will use an IOAT
+37 −0
Original line number Diff line number Diff line
@@ -385,6 +385,41 @@ spdk_create_pmem_disk(const char *pmem_file, const char *name, struct spdk_bdev
	return 0;
}

static void
bdev_pmem_read_conf(void)
{
	struct spdk_conf_section *sp;
	struct spdk_bdev *bdev;
	const char *pmem_file;
	const char *bdev_name;
	int i;

	sp = spdk_conf_find_section(NULL, "Pmem");
	if (sp == NULL) {
		return;
	}

	for (i = 0; ; i++) {
		if (!spdk_conf_section_get_nval(sp, "Blk", i)) {
			break;
		}

		pmem_file = spdk_conf_section_get_nmval(sp, "Blk", i, 0);
		if (pmem_file == NULL) {
			SPDK_ERRLOG("Pmem: missing filename\n");
			continue;
		}

		bdev_name = spdk_conf_section_get_nmval(sp, "Blk", i, 1);
		if (bdev_name == NULL) {
			SPDK_ERRLOG("Pmem: missing bdev name\n");
			continue;
		}

		spdk_create_pmem_disk(pmem_file, bdev_name, &bdev);
	}
}

static int
bdev_pmem_initialize(void)
{
@@ -398,6 +433,8 @@ bdev_pmem_initialize(void)

	spdk_io_device_register(&g_pmem_disks, bdev_pmem_create_cb, bdev_pmem_destroy_cb, 0);

	bdev_pmem_read_conf();

	return 0;

}
Loading