From patchwork Wed Nov 24 13:08:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 72878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 422FBB7043 for ; Thu, 25 Nov 2010 00:08:51 +1100 (EST) Received: from localhost ([127.0.0.1]:53582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLF5c-0006y2-5p for incoming@patchwork.ozlabs.org; Wed, 24 Nov 2010 08:08:48 -0500 Received: from [140.186.70.92] (port=46335 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLF4z-0006xp-6R for qemu-devel@nongnu.org; Wed, 24 Nov 2010 08:08:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLF4u-0005f6-7U for qemu-devel@nongnu.org; Wed, 24 Nov 2010 08:08:08 -0500 Received: from smtp.eu.citrix.com ([62.200.22.115]:60703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLF4u-0005eK-38 for qemu-devel@nongnu.org; Wed, 24 Nov 2010 08:08:04 -0500 X-IronPort-AV: E=Sophos;i="4.59,248,1288569600"; d="scan'208";a="3024273" Received: from lonpmailmx01.citrite.net ([10.30.224.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP/TLS/RC4-MD5; 24 Nov 2010 13:08:00 +0000 Received: from kaball.uk.xensource.com (10.80.2.59) by smtprelay.citrix.com (10.30.224.162) with Microsoft SMTP Server id 8.2.254.0; Wed, 24 Nov 2010 13:08:00 +0000 Date: Wed, 24 Nov 2010 13:08:03 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball-desktop To: xen-devel@lists.xensource.com Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] qemu and qemu-xen: support empty write barriers in xen_disk X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi all, this patch can be applied to both qemu-xen and qemu and adds support for empty write barriers to xen_disk. Signed-off-by: Stefano Stabellini Acked-by: Gerd Hoffmann diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 38b5fbf..94af001 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -182,6 +182,10 @@ static int ioreq_parse(struct ioreq *ioreq) ioreq->prot = PROT_WRITE; /* to memory */ break; case BLKIF_OP_WRITE_BARRIER: + if (!ioreq->req.nr_segments) { + ioreq->presync = 1; + return 0; + } if (!syncwrite) ioreq->presync = ioreq->postsync = 1; /* fall through */ @@ -306,7 +310,7 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq) int i, rc, len = 0; off_t pos; - if (ioreq_map(ioreq) == -1) + if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) goto err; if (ioreq->presync) bdrv_flush(blkdev->bs); @@ -330,6 +334,8 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq) break; case BLKIF_OP_WRITE: case BLKIF_OP_WRITE_BARRIER: + if (!ioreq->req.nr_segments) + break; pos = ioreq->start; for (i = 0; i < ioreq->v.niov; i++) { rc = bdrv_write(blkdev->bs, pos / BLOCK_SIZE, @@ -387,7 +393,7 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; - if (ioreq_map(ioreq) == -1) + if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) goto err; ioreq->aio_inflight++; @@ -404,6 +410,8 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq) case BLKIF_OP_WRITE: case BLKIF_OP_WRITE_BARRIER: ioreq->aio_inflight++; + if (!ioreq->req.nr_segments) + break; bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE, qemu_aio_complete, ioreq);