nvmf: check block size is 512 aligned for each Namespace

NVMf target can't support extended LBA format for now, so print a
error log for those NVMe backend devices with extended LBA format.

Fix the issue #497.

Change-Id: Idda76ba934dd0eb45f92ae22b0b71398b3ae69dd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/432799
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
This commit is contained in:
Changpeng Liu 2018-11-12 01:29:41 -05:00 committed by Jim Harris
parent d815107bd5
commit d2525134e7
3 changed files with 12 additions and 0 deletions

View File

@ -995,6 +995,12 @@ spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bd
return 0;
}
if (spdk_bdev_get_block_size(bdev) % 512) {
SPDK_ERRLOG("Block size %u for Bdev %s is not supported now\n",
spdk_bdev_get_block_size(bdev), spdk_bdev_get_name(bdev));
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

@ -50,6 +50,9 @@ DEFINE_STUB(spdk_bdev_module_claim_bdev,
DEFINE_STUB_V(spdk_bdev_module_release_bdev,
(struct spdk_bdev *bdev));
DEFINE_STUB(spdk_bdev_get_block_size, uint32_t,
(const struct spdk_bdev *bdev), 512);
uint32_t
spdk_env_get_current_core(void)
{

View File

@ -49,6 +49,9 @@ DEFINE_STUB(spdk_bdev_module_claim_bdev,
DEFINE_STUB_V(spdk_bdev_module_release_bdev,
(struct spdk_bdev *bdev));
DEFINE_STUB(spdk_bdev_get_block_size, uint32_t,
(const struct spdk_bdev *bdev), 512);
static void
_subsystem_send_msg(spdk_thread_fn fn, void *ctx, void *thread_ctx)
{