From patchwork Tue Feb 21 15:43:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 142311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DEF89B6EF3 for ; Wed, 22 Feb 2012 02:45:11 +1100 (EST) Received: from localhost ([::1]:44026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rzrtn-00010o-L5 for incoming@patchwork.ozlabs.org; Tue, 21 Feb 2012 10:45:03 -0500 Received: from eggs.gnu.org ([140.186.70.92]:51628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rzrtd-00010h-Ic for qemu-devel@nongnu.org; Tue, 21 Feb 2012 10:44:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RzrtX-0002kP-GE for qemu-devel@nongnu.org; Tue, 21 Feb 2012 10:44:53 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:57487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzrtX-0002kK-5p for qemu-devel@nongnu.org; Tue, 21 Feb 2012 10:44:47 -0500 Received: by pbbro12 with SMTP id ro12so9200820pbb.4 for ; Tue, 21 Feb 2012 07:44:45 -0800 (PST) Received-SPF: pass (google.com: domain of paolo.bonzini@gmail.com designates 10.68.220.168 as permitted sender) client-ip=10.68.220.168; Authentication-Results: mr.google.com; spf=pass (google.com: domain of paolo.bonzini@gmail.com designates 10.68.220.168 as permitted sender) smtp.mail=paolo.bonzini@gmail.com; dkim=pass header.i=paolo.bonzini@gmail.com Received: from mr.google.com ([10.68.220.168]) by 10.68.220.168 with SMTP id px8mr24580162pbc.123.1329839085960 (num_hops = 1); Tue, 21 Feb 2012 07:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=dAuOpYMMhMNl1MvYRXdJ54AEaGnpuDgM10cb7YS2LUw=; b=S3LIpGPxrEVkY62W3Z5KyNvUsC3CDBOjOcAg0I5JJ2jGqqHPZEWb2hawNZpjO4KLn8 UF26JMUx6sFPD5nJh+jADWCk6L+24IVp1H2EhfKhZx8aKJkdoUbP7zFifWq/Cq8AtFk2 VnQzmLbUWYf/9vX2xqFgjKI3RT4VeDeEVfjmE= Received: by 10.68.220.168 with SMTP id px8mr20273348pbc.123.1329839085917; Tue, 21 Feb 2012 07:44:45 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-182-16.ip50.fastwebnet.it. [93.34.182.16]) by mx.google.com with ESMTPS id 3sm16335703pbx.66.2012.02.21.07.44.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Feb 2012 07:44:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 21 Feb 2012 16:43:52 +0100 Message-Id: <1329839032-31221-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.7.6 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH] block: drop aio_multiwrite in BlockDriver 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 These were never used. Signed-off-by: Paolo Bonzini --- block.c | 23 ++------------------- block_int.h | 6 ------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/block.c b/block.c index ae297bb..b395f7b 100644 --- a/block.c +++ b/block.c @@ -2767,7 +2793,6 @@ typedef struct MultiwriteCB { BlockDriverCompletionFunc *cb; void *opaque; QEMUIOVector *free_qiov; - void *free_buf; } callbacks[]; } MultiwriteCB; @@ -2781,7 +2806,6 @@ static void multiwrite_user_cb(MultiwriteCB *mcb) qemu_iovec_destroy(mcb->callbacks[i].free_qiov); } g_free(mcb->callbacks[i].free_qiov); - qemu_vfree(mcb->callbacks[i].free_buf); } } @@ -2838,20 +2862,11 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, int merge = 0; int64_t oldreq_last = reqs[outidx].sector + reqs[outidx].nb_sectors; - // This handles the cases that are valid for all block drivers, namely - // exactly sequential writes and overlapping writes. + // Handle exactly sequential writes and overlapping writes. if (reqs[i].sector <= oldreq_last) { merge = 1; } - // The block driver may decide that it makes sense to combine requests - // even if there is a gap of some sectors between them. In this case, - // the gap is filled with zeros (therefore only applicable for yet - // unused space in format like qcow2). - if (!merge && bs->drv->bdrv_merge_requests) { - merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]); - } - if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) { merge = 0; } @@ -2868,14 +2883,8 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, size = (reqs[i].sector - reqs[outidx].sector) << 9; qemu_iovec_concat(qiov, reqs[outidx].qiov, size); - // We might need to add some zeros between the two requests - if (reqs[i].sector > oldreq_last) { - size_t zero_bytes = (reqs[i].sector - oldreq_last) << 9; - uint8_t *buf = qemu_blockalign(bs, zero_bytes); - memset(buf, 0, zero_bytes); - qemu_iovec_add(qiov, buf, zero_bytes); - mcb->callbacks[i].free_buf = buf; - } + // We should need to add any zeros between the two requests + assert (reqs[i].sector <= oldreq_last); // Add the second request qemu_iovec_concat(qiov, reqs[i].qiov, reqs[i].qiov->size); diff --git a/block_int.h b/block_int.h index 7946cf6..3eeca58 100644 --- a/block_int.h +++ b/block_int.h @@ -162,12 +162,6 @@ struct BlockDriver { */ int coroutine_fn (*bdrv_co_flush_to_os)(BlockDriverState *bs); - int (*bdrv_aio_multiwrite)(BlockDriverState *bs, BlockRequest *reqs, - int num_reqs); - int (*bdrv_merge_requests)(BlockDriverState *bs, BlockRequest* a, - BlockRequest *b); - - const char *protocol_name; int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset); int64_t (*bdrv_getlength)(BlockDriverState *bs);