From 4de67bbf6d2240107ca7e03520df87dde3dfb2fe Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Mon, 24 Jun 2019 12:30:54 +0200 Subject: [PATCH] vhost: inline spdk_vhost_event_async_send_foreach_continue Despite its name, this function is defined as static and is only used in one place, so inline it. Change-Id: I4e217b3baae9b735761f5497f06b681a118860e9 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459162 Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- lib/vhost/vhost.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 382709dccf..ad67eb9262 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -1020,30 +1020,6 @@ spdk_vhost_session_send_event(struct vhost_poll_group *pg, return g_dpdk_response; } -static int -spdk_vhost_event_async_send_foreach_continue(struct spdk_vhost_session *vsession, - spdk_vhost_session_fn cb_fn, void *arg) -{ - struct spdk_vhost_dev *vdev = vsession->vdev; - struct spdk_vhost_session_fn_ctx *ev_ctx; - - ev_ctx = calloc(1, sizeof(*ev_ctx)); - if (ev_ctx == NULL) { - SPDK_ERRLOG("Failed to alloc vhost event.\n"); - assert(false); - return -ENOMEM; - } - - ev_ctx->vdev = vdev; - ev_ctx->vsession_id = vsession->id; - ev_ctx->cb_fn = cb_fn; - ev_ctx->user_ctx = arg; - - spdk_thread_send_msg(vsession->poll_group->thread, - spdk_vhost_event_async_foreach_fn, ev_ctx); - return 0; -} - static void _stop_session(struct spdk_vhost_session *vsession) { @@ -1362,6 +1338,7 @@ spdk_vhost_external_event_foreach_continue(struct spdk_vhost_dev *vdev, struct spdk_vhost_session *vsession, spdk_vhost_session_fn fn, void *arg) { + struct spdk_vhost_session_fn_ctx *ev_ctx; int rc; if (vsession == NULL) { @@ -1382,7 +1359,20 @@ spdk_vhost_external_event_foreach_continue(struct spdk_vhost_dev *vdev, } } - spdk_vhost_event_async_send_foreach_continue(vsession, fn, arg); + ev_ctx = calloc(1, sizeof(*ev_ctx)); + if (ev_ctx == NULL) { + SPDK_ERRLOG("Failed to alloc vhost event.\n"); + assert(false); + return; + } + + ev_ctx->vdev = vdev; + ev_ctx->vsession_id = vsession->id; + ev_ctx->cb_fn = fn; + ev_ctx->user_ctx = arg; + + spdk_thread_send_msg(vsession->poll_group->thread, + spdk_vhost_event_async_foreach_fn, ev_ctx); return; out_finish_foreach: