bdev: add spdk_bdev_mgmt_channel_free_resources()
Call this function from spdk_bdev_mgmt_channel_destroy(). Currently there are no real resources to free, but that will change in an upcoming patch which adds per-thread bdev_io caches. While here, also add a for_each_channel iterator to call this function on each existing channel during bdev finish code path. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I9348e37053505c9fba7a6421e55ffc416668d24f Reviewed-on: https://review.gerrithub.io/392530 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
f1f14e5583
commit
8b0b3c350c
@ -359,14 +359,20 @@ spdk_bdev_mgmt_channel_create(void *io_device, void *ctx_buf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spdk_bdev_mgmt_channel_free_resources(struct spdk_bdev_mgmt_channel *ch)
|
||||||
|
{
|
||||||
|
if (!TAILQ_EMPTY(&ch->need_buf_small) || !TAILQ_EMPTY(&ch->need_buf_large)) {
|
||||||
|
SPDK_ERRLOG("Pending I/O list wasn't empty on channel free\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_bdev_mgmt_channel_destroy(void *io_device, void *ctx_buf)
|
spdk_bdev_mgmt_channel_destroy(void *io_device, void *ctx_buf)
|
||||||
{
|
{
|
||||||
struct spdk_bdev_mgmt_channel *ch = ctx_buf;
|
struct spdk_bdev_mgmt_channel *ch = ctx_buf;
|
||||||
|
|
||||||
if (!TAILQ_EMPTY(&ch->need_buf_small) || !TAILQ_EMPTY(&ch->need_buf_large)) {
|
spdk_bdev_mgmt_channel_free_resources(ch);
|
||||||
SPDK_ERRLOG("Pending I/O list wasn't empty on channel destruction\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -548,7 +554,7 @@ spdk_bdev_module_finish_cb(void *io_device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_bdev_module_finish_complete(void)
|
spdk_bdev_module_finish_complete(struct spdk_io_channel_iter *i, int status)
|
||||||
{
|
{
|
||||||
if (spdk_mempool_count(g_bdev_mgr.bdev_io_pool) != SPDK_BDEV_IO_POOL_SIZE) {
|
if (spdk_mempool_count(g_bdev_mgr.bdev_io_pool) != SPDK_BDEV_IO_POOL_SIZE) {
|
||||||
SPDK_ERRLOG("bdev IO pool count is %zu but should be %u\n",
|
SPDK_ERRLOG("bdev IO pool count is %zu but should be %u\n",
|
||||||
@ -578,6 +584,16 @@ spdk_bdev_module_finish_complete(void)
|
|||||||
spdk_io_device_unregister(&g_bdev_mgr, spdk_bdev_module_finish_cb);
|
spdk_io_device_unregister(&g_bdev_mgr, spdk_bdev_module_finish_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mgmt_channel_free_resources(struct spdk_io_channel_iter *i)
|
||||||
|
{
|
||||||
|
struct spdk_io_channel *_ch = spdk_io_channel_iter_get_channel(i);
|
||||||
|
struct spdk_bdev_mgmt_channel *ch = spdk_io_channel_get_ctx(_ch);
|
||||||
|
|
||||||
|
spdk_bdev_mgmt_channel_free_resources(ch);
|
||||||
|
spdk_for_each_channel_continue(i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_bdev_module_finish_iter(void *arg)
|
spdk_bdev_module_finish_iter(void *arg)
|
||||||
{
|
{
|
||||||
@ -615,7 +631,8 @@ spdk_bdev_module_finish_iter(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
resume_bdev_module = NULL;
|
resume_bdev_module = NULL;
|
||||||
spdk_bdev_module_finish_complete();
|
spdk_for_each_channel(&g_bdev_mgr, mgmt_channel_free_resources, NULL,
|
||||||
|
spdk_bdev_module_finish_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user