From patchwork Tue Dec 9 16:26:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 419176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 64B7C1400D5 for ; Wed, 10 Dec 2014 03:29:08 +1100 (AEDT) Received: from localhost ([::1]:41261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyNer-00020o-JJ for incoming@patchwork.ozlabs.org; Tue, 09 Dec 2014 11:29:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyNeK-0001Mc-Mg for qemu-devel@nongnu.org; Tue, 09 Dec 2014 11:28:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyNeD-0006je-Hr for qemu-devel@nongnu.org; Tue, 09 Dec 2014 11:28:32 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:55025 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyNeD-0006jE-8O for qemu-devel@nongnu.org; Tue, 09 Dec 2014 11:28:25 -0500 Received: (qmail 3695 invoked by uid 89); 9 Dec 2014 16:28:23 -0000 Received: from [82.141.1.145] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.98.5/19753. hbedv: 8.3.26.32/7.11.193.198. spamassassin: 3.4.0. Clear:RC:1(82.141.1.145):SA:0(-1.2/5.0):. Processed in 1.318059 secs); 09 Dec 2014 16:28:23 -0000 Received: from ns.kamp-intra.net (HELO dns.kamp-intra.net) ([82.141.1.145]) by mx01.kamp.de with SMTP; 9 Dec 2014 16:28:21 -0000 X-GL_Whitelist: yes Received: from lieven-pc.kamp-intra.net (lieven-pc.kamp-intra.net [172.21.12.60]) by dns.kamp-intra.net (Postfix) with ESMTP id 074992068F; Tue, 9 Dec 2014 17:26:51 +0100 (CET) Received: by lieven-pc.kamp-intra.net (Postfix, from userid 1000) id EEBDC61625; Tue, 9 Dec 2014 17:26:50 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org Date: Tue, 9 Dec 2014 17:26:48 +0100 Message-Id: <1418142410-19057-3-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1418142410-19057-1-git-send-email-pl@kamp.de> References: <1418142410-19057-1-git-send-email-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a02:248:0:51::16 Cc: kwolf@redhat.com, famz@redhat.com, benoit@irqsave.net, ming.lei@canonical.com, Peter Lieven , armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 2/4] hw/virtio-blk: add a constant for max number of merged requests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org As it was not obvious (at least for me) where the 32 comes from; add a constant for it. Signed-off-by: Peter Lieven Reviewed-by: Eric Blake Reviewed-by: Fam Zheng --- hw/block/virtio-blk.c | 2 +- include/hw/virtio/virtio-blk.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index b19b102..490f961 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -326,7 +326,7 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) block_acct_start(blk_get_stats(req->dev->blk), &req->acct, req->qiov.size, BLOCK_ACCT_WRITE); - if (mrb->num_writes == 32) { + if (mrb->num_writes == VIRTIO_BLK_MAX_MERGE_REQS) { virtio_submit_multiwrite(req->dev->blk, mrb); } diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index 3979dc4..3f2652f 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -134,8 +134,10 @@ typedef struct VirtIOBlock { struct VirtIOBlockDataPlane *dataplane; } VirtIOBlock; +#define VIRTIO_BLK_MAX_MERGE_REQS 32 + typedef struct MultiReqBuffer { - BlockRequest blkreq[32]; + BlockRequest blkreq[VIRTIO_BLK_MAX_MERGE_REQS]; unsigned int num_writes; } MultiReqBuffer;