[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCHv4 09/12] vhost: vhost net support
From: |
Amit Shah |
Subject: |
[Qemu-devel] Re: [PATCHv4 09/12] vhost: vhost net support |
Date: |
Wed, 17 Mar 2010 09:39:52 +0530 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On (Tue) Mar 16 2010 [17:37:39], Michael S. Tsirkin wrote:
> On Mon, Mar 08, 2010 at 11:50:23AM +0530, Amit Shah wrote:
> > On (Sat) Mar 06 2010 [21:06:35], Michael S. Tsirkin wrote:
> > >
> > > > > + r = vhost_virtqueue_set_addr(dev, vq, idx, dev->log_enabled);
> > > > > + if (r < 0) {
> > > > > + r = -errno;
> > > > > + goto fail_alloc;
> > > > > + }
> > > > > + if (!vdev->binding->guest_notifier ||
> > > > > !vdev->binding->host_notifier) {
> > > > > + fprintf(stderr, "binding does not support irqfd/queuefd\n");
> > > > > + r = -ENOSYS;
> > > > > + goto fail_alloc;
> > > > > + }
> > > >
> > > > This could be checked much earlier on in the function; so that we avoid
> > > > doing all that stuff above and the cleanup.
> > >
> > > Whatever order we put checks in, we'll have to undo stuff
> > > done beforehand on error.
> >
> > Not if you do this check before any ioctls or allocations.
> > !vdev->binding->guest_notifier is not dependent on anything you do above
> > it in this function, so just checking for this first thing in the
> > function will not need any cleanup.
>
> Yes, but I think it's clearer to do check function just before
> calling it. No?
The good thing about doing it before is that we can check for whatever
conditions are not met first and exit instead of doing N things and
undoing them later and then exiting -- faster and more efficient in the
case when vhost is not being used.
Amit
--
http://log.amitshah.net/
- Re: [Qemu-devel] [PATCHv4 07/12] virtio: move typedef to qemu-common, (continued)
[Qemu-devel] [PATCHv4 08/12] virtio-pci: fill in notifier support, Michael S. Tsirkin, 2010/03/03
[Qemu-devel] [PATCHv4 09/12] vhost: vhost net support, Michael S. Tsirkin, 2010/03/03
[Qemu-devel] [PATCHv4 10/12] tap: add vhost/vhostfd options, Michael S. Tsirkin, 2010/03/03
[Qemu-devel] [PATCHv4 11/12] tap: add API to retrieve vhost net header, Michael S. Tsirkin, 2010/03/03
[Qemu-devel] [PATCHv4 12/12] virtio-net: vhost net support, Michael S. Tsirkin, 2010/03/03