Received: from [140.186.70.92] (port=55367 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ov8NB-0000Hu-2W for qemu-devel@nongnu.org; Mon, 13 Sep 2010 08:43:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ov8N9-0004NA-V9 for qemu-devel@nongnu.org; Mon, 13 Sep 2010 08:43:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36419) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov8N9-0004N5-NO for qemu-devel@nongnu.org; Mon, 13 Sep 2010 08:42:59 -0400 From: Kevin Wolf Date: Mon, 13 Sep 2010 14:42:51 +0200 Message-Id: <1284381771-7333-14-git-send-email-kwolf@redhat.com> In-Reply-To: <1284381771-7333-1-git-send-email-kwolf@redhat.com> References: <1284381771-7333-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [STABLE 0.13][PATCH 13/13] vvfat: Use cache=unsafe List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Kevin Wolf The qcow file used for write support in vvfat is a temporary file, so we can use cache=unsafe there. Without this, write support is just too slow to be of any use. Signed-off-by: Kevin Wolf (cherry picked from commit 35ccd8aed64727dbefa1b274a8000b46318bfea1) --- block/vvfat.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index 0772037..53e57bf 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2788,6 +2788,7 @@ static int enable_write_target(BDRVVVFATState *s) { BlockDriver *bdrv_qcow; QEMUOptionParameter *options; + int ret; int size = sector2cluster(s, s->sector_count); s->used_clusters = calloc(size, 1); @@ -2803,11 +2804,16 @@ static int enable_write_target(BDRVVVFATState *s) if (bdrv_create(bdrv_qcow, s->qcow_filename, options) < 0) return -1; + s->qcow = bdrv_new(""); - if (s->qcow == NULL || - bdrv_open(s->qcow, s->qcow_filename, BDRV_O_RDWR, bdrv_qcow) < 0) - { - return -1; + if (s->qcow == NULL) { + return -1; + } + + ret = bdrv_open(s->qcow, s->qcow_filename, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, bdrv_qcow); + if (ret < 0) { + return ret; } #ifndef _WIN32 -- 1.7.2.2