Commit 869d66af authored by Stefan Hajnoczi's avatar Stefan Hajnoczi Committed by Kevin Wolf
Browse files

virtio-blk: avoid g_slice_new0() for VirtIOBlockReq and VirtQueueElement



In commit de6c8042 ("virtio-blk: Avoid
zeroing every request structure") we avoided the 40 KB memset when
allocating VirtIOBlockReq.

The memset was reintroduced in commit
671ec3f0 ("virtio-blk: Convert
VirtIOBlockReq.elem to pointer").

It must be fixed again to avoid a performance regression.

Cc: Fam Zheng <famz@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent abd76425
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -31,9 +31,11 @@

static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s)
{
    VirtIOBlockReq *req = g_slice_new0(VirtIOBlockReq);
    VirtIOBlockReq *req = g_slice_new(VirtIOBlockReq);
    req->dev = s;
    req->elem = g_slice_new0(VirtQueueElement);
    req->qiov.size = 0;
    req->next = NULL;
    req->elem = g_slice_new(VirtQueueElement);
    return req;
}