nvmf: Reject bdev with separate metadata to attach to subsystem

NVMe bdev module support separate metadata now but NVMf subsystem
cannot process bdev with separate metadata yet.

Hence reject any bdev with separate metadata to be attached
explicitly by this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I793c6c5f61deb766d7bf427ff67ccc57a48974cf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457167
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-06-07 14:01:22 +09:00 committed by Changpeng Liu
parent a47e7de332
commit c758dc088a
2 changed files with 11 additions and 0 deletions

View File

@ -1022,6 +1022,11 @@ spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bd
return 0;
}
if (spdk_bdev_get_md_size(bdev) != 0 && !spdk_bdev_is_md_interleaved(bdev)) {
SPDK_ERRLOG("Can't attach bdev with separate metadata.\n");
return 0;
}
spdk_nvmf_ns_opts_get_defaults(&opts, sizeof(opts));
if (user_opts) {
memcpy(&opts, user_opts, spdk_min(sizeof(opts), opts_size));

View File

@ -53,6 +53,12 @@ DEFINE_STUB_V(spdk_bdev_module_release_bdev,
DEFINE_STUB(spdk_bdev_get_block_size, uint32_t,
(const struct spdk_bdev *bdev), 512);
DEFINE_STUB(spdk_bdev_get_md_size, uint32_t,
(const struct spdk_bdev *bdev), 0);
DEFINE_STUB(spdk_bdev_is_md_interleaved, bool,
(const struct spdk_bdev *bdev), false);
DEFINE_STUB(spdk_nvmf_transport_stop_listen,
int,
(struct spdk_nvmf_transport *transport,