All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Chris Wright <chrisw@sous-sol.org>
Cc: rusty@rustcorp.com.au, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] vhost-net: defer f->private_data until setup succeeds
Date: Thu, 24 Dec 2009 08:06:50 +0200	[thread overview]
Message-ID: <20091224060650.GA26128@redhat.com> (raw)
In-Reply-To: <20091222190228.GB2095@sequoia.sous-sol.org>

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

  reply	other threads:[~2009-12-24  6:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-01-04  2:33   ` Rusty Russell
2010-01-04  2:33   ` Rusty Russell
2009-12-24  6:06 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2009-12-22 19:02 Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091224060650.GA26128@redhat.com \
    --to=mst@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.