qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio-blk: Avoid zeroing every request struct


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Avoid zeroing every request structure
Date: Sun, 16 May 2010 16:01:19 +0100

On Sun, May 16, 2010 at 2:25 PM, Christoph Hellwig <address@hidden> wrote:
> On Fri, May 14, 2010 at 10:52:30PM +0100, Stefan Hajnoczi wrote:
>> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
>> index b05d15e..d270225 100644
>> --- a/hw/virtio-blk.c
>> +++ b/hw/virtio-blk.c
>> @@ -105,8 +105,10 @@ static void virtio_blk_flush_complete(void *opaque, int 
>> ret)
>>
>>  static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s)
>>  {
>> -    VirtIOBlockReq *req = qemu_mallocz(sizeof(*req));
>> +    VirtIOBlockReq *req = qemu_malloc(sizeof(*req));
>>      req->dev = s;
>> +    req->qiov.size = 0;
>> +    req->next = NULL;
>>      return req;
>
> Looks good, but you shouldn't even need to initialize req->qiov.size, we
> do this later by calling qemu_iovec_init_external before using it.

virtio_blk_req_complete() uses req->qiov.size and may be called by
virtio_blk_handle_flush() or virtio_blk_handle_scsi() without being
initialized.  It's a little ugly that we use the qiov like that.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]