On Thu, Jan 03, 2013 at 09:43:53PM +0800, Liu Yuan wrote: > On 12/25/2012 04:45 PM, Liu Yuan wrote: > > Well, I found setting cache=directsync will contain 'BDRV_O_CACHE_WB'. > > Is this a bug for current master? If no, my current scheme will be the > > only way to bypass cache of sheepdog. > > Ping. Can anyone confirm it is a bug that 'cache=directsync' will pass > BDRV_O_CACHE_WB' in the flags?
Hi Yuan, BDRV_O_NOCACHE means bypass host page cache (O_DIRECT). BDRV_O_CACHE_WB specifies the cache semantics that the guest sees - that means whether the disk cache is writethrough or writeback. In other words, BDRV_O_NOCACHE is a host performance tweak while BDRV_O_CACHE_WB changes the cache safety of the BlockDriverState. A protocol driver like sheepdog doesn't need to look at BDRV_O_CACHE_WB because it is implemented in block.c (see bdrv_co_do_writev() where QEMU will flush when after each write when !bs->enable_write_cache). Stefan