On Tue, Jan 08, 2013 at 01:42:35PM +0800, Liu Yuan wrote: > On 01/07/2013 09:23 PM, Kevin Wolf wrote: > > No, and in theory they shouldn't have to care. > > > > Why do you want to handle writethrough semantics in the block driver > > rather than letting qemu care for sending the right flushes? > > Because Sheepdog itself provide the client side cache implementation and > we need means to get the cache hint from users when starting up the VM. > This cache support: > writethrough: provide a read cache for this VM, which is always > consistent with cluster data > writeback: provide a writeback cache for this VM, which only flush the > dirty bits when VM send 'flush' request. > directio: disable cache completely for this VM. > > Old QEMU (before v1.2) allows block drivers to get the cache flags, so > Sheepdog can interpret these flags on its own to choose the right cache > mode for each VM. doesn't QEMU need keep backward compatibility?
This sounds fine - it fits together with QEMU like this: BDRV_NO_CACHE means sheepdog directio. We're disabling the client-side sheepdog cache. Otherwise use sheepdog writeback and let QEMU block.c decide when to flush. Never use sheepdog writethrough because it's redundant here. Stefan