* [PATCH 2/2] vhost - cleanup
@ 2010-03-04 21:10 Jeff Dike
2010-03-07 12:08 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Dike @ 2010-03-04 21:10 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Xin Xiaohui, LKML
commit 1191aa42193d030470dbd4ab17e4fb57772534ff
Author: Jeff Dike <jdike@localhost.localdomain>
Date: Thu Mar 4 14:51:20 2010 -0500
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>
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 4ada4b4..7abb883 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -518,13 +518,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);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 2/2] vhost - cleanup
2010-03-04 21:10 [PATCH 2/2] vhost - cleanup Jeff Dike
@ 2010-03-07 12:08 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-03-07 12:08 UTC (permalink / raw)
To: Jeff Dike; +Cc: Xin Xiaohui, LKML
On Thu, Mar 04, 2010 at 04:10:14PM -0500, Jeff Dike wrote:
> commit 1191aa42193d030470dbd4ab17e4fb57772534ff
> Author: Jeff Dike <jdike@localhost.localdomain>
> Date: Thu Mar 4 14:51:20 2010 -0500
>
> 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>
Thanks!
I am in fixes-only mode for 2.6.34, will queue this for the next release.
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 4ada4b4..7abb883 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -518,13 +518,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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-07 12:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04 21:10 [PATCH 2/2] vhost - cleanup Jeff Dike
2010-03-07 12:08 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox