Ok, I am confused On Fri, Apr 22, 2011 at 4:13 PM, Christoph Hellwig <h...@lst.de> wrote: > On Fri, Apr 22, 2011 at 04:08:57PM +1000, ronnie sahlberg wrote: >> So I should set FUA when >> BDRV_O_CACHE_WB==0 or BDRV_O_NOCACHE==1 >> right? > > At this point you need to set it if either the BDRV_O_CACHE_WB and > BDRV_O_NOCACHE flags are set. And yes, the naming of the nocache > flag is rather confusing. > > Take a look at block.c:bdrv_open_common(): > > /* > * Yes, BDRV_O_NOCACHE aka O_DIRECT means we have to present a > * write cache to the guest. We do need the fdatasync to flush > * out transactions for block allocations, and we maybe have a > * volatile write cache in our backing device to deal with. > */ > if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) > bs->enable_write_cache = 1; >
I have to set FUA if the WB(I guessed this meant write-back) flag is set? Not the opposite (I assume opposite of write-back is write-through) ? So that would mean if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) caching is NOT ok, write with FUA=1 else caching is ok, write with FUA=0 right ? regards ronnie sahlberg