[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] virtio-blk: use aio handler for data plane
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] virtio-blk: use aio handler for data plane |
Date: |
Tue, 29 Mar 2016 16:44:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 29/03/2016 16:09, Michael S. Tsirkin wrote:
>> > Another small comment, this can be written simply as
>> >
>> > if (s->dataplane) {
>> > virtio_blk_data_plane_start(s->dataplane);
>
> True, it's best not to poke at dataplane_started.
>
> > } else {
> > virtio_blk_handle_vq(s, vq);
> > }
> >
>
> 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 = 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 = 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
Re: [Qemu-devel] [PATCH 0/2] dataplane: fix start/stop races, Michael S. Tsirkin, 2016/03/29
Re: [Qemu-devel] [PATCH 0/2] dataplane: fix start/stop races, Cornelia Huck, 2016/03/29
Re: [Qemu-devel] [PATCH 0/2] dataplane: fix start/stop races, Christian Borntraeger, 2016/03/29