On 09/20/2010 01:37 PM, Blue Swirl wrote:
It would be nice to have additional mode, like cache=always, where
even flushes MAY be ignored. This would max out the performance.
That's cache=unsafe and we have it. I ignored it for the purposes of
this discussion.
Guest disk cache.
For all devices that support it, the exposed cache attribute should be
independent of the host caching mode. Here are correct usages of disk
caching mode:
Writethrough disk cache; cache=none|writethrough if the disk cache is set to
writethrough or the disk is considered "enterprise class" and has a battery
backup. cache=writeback IFF the host is backed by an UPS.
The "enterprise class" disks, battery backups and UPS devices are not
consumer equipment. Wouldn't this mean that any private QEMU user
would need to use cache=none?
No, cache=writethrough and cache=none should be equivalent from a data
integrity/data loss perspective. Using cache=writeback without
enterprise storage is risky but practically speaking, most consumer
storage is not battery backed and uses writeback caching anyway so there
is already risk.
As an example, what is the correct usage for laptop user, considering
that there is a battery, but it can also drain and the drainage is
dependent on flush frequency?
Minus cache=unsafe, you'll never get data corruption. The only
consideration is how much data loss can occur from the last time there
was a flush. Well behaved applications always flush important data to
avoid loss of anything important but practically speaking, the world
isn't full of behaved applications.
The only difference between cache=writeback and a normal disk's
writeback cache is that cache=writeback can be a very, very large cache
that isn't frequently flushed. So the amount of data loss can be much
higher than expected.
For most laptop users, cache=none or cache=writethrough is appropriate.
For a developer, cache=writeback probably is reasonable.
Regards,
Anthony Liguori
Regards,
Anthony Liguori