bdev: add INI config file options for bdev_io parameters

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I10bd5cab8789b8cf4d8fd9cb848cede8372be45e

Reviewed-on: https://review.gerrithub.io/414712
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2018-06-11 07:35:48 -07:00
parent 9f2a0a67ae
commit 9f583911fd
7 changed files with 56 additions and 0 deletions

View File

@ -29,6 +29,15 @@
# Set to 0xFFFFFFFFFFFFFFFF to enable all tracepoint groups.
#TpointGroupMask 0x0
# Users may activate entries in this section to override default values for
# global parameters in the block device (bdev) subsystem.
[Bdev]
# Number of spdk_bdev_io structures allocated in the global bdev subsystem pool.
#BdevIoPoolSize 65536
# Maximum number of spdk_bdev_io structures to cache per thread.
#BdevIoCacheSize 256
[iSCSI]
# node name (not include optional part)
# Users can optionally change this to fit their environment.

View File

@ -26,6 +26,15 @@
#PciWhitelist 0000:03:00.0
#PciWhitelist 0000:04:00.0
# Users may activate entries in this section to override default values for
# global parameters in the block device (bdev) subsystem.
[Bdev]
# Number of spdk_bdev_io structures allocated in the global bdev subsystem pool.
#BdevIoPoolSize 65536
# Maximum number of spdk_bdev_io structures to cache per thread.
#BdevIoCacheSize 256
# Users may change this section to create a different number or size of
# malloc LUNs.
# This will generate 8 LUNs with a malloc-allocated backend.

View File

@ -29,6 +29,16 @@
# Set to 0xFFFFFFFFFFFFFFFF to enable all tracepoint groups.
#TpointGroupMask 0x0
# Users may activate entries in this section to override default values for
# global parameters in the block device (bdev) subsystem.
[Bdev]
# Number of spdk_bdev_io structures allocated in the global bdev subsystem pool.
#BdevIoPoolSize 65536
# Maximum number of spdk_bdev_io structures to cache per thread.
#BdevIoCacheSize 256
# Users may not want to use offload even it is available.
# Users can use offload by specifying "Enable Yes" in this section
# if it is available.
# Users may use the whitelist to initialize specified devices, IDS

View File

@ -637,12 +637,37 @@ spdk_bdev_modules_init(void)
void
spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg)
{
struct spdk_conf_section *sp;
struct spdk_bdev_opts bdev_opts;
int32_t bdev_io_pool_size, bdev_io_cache_size;
int cache_size;
int rc = 0;
char mempool_name[32];
assert(cb_fn != NULL);
sp = spdk_conf_find_section(NULL, "Bdev");
if (sp != NULL) {
spdk_bdev_get_opts(&bdev_opts);
bdev_io_pool_size = spdk_conf_section_get_intval(sp, "BdevIoPoolSize");
if (bdev_io_pool_size >= 0) {
bdev_opts.bdev_io_pool_size = bdev_io_pool_size;
}
bdev_io_cache_size = spdk_conf_section_get_intval(sp, "BdevIoCacheSize");
if (bdev_io_cache_size >= 0) {
bdev_opts.bdev_io_cache_size = bdev_io_cache_size;
}
if (spdk_bdev_set_opts(&bdev_opts)) {
spdk_bdev_init_complete(-1);
return;
}
assert(memcmp(&bdev_opts, &g_bdev_opts, sizeof(bdev_opts)) == 0);
}
g_init_cb_fn = cb_fn;
g_init_cb_arg = cb_arg;

View File

@ -45,6 +45,7 @@ DEFINE_STUB(spdk_conf_find_section, struct spdk_conf_section *, (struct spdk_con
const char *name), NULL);
DEFINE_STUB(spdk_conf_section_get_nmval, char *,
(struct spdk_conf_section *sp, const char *key, int idx1, int idx2), NULL);
DEFINE_STUB(spdk_conf_section_get_intval, int, (struct spdk_conf_section *sp, const char *key), -1);
static void
_bdev_send_msg(spdk_thread_fn fn, void *ctx, void *thread_ctx)

View File

@ -51,6 +51,7 @@ DEFINE_STUB(spdk_conf_find_section, struct spdk_conf_section *, (struct spdk_con
const char *name), NULL);
DEFINE_STUB(spdk_conf_section_get_nmval, char *,
(struct spdk_conf_section *sp, const char *key, int idx1, int idx2), NULL);
DEFINE_STUB(spdk_conf_section_get_intval, int, (struct spdk_conf_section *sp, const char *key), -1);
struct ut_bdev {
struct spdk_bdev bdev;

View File

@ -46,6 +46,7 @@ DEFINE_STUB(spdk_conf_find_section, struct spdk_conf_section *, (struct spdk_con
const char *name), NULL);
DEFINE_STUB(spdk_conf_section_get_nmval, char *,
(struct spdk_conf_section *sp, const char *key, int idx1, int idx2), NULL);
DEFINE_STUB(spdk_conf_section_get_intval, int, (struct spdk_conf_section *sp, const char *key), -1);
static void
_part_send_msg(spdk_thread_fn fn, void *ctx, void *thread_ctx)