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: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466729
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-07-20 23:19:57 +02:00 committed by Jim Harris
parent 0cf5d5160b
commit d4f7bf9cdd
3 changed files with 2 additions and 9 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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.