From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akusu-0004Kt-Cg for qemu-devel@nongnu.org; Tue, 29 Mar 2016 10:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akust-0007Wy-Im for qemu-devel@nongnu.org; Tue, 29 Mar 2016 10:44:44 -0400 References: <1459258923-10319-1-git-send-email-mst@redhat.com> <1459258923-10319-3-git-send-email-mst@redhat.com> <56FA8BBA.2070402@redhat.com> <20160329170848-mutt-send-email-mst@redhat.com> From: Paolo Bonzini Message-ID: <56FA94D1.3070801@redhat.com> Date: Tue, 29 Mar 2016 16:44:33 +0200 MIME-Version: 1.0 In-Reply-To: <20160329170848-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-blk: use aio handler for data plane List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Cornelia Huck , Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org On 29/03/2016 16:09, Michael S. Tsirkin wrote: >> > Another small comment, this can be written simply as >> >=20 >> > if (s->dataplane) { >> > virtio_blk_data_plane_start(s->dataplane); >=20 > True, it's best not to poke at dataplane_started. >=20 > > } else { > > virtio_blk_handle_vq(s, vq); > > } > >=20 >=20 > I prefer the return style I think, to stress the > fact that this is an unusual, unexpected case. We're getting dangerously close to personal preference, but I've noticed virtio-scsi that you get a very common pattern of: void virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq) { ... virtqueue_pop ... } static void virtio_scsi_data_plane_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s =3D VIRTIO_SCSI(vdev); assert(dataplane active and started); virtio_scsi_handle_ctrl_vq(s, vq); } static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s =3D VIRTIO_SCSI(vdev); if (dataplane active) { virtio_scsi_dataplane_start(s); } else { virtio_scsi_handle_ctrl_vq(s, vq); } } so it's not really an unusual, unexpected case but a complete separation between the dataplane case (handle_output starts dataplane) and the non-dataplane case (handle_output just does a cast and calls the actual workhorse). Paolo