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: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/405908 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
998b961e75
commit
6b5a1d6c24
@ -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
|
./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}
|
## Null {#bdev_config_null}
|
||||||
|
|
||||||
The SPDK null bdev driver is a dummy block I/O target that discards all writes and returns undefined
|
The SPDK null bdev driver is a dummy block I/O target that discards all writes and returns undefined
|
||||||
|
@ -152,6 +152,12 @@
|
|||||||
AIO /dev/sdc AIO1
|
AIO /dev/sdc AIO1
|
||||||
AIO /tmp/myfile AIO2 4096
|
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.
|
# The Split virtual block device slices block devices into multiple smaller bdevs.
|
||||||
[Split]
|
[Split]
|
||||||
# Syntax:
|
# Syntax:
|
||||||
|
@ -42,6 +42,12 @@
|
|||||||
AIO /dev/sdc AIO1
|
AIO /dev/sdc AIO1
|
||||||
AIO /tmp/myfile AIO2 4096
|
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
|
# Define NVMf protocol global options
|
||||||
[Nvmf]
|
[Nvmf]
|
||||||
# Set the maximum number of submission and completion queues per session.
|
# Set the maximum number of submission and completion queues per session.
|
||||||
|
@ -43,6 +43,12 @@
|
|||||||
#AIO /dev/sdb AIO0
|
#AIO /dev/sdb AIO0
|
||||||
#AIO /dev/sdc AIO1
|
#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
|
# Users may change this section to create a different number or size of
|
||||||
# malloc LUNs.
|
# malloc LUNs.
|
||||||
# If the system has hardware DMA engine, it will use an IOAT
|
# If the system has hardware DMA engine, it will use an IOAT
|
||||||
|
@ -385,6 +385,41 @@ spdk_create_pmem_disk(const char *pmem_file, const char *name, struct spdk_bdev
|
|||||||
return 0;
|
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
|
static int
|
||||||
bdev_pmem_initialize(void)
|
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);
|
spdk_io_device_register(&g_pmem_disks, bdev_pmem_create_cb, bdev_pmem_destroy_cb, 0);
|
||||||
|
|
||||||
|
bdev_pmem_read_conf();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,13 @@ if [ $SPDK_TEST_RBD -eq 1 ]; then
|
|||||||
$rootdir/scripts/gen_rbd.sh >> $testdir/bdev.conf
|
$rootdir/scripts/gen_rbd.sh >> $testdir/bdev.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if hash pmempool; then
|
||||||
|
rm -f /tmp/spdk-pmem-pool
|
||||||
|
pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool
|
||||||
|
echo "[Pmem]" >> $testdir/bdev.conf
|
||||||
|
echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $testdir/bdev.conf
|
||||||
|
fi
|
||||||
|
|
||||||
timing_enter bounds
|
timing_enter bounds
|
||||||
$testdir/bdevio/bdevio $testdir/bdev.conf
|
$testdir/bdevio/bdevio $testdir/bdev.conf
|
||||||
timing_exit bounds
|
timing_exit bounds
|
||||||
@ -138,6 +145,7 @@ if grep -q Nvme0 $testdir/bdev.conf; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /tmp/aiofile
|
rm -f /tmp/aiofile
|
||||||
|
rm -f /tmp/spdk-pmem-pool
|
||||||
rm -f $testdir/bdev.conf
|
rm -f $testdir/bdev.conf
|
||||||
report_test_completion "bdev"
|
report_test_completion "bdev"
|
||||||
timing_exit bdev
|
timing_exit bdev
|
||||||
|
@ -38,6 +38,13 @@
|
|||||||
|
|
||||||
#include "bdev/pmem/bdev_pmem.c"
|
#include "bdev/pmem/bdev_pmem.c"
|
||||||
|
|
||||||
|
DEFINE_STUB(spdk_conf_find_section, struct spdk_conf_section *,
|
||||||
|
(struct spdk_conf *cp, const char *name), NULL);
|
||||||
|
DEFINE_STUB(spdk_conf_section_get_nval, char *,
|
||||||
|
(struct spdk_conf_section *sp, const char *key, int idx), NULL);
|
||||||
|
DEFINE_STUB(spdk_conf_section_get_nmval, char *,
|
||||||
|
(struct spdk_conf_section *sp, const char *key, int idx1, int idx2), NULL);
|
||||||
|
|
||||||
static struct spdk_bdev_module *g_bdev_pmem_module;
|
static struct spdk_bdev_module *g_bdev_pmem_module;
|
||||||
static int g_bdev_module_cnt;
|
static int g_bdev_module_cnt;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user