nvmf/subsystem: Open block device with extended API
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: I471cceefd58ad4c4c64c140fcc66dc25dde43254 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468541 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
5017a67fdc
commit
657575210d
@ -1,8 +1,8 @@
|
|||||||
/*-
|
/*-
|
||||||
* BSD LICENSE
|
* BSD LICENSE
|
||||||
*
|
*
|
||||||
* Copyright (c) Intel Corporation.
|
* Copyright (c) Intel Corporation. All rights reserved.
|
||||||
* All rights reserved.
|
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -959,6 +959,27 @@ spdk_nvmf_ns_hot_remove(void *remove_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spdk_nvmf_ns_event(enum spdk_bdev_event_type type,
|
||||||
|
struct spdk_bdev *bdev,
|
||||||
|
void *event_ctx)
|
||||||
|
{
|
||||||
|
SPDK_DEBUGLOG(SPDK_LOG_NVMF, "Bdev event: type %d, name %s, subsystem_id %d, ns_id %d\n",
|
||||||
|
type,
|
||||||
|
bdev->name,
|
||||||
|
((struct spdk_nvmf_ns *)event_ctx)->subsystem->id,
|
||||||
|
((struct spdk_nvmf_ns *)event_ctx)->nsid);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case SPDK_BDEV_EVENT_REMOVE:
|
||||||
|
spdk_nvmf_ns_hot_remove(event_ctx);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SPDK_NOTICELOG("Unsupported bdev event: type %d\n", type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spdk_nvmf_ns_opts_get_defaults(struct spdk_nvmf_ns_opts *opts, size_t opts_size)
|
spdk_nvmf_ns_opts_get_defaults(struct spdk_nvmf_ns_opts *opts, size_t opts_size)
|
||||||
{
|
{
|
||||||
@ -1065,7 +1086,7 @@ spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bd
|
|||||||
ns->bdev = bdev;
|
ns->bdev = bdev;
|
||||||
ns->opts = opts;
|
ns->opts = opts;
|
||||||
ns->subsystem = subsystem;
|
ns->subsystem = subsystem;
|
||||||
rc = spdk_bdev_open(bdev, true, spdk_nvmf_ns_hot_remove, ns, &ns->desc);
|
rc = spdk_bdev_open_ext(bdev->name, true, spdk_nvmf_ns_event, ns, &ns->desc);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
SPDK_ERRLOG("Subsystem %s: bdev %s cannot be opened, error=%d\n",
|
SPDK_ERRLOG("Subsystem %s: bdev %s cannot be opened, error=%d\n",
|
||||||
subsystem->subnqn, spdk_bdev_get_name(bdev), rc);
|
subsystem->subnqn, spdk_bdev_get_name(bdev), rc);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*-
|
/*-
|
||||||
* BSD LICENSE
|
* BSD LICENSE
|
||||||
*
|
*
|
||||||
* Copyright (c) Intel Corporation.
|
* Copyright (c) Intel Corporation. All rights reserved.
|
||||||
* All rights reserved.
|
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -197,8 +197,8 @@ spdk_nvmf_ctrlr_ns_changed(struct spdk_nvmf_ctrlr *ctrlr, uint32_t nsid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t remove_cb,
|
spdk_bdev_open_ext(const char *bdev_name, bool write, spdk_bdev_event_cb_t event_cb,
|
||||||
void *remove_ctx, struct spdk_bdev_desc **desc)
|
void *event_ctx, struct spdk_bdev_desc **_desc)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user