From 73f06e0d577bc73b08fe950a2be3a0d11c8d38c9 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Tue, 1 Nov 2022 10:54:00 +0800 Subject: [PATCH] lib/vhost: remove `active_session_num` for vhost-user device For vhost-user device, the variable `active_session_num` is used to count number of sessions of a vhost-user device, we don't use it anywhere, and the assertion of this variable is already guaranteed by `vsessions_num`, so just remove it. Change-Id: I335a75d17583b3744a41152b35cd5a1a8762a687 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15189 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- lib/vhost/rte_vhost_user.c | 10 +--------- lib/vhost/vhost_internal.h | 3 --- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/vhost/rte_vhost_user.c b/lib/vhost/rte_vhost_user.c index dfda9a022..1d3cef764 100644 --- a/lib/vhost/rte_vhost_user.c +++ b/lib/vhost/rte_vhost_user.c @@ -936,7 +936,7 @@ new_connection(int vid) } /* We expect sessions inside user_dev->vsessions to be sorted in ascending - * order in regard of vsession->id. For now we always set id = vsessions_cnt++ + * order in regard of vsession->id. For now we always set id = vsessions_num++ * and append each session to the very end of the vsessions list. * This is required for vhost_user_dev_foreach_session() to work. */ @@ -989,9 +989,6 @@ vhost_user_session_start(void *arg1) rc = backend->start_session(vdev, vsession, NULL); if (rc == 0) { vsession->started = true; - - assert(user_dev->active_session_num < UINT32_MAX); - user_dev->active_session_num++; } pthread_mutex_unlock(&user_dev->lock); } @@ -1286,13 +1283,8 @@ vhost_session_cb_done(int rc) void vhost_user_session_stop_done(struct spdk_vhost_session *vsession, int response) { - struct spdk_vhost_user_dev *user_dev = to_user_dev(vsession->vdev); - if (response == 0) { vsession->started = false; - - assert(user_dev->active_session_num > 0); - user_dev->active_session_num--; } vhost_session_cb_done(response); diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index 024b1b072..3a0af9f5c 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -165,9 +165,6 @@ struct spdk_vhost_user_dev { /* Increment-only session counter */ uint64_t vsessions_num; - /* Number of started and actively polled sessions */ - uint32_t active_session_num; - /* Number of pending asynchronous operations */ uint32_t pending_async_op_num; };