subsystem: remove fini return code
Closing the framework has to go through all subsystems without failure, so return codes are unnecessary. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I53c9b4df12d2357e641130869f398b18637e6ff7 Reviewed-on: https://review.gerrithub.io/381681 Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
48b2eff97d
commit
b1ccfaca01
@ -127,7 +127,7 @@ typedef void (*spdk_bdev_poller_stop_cb)(struct spdk_bdev_poller **ppoller);
|
|||||||
void spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,
|
void spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,
|
||||||
spdk_bdev_poller_start_cb start_poller_fn,
|
spdk_bdev_poller_start_cb start_poller_fn,
|
||||||
spdk_bdev_poller_stop_cb stop_poller_fn);
|
spdk_bdev_poller_stop_cb stop_poller_fn);
|
||||||
int spdk_bdev_finish(void);
|
void spdk_bdev_finish(void);
|
||||||
void spdk_bdev_config_text(FILE *fp);
|
void spdk_bdev_config_text(FILE *fp);
|
||||||
|
|
||||||
struct spdk_bdev *spdk_bdev_get_by_name(const char *bdev_name);
|
struct spdk_bdev *spdk_bdev_get_by_name(const char *bdev_name);
|
||||||
|
@ -47,7 +47,7 @@ struct spdk_io_channel;
|
|||||||
struct spdk_copy_task;
|
struct spdk_copy_task;
|
||||||
|
|
||||||
int spdk_copy_engine_initialize(void);
|
int spdk_copy_engine_initialize(void);
|
||||||
int spdk_copy_engine_finish(void);
|
void spdk_copy_engine_finish(void);
|
||||||
|
|
||||||
struct spdk_io_channel *spdk_copy_engine_get_io_channel(void);
|
struct spdk_io_channel *spdk_copy_engine_get_io_channel(void);
|
||||||
int spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, void *dst,
|
int spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, void *dst,
|
||||||
|
@ -45,12 +45,12 @@
|
|||||||
#define IDLE_INTERVAL_TIME_IN_US 5000
|
#define IDLE_INTERVAL_TIME_IN_US 5000
|
||||||
|
|
||||||
int spdk_interface_init(void);
|
int spdk_interface_init(void);
|
||||||
int spdk_interface_destroy(void);
|
void spdk_interface_destroy(void);
|
||||||
|
|
||||||
const char *spdk_net_framework_get_name(void);
|
const char *spdk_net_framework_get_name(void);
|
||||||
int spdk_net_framework_start(void);
|
int spdk_net_framework_start(void);
|
||||||
void spdk_net_framework_clear_socket_association(int sock);
|
void spdk_net_framework_clear_socket_association(int sock);
|
||||||
int spdk_net_framework_fini(void);
|
void spdk_net_framework_fini(void);
|
||||||
int spdk_net_framework_idle_time(void);
|
int spdk_net_framework_idle_time(void);
|
||||||
|
|
||||||
#define SPDK_IFNAMSIZE 32
|
#define SPDK_IFNAMSIZE 32
|
||||||
|
@ -164,7 +164,7 @@ struct spdk_scsi_lun;
|
|||||||
|
|
||||||
int spdk_scsi_init(void);
|
int spdk_scsi_init(void);
|
||||||
|
|
||||||
int spdk_scsi_fini(void);
|
void spdk_scsi_fini(void);
|
||||||
|
|
||||||
int spdk_scsi_lun_get_id(const struct spdk_scsi_lun *lun);
|
int spdk_scsi_lun_get_id(const struct spdk_scsi_lun *lun);
|
||||||
const char *spdk_scsi_lun_get_name(const struct spdk_scsi_lun *lun);
|
const char *spdk_scsi_lun_get_name(const struct spdk_scsi_lun *lun);
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "spdk/event.h"
|
#include "spdk/event.h"
|
||||||
|
|
||||||
int spdk_vhost_init(void);
|
int spdk_vhost_init(void);
|
||||||
int spdk_vhost_fini(void);
|
void spdk_vhost_fini(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init vhost application. This is called once by SPDK app layer.
|
* Init vhost application. This is called once by SPDK app layer.
|
||||||
|
@ -55,7 +55,7 @@ struct spdk_subsystem {
|
|||||||
const char *name;
|
const char *name;
|
||||||
/* User must call spdk_subsystem_init_next() when they are done with their initialization. */
|
/* User must call spdk_subsystem_init_next() when they are done with their initialization. */
|
||||||
void (*init)(void);
|
void (*init)(void);
|
||||||
int (*fini)(void);
|
void (*fini)(void);
|
||||||
void (*config)(FILE *fp);
|
void (*config)(FILE *fp);
|
||||||
TAILQ_ENTRY(spdk_subsystem) tailq;
|
TAILQ_ENTRY(spdk_subsystem) tailq;
|
||||||
};
|
};
|
||||||
@ -71,7 +71,7 @@ void spdk_add_subsystem(struct spdk_subsystem *subsystem);
|
|||||||
void spdk_add_subsystem_depend(struct spdk_subsystem_depend *depend);
|
void spdk_add_subsystem_depend(struct spdk_subsystem_depend *depend);
|
||||||
|
|
||||||
void spdk_subsystem_init(void *arg1, void *arg2);
|
void spdk_subsystem_init(void *arg1, void *arg2);
|
||||||
int spdk_subsystem_fini(void);
|
void spdk_subsystem_fini(void);
|
||||||
void spdk_subsystem_init_next(int rc);
|
void spdk_subsystem_init_next(int rc);
|
||||||
void spdk_subsystem_config(FILE *fp);
|
void spdk_subsystem_config(FILE *fp);
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,
|
|||||||
spdk_bdev_module_action_complete();
|
spdk_bdev_module_action_complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_bdev_finish(void)
|
spdk_bdev_finish(void)
|
||||||
{
|
{
|
||||||
struct spdk_bdev_module_if *bdev_module;
|
struct spdk_bdev_module_if *bdev_module;
|
||||||
@ -582,8 +582,6 @@ spdk_bdev_finish(void)
|
|||||||
spdk_mempool_free(g_bdev_mgr.buf_large_pool);
|
spdk_mempool_free(g_bdev_mgr.buf_large_pool);
|
||||||
|
|
||||||
spdk_io_device_unregister(&g_bdev_mgr, NULL);
|
spdk_io_device_unregister(&g_bdev_mgr, NULL);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct spdk_bdev_io *
|
struct spdk_bdev_io *
|
||||||
|
@ -249,11 +249,10 @@ spdk_copy_engine_initialize(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_copy_engine_finish(void)
|
spdk_copy_engine_finish(void)
|
||||||
{
|
{
|
||||||
spdk_copy_engine_module_finish();
|
spdk_copy_engine_module_finish();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_COPY_MODULE_REGISTER(copy_engine_mem_init, NULL, NULL, copy_engine_mem_get_ctx_size)
|
SPDK_COPY_MODULE_REGISTER(copy_engine_mem_init, NULL, NULL, copy_engine_mem_get_ctx_size)
|
||||||
|
@ -165,24 +165,19 @@ spdk_subsystem_init(void *arg1, void *arg2)
|
|||||||
spdk_subsystem_init_next(0);
|
spdk_subsystem_init_next(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_subsystem_fini(void)
|
spdk_subsystem_fini(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
|
||||||
struct spdk_subsystem *cur;
|
struct spdk_subsystem *cur;
|
||||||
|
|
||||||
cur = TAILQ_LAST(&g_subsystems, spdk_subsystem_list);
|
cur = TAILQ_LAST(&g_subsystems, spdk_subsystem_list);
|
||||||
|
|
||||||
while (cur) {
|
while (cur) {
|
||||||
if (cur->fini) {
|
if (cur->fini) {
|
||||||
rc = cur->fini();
|
cur->fini();
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
cur = TAILQ_PREV(cur, spdk_subsystem_list, tailq);
|
cur = TAILQ_PREV(cur, spdk_subsystem_list, tailq);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -71,10 +71,10 @@ spdk_bdev_subsystem_initialize(void)
|
|||||||
spdk_bdev_subsystem_stop_poller);
|
spdk_bdev_subsystem_stop_poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_bdev_subsystem_finish(void)
|
spdk_bdev_subsystem_finish(void)
|
||||||
{
|
{
|
||||||
return spdk_bdev_finish();
|
spdk_bdev_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(bdev, spdk_bdev_subsystem_initialize,
|
SPDK_SUBSYSTEM_REGISTER(bdev, spdk_bdev_subsystem_initialize,
|
||||||
|
@ -47,10 +47,10 @@ spdk_copy_engine_subsystem_initialize(void)
|
|||||||
spdk_subsystem_init_next(rc);
|
spdk_subsystem_init_next(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_copy_engine_subsystem_finish(void)
|
spdk_copy_engine_subsystem_finish(void)
|
||||||
{
|
{
|
||||||
return spdk_copy_engine_finish();
|
spdk_copy_engine_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(copy, spdk_copy_engine_subsystem_initialize,
|
SPDK_SUBSYSTEM_REGISTER(copy, spdk_copy_engine_subsystem_initialize,
|
||||||
|
@ -47,10 +47,10 @@ spdk_iscsi_subsystem_init(void)
|
|||||||
spdk_subsystem_init_next(rc);
|
spdk_subsystem_init_next(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_iscsi_subsystem_fini(void)
|
spdk_iscsi_subsystem_fini(void)
|
||||||
{
|
{
|
||||||
return spdk_iscsi_fini();
|
spdk_iscsi_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(iscsi, spdk_iscsi_subsystem_init, spdk_iscsi_subsystem_fini,
|
SPDK_SUBSYSTEM_REGISTER(iscsi, spdk_iscsi_subsystem_init, spdk_iscsi_subsystem_fini,
|
||||||
|
@ -47,10 +47,10 @@ spdk_interface_subsystem_init(void)
|
|||||||
spdk_subsystem_init_next(rc);
|
spdk_subsystem_init_next(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_interface_subsystem_destroy(void)
|
spdk_interface_subsystem_destroy(void)
|
||||||
{
|
{
|
||||||
return spdk_interface_destroy();
|
spdk_interface_destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(interface, spdk_interface_subsystem_init,
|
SPDK_SUBSYSTEM_REGISTER(interface, spdk_interface_subsystem_init,
|
||||||
@ -66,10 +66,10 @@ spdk_net_subsystem_start(void)
|
|||||||
spdk_subsystem_init_next(rc);
|
spdk_subsystem_init_next(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_net_subsystem_fini(void)
|
spdk_net_subsystem_fini(void)
|
||||||
{
|
{
|
||||||
return spdk_net_framework_fini();
|
spdk_net_framework_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(net_framework, spdk_net_subsystem_start,
|
SPDK_SUBSYSTEM_REGISTER(net_framework, spdk_net_subsystem_start,
|
||||||
|
@ -127,13 +127,11 @@ spdk_rpc_subsystem_initialize(void)
|
|||||||
spdk_subsystem_init_next(0);
|
spdk_subsystem_init_next(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_rpc_subsystem_finish(void)
|
spdk_rpc_subsystem_finish(void)
|
||||||
{
|
{
|
||||||
spdk_rpc_close();
|
spdk_rpc_close();
|
||||||
spdk_poller_unregister(&g_rpc_poller, NULL);
|
spdk_poller_unregister(&g_rpc_poller, NULL);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -47,10 +47,10 @@ spdk_scsi_subsystem_init(void)
|
|||||||
spdk_subsystem_init_next(rc);
|
spdk_subsystem_init_next(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_scsi_subsystem_fini(void)
|
spdk_scsi_subsystem_fini(void)
|
||||||
{
|
{
|
||||||
return spdk_scsi_fini();
|
spdk_scsi_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(scsi, spdk_scsi_subsystem_init, spdk_scsi_subsystem_fini, NULL)
|
SPDK_SUBSYSTEM_REGISTER(scsi, spdk_scsi_subsystem_init, spdk_scsi_subsystem_fini, NULL)
|
||||||
|
@ -47,10 +47,10 @@ spdk_vhost_subsystem_init(void)
|
|||||||
spdk_subsystem_init_next(rc);
|
spdk_subsystem_init_next(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_vhost_subsystem_fini(void)
|
spdk_vhost_subsystem_fini(void)
|
||||||
{
|
{
|
||||||
return spdk_vhost_fini();
|
spdk_vhost_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(vhost, spdk_vhost_subsystem_init, spdk_vhost_subsystem_fini, NULL)
|
SPDK_SUBSYSTEM_REGISTER(vhost, spdk_vhost_subsystem_init, spdk_vhost_subsystem_fini, NULL)
|
||||||
|
@ -327,7 +327,7 @@ extern struct spdk_iscsi_globals g_spdk_iscsi;
|
|||||||
struct spdk_iscsi_task;
|
struct spdk_iscsi_task;
|
||||||
|
|
||||||
int spdk_iscsi_init(void);
|
int spdk_iscsi_init(void);
|
||||||
int spdk_iscsi_fini(void);
|
void spdk_iscsi_fini(void);
|
||||||
void spdk_iscsi_config_text(FILE *fp);
|
void spdk_iscsi_config_text(FILE *fp);
|
||||||
|
|
||||||
int spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn);
|
int spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn);
|
||||||
|
@ -452,35 +452,25 @@ static unsigned rte_mempool_avail_count(const struct rte_mempool *pool)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_iscsi_check_pool(struct rte_mempool *pool, uint32_t count)
|
spdk_iscsi_check_pool(struct rte_mempool *pool, uint32_t count)
|
||||||
{
|
{
|
||||||
if (rte_mempool_avail_count(pool) != count) {
|
if (rte_mempool_avail_count(pool) != count) {
|
||||||
SPDK_ERRLOG("rte_mempool_avail_count(%s) == %d, should be %d\n",
|
SPDK_ERRLOG("rte_mempool_avail_count(%s) == %d, should be %d\n",
|
||||||
pool->name, rte_mempool_avail_count(pool), count);
|
pool->name, rte_mempool_avail_count(pool), count);
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
spdk_iscsi_check_pools(void)
|
spdk_iscsi_check_pools(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
|
||||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||||
|
|
||||||
rc += spdk_iscsi_check_pool(iscsi->pdu_pool, PDU_POOL_SIZE(iscsi));
|
spdk_iscsi_check_pool(iscsi->pdu_pool, PDU_POOL_SIZE(iscsi));
|
||||||
rc += spdk_iscsi_check_pool(iscsi->session_pool, SESSION_POOL_SIZE(iscsi));
|
spdk_iscsi_check_pool(iscsi->session_pool, SESSION_POOL_SIZE(iscsi));
|
||||||
rc += spdk_iscsi_check_pool(iscsi->pdu_immediate_data_pool, IMMEDIATE_DATA_POOL_SIZE(iscsi));
|
spdk_iscsi_check_pool(iscsi->pdu_immediate_data_pool, IMMEDIATE_DATA_POOL_SIZE(iscsi));
|
||||||
rc += spdk_iscsi_check_pool(iscsi->pdu_data_out_pool, DATA_OUT_POOL_SIZE(iscsi));
|
spdk_iscsi_check_pool(iscsi->pdu_data_out_pool, DATA_OUT_POOL_SIZE(iscsi));
|
||||||
/* TODO: check the task_pool on exit */
|
/* TODO: check the task_pool on exit */
|
||||||
|
|
||||||
if (rc == 0) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -994,12 +984,10 @@ spdk_iscsi_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_iscsi_fini(void)
|
spdk_iscsi_fini(void)
|
||||||
{
|
{
|
||||||
int rc;
|
spdk_iscsi_check_pools();
|
||||||
|
|
||||||
rc = spdk_iscsi_check_pools();
|
|
||||||
spdk_iscsi_free_pools();
|
spdk_iscsi_free_pools();
|
||||||
|
|
||||||
spdk_iscsi_shutdown_tgt_nodes();
|
spdk_iscsi_shutdown_tgt_nodes();
|
||||||
@ -1009,8 +997,6 @@ spdk_iscsi_fini(void)
|
|||||||
free(g_spdk_iscsi.nodebase);
|
free(g_spdk_iscsi.nodebase);
|
||||||
|
|
||||||
pthread_mutex_destroy(&g_spdk_iscsi.mutex);
|
pthread_mutex_destroy(&g_spdk_iscsi.mutex);
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -426,7 +426,7 @@ spdk_interface_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_interface_destroy(void)
|
spdk_interface_destroy(void)
|
||||||
{
|
{
|
||||||
struct spdk_interface *ifc_entry;
|
struct spdk_interface *ifc_entry;
|
||||||
@ -436,7 +436,6 @@ spdk_interface_destroy(void)
|
|||||||
TAILQ_REMOVE(&g_interface_head, ifc_entry, tailq);
|
TAILQ_REMOVE(&g_interface_head, ifc_entry, tailq);
|
||||||
free(ifc_entry);
|
free(ifc_entry);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -471,10 +470,9 @@ spdk_interface_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_interface_destroy(void)
|
spdk_interface_destroy(void)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -46,9 +46,8 @@ int spdk_net_framework_start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
int spdk_net_framework_fini(void)
|
void spdk_net_framework_fini(void)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
|
@ -50,11 +50,10 @@ spdk_scsi_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_scsi_fini(void)
|
spdk_scsi_fini(void)
|
||||||
{
|
{
|
||||||
pthread_mutex_destroy(&g_spdk_scsi.mutex);
|
pthread_mutex_destroy(&g_spdk_scsi.mutex);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_TRACE_REGISTER_FN(scsi_trace)
|
SPDK_TRACE_REGISTER_FN(scsi_trace)
|
||||||
|
@ -1114,10 +1114,9 @@ spdk_vhost_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
spdk_vhost_fini(void)
|
spdk_vhost_fini(void)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user