bdev/null: Add metadata size configuration file parameter

Configuration file allows to configure only metadata size. Metadata
transfer method is always set to 'interleave'.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I083375807162265c6c0cf82d46910e8658c2de9a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464779
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Evgeniy Kochetov 2019-07-31 12:07:58 +00:00 committed by Ben Walker
parent 8031dfe208
commit 0ddcc49d8a

View File

@ -315,6 +315,7 @@ bdev_null_initialize(void)
struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "Null");
uint64_t size_in_mb, num_blocks;
int block_size, i, rc = 0;
int md_size;
struct spdk_bdev *bdev;
const char *name, *val;
struct spdk_null_bdev_opts opts = {};
@ -377,11 +378,23 @@ bdev_null_initialize(void)
}
}
val = spdk_conf_section_get_nmval(sp, "Dev", i, 3);
if (val == NULL) {
md_size = 0;
} else {
md_size = (int)spdk_strtol(val, 10);
if (md_size < 0) {
SPDK_ERRLOG("Null entry %d: Invalid metadata size %s\n", i, val);
continue;
}
}
num_blocks = size_in_mb * (1024 * 1024) / block_size;
opts.name = name;
opts.num_blocks = num_blocks;
opts.block_size = block_size;
opts.md_size = md_size;
opts.md_interleave = true;
rc = create_null_bdev(&bdev, &opts);
if (rc) {
SPDK_ERRLOG("Could not create null bdev\n");
@ -419,8 +432,8 @@ bdev_null_get_spdk_running_config(FILE *fp)
TAILQ_FOREACH(bdev, &g_null_bdev_head, tailq) {
null_bdev_size = bdev->bdev.blocklen * bdev->bdev.blockcnt;
null_bdev_size /= (1024 * 1024);
fprintf(fp, " %s %" PRIu64 " %d\n",
bdev->bdev.name, null_bdev_size, bdev->bdev.blocklen);
fprintf(fp, " Dev %s %" PRIu64 " %d %d\n",
bdev->bdev.name, null_bdev_size, bdev->bdev.blocklen, bdev->bdev.md_len);
}
}