[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag
From: |
Jamie Lokier |
Subject: |
Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag |
Date: |
Mon, 31 Aug 2009 23:09:50 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Christoph Hellwig wrote:
> We would have to claim one for data=writeback to be safe, but for I will
> follow Avi's opinion that it is a useless mode and should be our
> dedicated unsafe mode. If anyone disagrees please start the flame
> thrower now and I will change it. Otherwise a documentation patch will
> follow to explicitly document data=writeback as unsafe.
*Opening flame thrower!*
Unsafe, useless?
It's the most useful mode when you're starting and stopping VMs
regularly, or if you can't use O_DIRECT.
It's safe if fdatasync is called - in other words not advertising a
write cache is silly.
I haven't measured but I'd expect it to be much faster than O_SYNC on
some host hardware, for the same reason that barriers + volatile write
cache are much faster on some host hardware than disabling the write cache.
Right now, on a Linux host O_SYNC is unsafe with hardware that has a
volatile write cache. That might not be changed, but if it is than
performance with cache=writethrough will plummet (due to issuing a
CACHE FLUSH to the hardware after every write), while performance with
cache=writeback will be reasonable.
If an unsafe mode is desired (I think it is, for those throwaway
testing VMs, or during OS installs), I suggest adding cache=volatile:
cache=none
O_DIRECT, fdatasync, advertise volatile write cache
cache=writethrough
O_SYNC, do not advertise
cache=writeback
fdatasync, advertise volatile write cache
cache=volatile
nothing (perhaps fdatasync on QEMU blockdev close)
When using guests OSes which issue CACHE FLUSH commands (that's a
guest config issue), why would you ever use cache=writethrough?
cache=writeback should be faster and equally safe - provided you do
actually advertise the write cache! So please do! Not doing so is
silly.
-- Jamie
- [Qemu-devel] [PATCH 0/4] data integrity fixes, Christoph Hellwig, 2009/08/31
- [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Christoph Hellwig, 2009/08/31
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag,
Jamie Lokier <=
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Anthony Liguori, 2009/08/31
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Jamie Lokier, 2009/08/31
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Christoph Hellwig, 2009/08/31
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Jamie Lokier, 2009/08/31
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Christoph Hellwig, 2009/08/31
- Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag, Christoph Hellwig, 2009/08/31
[Qemu-devel] [PATCH 2/4] block: use fdatasync instead of fsync, Christoph Hellwig, 2009/08/31