qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Caching modes


From: Anthony Liguori
Subject: [Qemu-devel] Caching modes
Date: Mon, 20 Sep 2010 11:53:02 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100826 Lightning/1.0b1 Thunderbird/3.0.7

Moving to a separate thread since this has come up a few times and I think we need to discuss the assumptions a bit more.

This is how I understand the caching modes should behave and what guarantees a guest gets.

cache=none

All read and write requests SHOULD avoid any type of caching in the host. Any write request MUST complete after the next level of storage reports that the write request has completed. A flush from the guest MUST complete after all pending I/O requests for the guest have been completed.

As an implementation detail, with the raw format, these guarantees are only in place for preallocated images. Sparse images do not provide as strong of a guarantee.

cache=writethrough

All read and write requests MAY be cached by the host. Read requests MAY be satisfied by cached data in the host. Any write request MUST complete after the next level of storage reports that the write request has completed. A flush from the guest MUST complete after all pending I/O requests for the guest have been completed.

As an implementation detail, with the raw format, these guarantees also apply for sparse images. In the future, we could relax this such that sparse images did not provide as strong of a guarantee.

cache=writeback

All read and writes requests MAY be cached by the host. Read and write requests may be completed entirely within the cache. A write request MAY complete before the next level of storage reports that the write request has completed. A flush from the guest MUST complete after all pending I/O requests for the guest have been completed and acknowledged by the next level of the storage hierarchy.

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.

Writeback disk cache; cache=none|writethrough if the disk cache is set to writeback and the disk is not enterprise class. cache=writeback if the host is not backed by an UPS.

Regards,

Anthony Liguori



reply via email to

[Prev in Thread] Current Thread [Next in Thread]