Commit d4f7bf9c authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

vhost: remove redundant vdev == NULL checks in foreach_session()



Historically the callbacks from vhost_dev_foreach_session()
could be called with vdev argument == NULL, which would
mean that device was removed after enqueuing the event
and before consuming it. Now we keep track of pending
asynchronous operations on each vhost device and don't
allow removing it if there are any unconsumed events,
so the the vdev == NULL checks are redundant. Remove them.

Change-Id: I7aa3785080d20ed06e008c081d3f37a949228f5a
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466729


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 0cf5d516
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ static int
vhost_session_set_coalescing(struct spdk_vhost_dev *vdev,
			     struct spdk_vhost_session *vsession, void *ctx)
{
	if (vdev == NULL || vsession == NULL) {
	if (vsession == NULL) {
		/* nothing to do */
		return 0;
	}
+0 −5
Original line number Diff line number Diff line
@@ -563,11 +563,6 @@ vhost_session_bdev_remove_cb(struct spdk_vhost_dev *vdev,
{
	struct spdk_vhost_blk_session *bvsession;

	if (vdev == NULL) {
		/* Nothing to do */
		return 0;
	}

	if (vsession == NULL) {
		/* All sessions have been notified, time to close the bdev */
		struct spdk_vhost_blk_dev *bvdev = to_blk_dev(vdev);
+1 −3
Original line number Diff line number Diff line
@@ -193,9 +193,7 @@ struct spdk_vhost_dev {
/**
 * Synchronized vhost session event used for backend callbacks.
 *
 * \param vdev vhost device. If the device has been deleted
 * in the meantime, this function will be called one last
 * time with vdev == NULL.
 * \param vdev vhost device.
 * \param vsession vhost session. If all sessions have been
 * iterated through, this function will be called one last
 * time with vsession == NULL.