From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCD3h-0000eb-Uz for qemu-devel@nongnu.org; Thu, 13 Sep 2012 13:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCD3g-0000Wk-OO for qemu-devel@nongnu.org; Thu, 13 Sep 2012 13:18:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCD3g-0000UI-ED for qemu-devel@nongnu.org; Thu, 13 Sep 2012 13:18:32 -0400 Message-ID: <50521531.6010308@redhat.com> Date: Thu, 13 Sep 2012 13:17:37 -0400 From: Jeff Cody MIME-Version: 1.0 References: <01df3140216ac0398bfb3a295c553c42cdf31e5b.1347548248.git.jcody@redhat.com> <5052060A.5010304@redhat.com> In-Reply-To: <5052060A.5010304@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers Reply-To: jcody@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, supriyak@linux.vnet.ibm.com, eblake@redhat.com, qemu-devel@nongnu.org, stefanha@gmail.com On 09/13/2012 12:12 PM, Paolo Bonzini wrote: > Il 13/09/2012 17:49, Jeff Cody ha scritto: >> Block drivers should always open the files in writeback mode (see commit >> e1e9b0ac), so raw-posix/raw-win32 should not parse the BDRV_O_CACHE_WB >> flag. >> >> Signed-off-by: Jeff Cody >> --- >> block/raw-posix.c | 3 --- >> block/raw-win32.c | 3 --- >> 2 files changed, 6 deletions(-) >> >> diff --git a/block/raw-posix.c b/block/raw-posix.c >> index 7d3ac9d..4a1047c 100644 >> --- a/block/raw-posix.c >> +++ b/block/raw-posix.c >> @@ -202,9 +202,6 @@ static void raw_parse_flags(int bdrv_flags, int *open_flags) >> if ((bdrv_flags & BDRV_O_NOCACHE)) { >> *open_flags |= O_DIRECT; >> } >> - if (!(bdrv_flags & BDRV_O_CACHE_WB)) { >> - *open_flags |= O_DSYNC; >> - } >> } >> >> static int raw_set_aio(void **aio_ctx, int *use_aio, int bdrv_flags) >> diff --git a/block/raw-win32.c b/block/raw-win32.c >> index 335c06a..78c8306 100644 >> --- a/block/raw-win32.c >> +++ b/block/raw-win32.c >> @@ -92,9 +92,6 @@ static void raw_parse_flags(int flags, int *access_flags, DWORD *overlapped) >> if (flags & BDRV_O_NOCACHE) { >> *overlapped |= FILE_FLAG_NO_BUFFERING; >> } >> - if (!(flags & BDRV_O_CACHE_WB)) { >> - *overlapped |= FILE_FLAG_WRITE_THROUGH; >> - } >> } >> >> static int raw_open(BlockDriverState *bs, const char *filename, int flags) >> > > Why does this matter? If raw-posix was opened directly (i.e. without > the bs->file indirection) this would cause a writethrough file to be > incorrectly opened as writeback. > > Paolo > The problem this patch was trying to work around is that bdrv_open_common() forces BDRV_O_CACHE_WB (commit e1e9b0ac), but that setting is not preserved in bs->open_flags, so it is lost on a reopen. Is there a scenario currently that has raw-posix opened directly as a writethrough file, or were you more concerned with future use?