Skip to content

Commit

Permalink
vhost-net: minor cleanup
Browse files Browse the repository at this point in the history
Delete a label and goto from vhost_net_set_backend
Inverting a test allows a label and goto to be eliminated.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Jeff Dike authored and Michael S. Tsirkin committed May 27, 2010
1 parent 373a83a commit dd1f407
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)

/* start polling new socket */
oldsock = vq->private_data;
if (sock == oldsock)
goto done;
if (sock != oldsock){
vhost_net_disable_vq(n, vq);
rcu_assign_pointer(vq->private_data, sock);
vhost_net_enable_vq(n, vq);
}

vhost_net_disable_vq(n, vq);
rcu_assign_pointer(vq->private_data, sock);
vhost_net_enable_vq(n, vq);
done:
if (oldsock) {
vhost_net_flush_vq(n, index);
fput(oldsock->file);
Expand Down

0 comments on commit dd1f407

Please sign in to comment.