Commit 73f06e0d authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

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: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15189


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent e753aa80
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -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);
+0 −3
Original line number Diff line number Diff line
@@ -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;
};