From 150a5898cb0cfb1d0bdcc49dbe4842e51adaba9f Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Tue, 10 Apr 2018 14:27:45 -0700 Subject: [PATCH] bdev: Reorder functions in the spdk_bdev_module_finish path This is code movement only. This minimizes an upcoming diff. Change-Id: If2af99fdd86ca3c8ce672b9d8f5bc44a2f30cc8e Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/407218 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- lib/bdev/bdev.c | 62 +++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 614e34e68..e3b977d9c 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -672,36 +672,7 @@ spdk_bdev_module_finish_cb(void *io_device) g_fini_cb_arg = NULL; } -static 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) { - SPDK_ERRLOG("bdev IO pool count is %zu but should be %u\n", - spdk_mempool_count(g_bdev_mgr.bdev_io_pool), - SPDK_BDEV_IO_POOL_SIZE); - } - - if (spdk_mempool_count(g_bdev_mgr.buf_small_pool) != BUF_SMALL_POOL_SIZE) { - SPDK_ERRLOG("Small buffer pool count is %zu but should be %u\n", - spdk_mempool_count(g_bdev_mgr.buf_small_pool), - BUF_SMALL_POOL_SIZE); - assert(false); - } - - if (spdk_mempool_count(g_bdev_mgr.buf_large_pool) != BUF_LARGE_POOL_SIZE) { - SPDK_ERRLOG("Large buffer pool count is %zu but should be %u\n", - spdk_mempool_count(g_bdev_mgr.buf_large_pool), - BUF_LARGE_POOL_SIZE); - assert(false); - } - - spdk_mempool_free(g_bdev_mgr.bdev_io_pool); - spdk_mempool_free(g_bdev_mgr.buf_small_pool); - spdk_mempool_free(g_bdev_mgr.buf_large_pool); - spdk_dma_free(g_bdev_mgr.zero_buffer); - - spdk_io_device_unregister(&g_bdev_mgr, spdk_bdev_module_finish_cb); -} +static void spdk_bdev_module_finish_complete(struct spdk_io_channel_iter *i, int status); static void mgmt_channel_free_resources(struct spdk_io_channel_iter *i) @@ -754,6 +725,37 @@ spdk_bdev_module_finish_iter(void *arg) spdk_bdev_module_finish_complete); } +static 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) { + SPDK_ERRLOG("bdev IO pool count is %zu but should be %u\n", + spdk_mempool_count(g_bdev_mgr.bdev_io_pool), + SPDK_BDEV_IO_POOL_SIZE); + } + + if (spdk_mempool_count(g_bdev_mgr.buf_small_pool) != BUF_SMALL_POOL_SIZE) { + SPDK_ERRLOG("Small buffer pool count is %zu but should be %u\n", + spdk_mempool_count(g_bdev_mgr.buf_small_pool), + BUF_SMALL_POOL_SIZE); + assert(false); + } + + if (spdk_mempool_count(g_bdev_mgr.buf_large_pool) != BUF_LARGE_POOL_SIZE) { + SPDK_ERRLOG("Large buffer pool count is %zu but should be %u\n", + spdk_mempool_count(g_bdev_mgr.buf_large_pool), + BUF_LARGE_POOL_SIZE); + assert(false); + } + + spdk_mempool_free(g_bdev_mgr.bdev_io_pool); + spdk_mempool_free(g_bdev_mgr.buf_small_pool); + spdk_mempool_free(g_bdev_mgr.buf_large_pool); + spdk_dma_free(g_bdev_mgr.zero_buffer); + + spdk_io_device_unregister(&g_bdev_mgr, spdk_bdev_module_finish_cb); +} + void spdk_bdev_module_finish_done(void) {