* [PATCH] vhost-net: defer f->private_data until setup succeeds
@ 2009-12-22 19:02 Chris Wright
2009-12-24 6:06 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wright @ 2009-12-22 19:02 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: rusty, kvm, virtualization
Trivial change, just for readability. The filp is not installed on
failure, so the current code is not incorrect (also vhost_dev_init
currently has no failure case). This just treats setting f->private_data
as something with global scope (sure, true only after fd_install).
Signed-off-by: Chris Wright <chrisw@redhat.com>
---
drivers/vhost/net.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 22d5fef..0697ab2 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -326,7 +326,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
int r;
if (!n)
return -ENOMEM;
- f->private_data = n;
n->vqs[VHOST_NET_VQ_TX].handle_kick = handle_tx_kick;
n->vqs[VHOST_NET_VQ_RX].handle_kick = handle_rx_kick;
r = vhost_dev_init(&n->dev, n->vqs, VHOST_NET_VQ_MAX);
@@ -338,6 +337,9 @@ static int vhost_net_open(struct inode *inode, struct file *f)
vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT);
vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN);
n->tx_poll_state = VHOST_NET_POLL_DISABLED;
+
+ f->private_data = n;
+
return 0;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost-net: defer f->private_data until setup succeeds
2009-12-22 19:02 [PATCH] vhost-net: defer f->private_data until setup succeeds Chris Wright
@ 2009-12-24 6:06 ` Michael S. Tsirkin
2010-01-04 2:33 ` Rusty Russell
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2009-12-24 6:06 UTC (permalink / raw)
To: Chris Wright; +Cc: rusty, kvm, virtualization
On Tue, Dec 22, 2009 at 11:02:28AM -0800, Chris Wright wrote:
> Trivial change, just for readability. The filp is not installed on
> failure, so the current code is not incorrect (also vhost_dev_init
> currently has no failure case). This just treats setting f->private_data
> as something with global scope (sure, true only after fd_install).
>
> Signed-off-by: Chris Wright <chrisw@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/net.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 22d5fef..0697ab2 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -326,7 +326,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
> int r;
> if (!n)
> return -ENOMEM;
> - f->private_data = n;
> n->vqs[VHOST_NET_VQ_TX].handle_kick = handle_tx_kick;
> n->vqs[VHOST_NET_VQ_RX].handle_kick = handle_rx_kick;
> r = vhost_dev_init(&n->dev, n->vqs, VHOST_NET_VQ_MAX);
> @@ -338,6 +337,9 @@ static int vhost_net_open(struct inode *inode, struct file *f)
> vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT);
> vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN);
> n->tx_poll_state = VHOST_NET_POLL_DISABLED;
> +
> + f->private_data = n;
> +
> return 0;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost-net: defer f->private_data until setup succeeds
2009-12-24 6:06 ` Michael S. Tsirkin
@ 2010-01-04 2:33 ` Rusty Russell
0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2010-01-04 2:33 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Chris Wright, kvm, virtualization
On Thu, 24 Dec 2009 04:36:50 pm Michael S. Tsirkin wrote:
> On Tue, Dec 22, 2009 at 11:02:28AM -0800, Chris Wright wrote:
> > Trivial change, just for readability. The filp is not installed on
> > failure, so the current code is not incorrect (also vhost_dev_init
> > currently has no failure case). This just treats setting f->private_data
> > as something with global scope (sure, true only after fd_install).
> >
> > Signed-off-by: Chris Wright <chrisw@redhat.com>
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Thanks, applied.
Rusty.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-04 2:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-22 19:02 [PATCH] vhost-net: defer f->private_data until setup succeeds Chris Wright
2009-12-24 6:06 ` Michael S. Tsirkin
2010-01-04 2:33 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).