At Fri, 20 Apr 2012 20:05:48 +0200, Christoph Hellwig wrote: > > On Tue, Apr 03, 2012 at 01:35:50AM +0800, Liu Yuan wrote: > > From: Liu Yuan <tailai...@taobao.com> > > > > Flush operation is supposed to flush the write-back cache of > > sheepdog cluster. > > > > By issuing flush operation, we can assure the Guest of data > > reaching the sheepdog cluster storage. > > How does qemu know that the cache might need flushing in the backend? > > If the backend expects a flush we need to make sure one is sent after > every write if the user selects cache=writethrough or cache=directsync. > Given how expensive that is you should also consider adding an equivalent > to the FUA flag for writes in that case, or simply allow the qemu driver > to tell the cluster that it needs to operate in writethrough mode for > this VDI.
His patch sets the SD_FLAG_CMD_CACHE flag for writes only when the user selects cache=writeback or cache=none. If SD_FLAG_CMD_CACHE is not set in the request, Sheepdog servers are forced to flush the cache like FUA commands. Thanks, Kazutaka