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 <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15189
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2022-11-01 10:54:00 +08:00 committed by Jim Harris
parent e753aa807f
commit 73f06e0d57
2 changed files with 1 additions and 12 deletions

View File

@ -936,7 +936,7 @@ new_connection(int vid)
} }
/* We expect sessions inside user_dev->vsessions to be sorted in ascending /* 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. * and append each session to the very end of the vsessions list.
* This is required for vhost_user_dev_foreach_session() to work. * 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); rc = backend->start_session(vdev, vsession, NULL);
if (rc == 0) { if (rc == 0) {
vsession->started = true; vsession->started = true;
assert(user_dev->active_session_num < UINT32_MAX);
user_dev->active_session_num++;
} }
pthread_mutex_unlock(&user_dev->lock); pthread_mutex_unlock(&user_dev->lock);
} }
@ -1286,13 +1283,8 @@ vhost_session_cb_done(int rc)
void void
vhost_user_session_stop_done(struct spdk_vhost_session *vsession, int response) 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) { if (response == 0) {
vsession->started = false; vsession->started = false;
assert(user_dev->active_session_num > 0);
user_dev->active_session_num--;
} }
vhost_session_cb_done(response); vhost_session_cb_done(response);

View File

@ -165,9 +165,6 @@ struct spdk_vhost_user_dev {
/* Increment-only session counter */ /* Increment-only session counter */
uint64_t vsessions_num; uint64_t vsessions_num;
/* Number of started and actively polled sessions */
uint32_t active_session_num;
/* Number of pending asynchronous operations */ /* Number of pending asynchronous operations */
uint32_t pending_async_op_num; uint32_t pending_async_op_num;
}; };