qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers
Date: Fri, 14 Sep 2012 09:27:24 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Am 13.09.2012 18:12, schrieb Paolo Bonzini:
> 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 <address@hidden>
>> ---
>>  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.

--verbose, please.

I can't see how bs->file is needed here for writethrough semantics.
bdrv_open_common() sets bs->enable_write_cache to false and
bdrv_co_do_writev() checks it and flushes if necessary. Looks fine to me.

In fact, bdrv_open_common() even removes BDRV_O_CACHE_WB, so what Jeff
removes here is really dead code (checked with strace: The file isn't
opened with O_SYNC even when using -drive format=file).

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]