qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] Disk integrity in QEMU


From: Jens Axboe
Subject: Re: [Qemu-devel] [RFC] Disk integrity in QEMU
Date: Sun, 19 Oct 2008 20:10:27 +0200

On Sun, Oct 19 2008, Avi Kivity wrote:
> Jens Axboe wrote:
> >On Sun, Oct 12 2008, Avi Kivity wrote:
> >  
> >>>If you have a normal laptop, your disk has a cache.  That cache does 
> >>>not have a battery backup.  Under normal operations, the cache is 
> >>>acting in write-back mode and when you do a write, the disk will 
> >>>report the write as completed even though it is not actually on disk.  
> >>>If you really care about the data being on disk, you have to either 
> >>>use a disk with a battery backed cache (much more expensive) or enable 
> >>>write-through caching (will significantly reduce performance).
> >>>
> >>>      
> >>I think that with SATA NCQ, this is no longer true.  The drive will 
> >>report the write complete when it is on disk, and utilize multiple 
> >>outstanding requests to get coalescing and reordering.  Not sure about 
> >>    
> >
> >It is still very true. Go buy any consumer drive on the market and check
> >the write cache settings - hint, it's definitely shipped with write back
> >caching. So while the drive may have NCQ and Linux will use it, the
> >write cache is still using write back unless you explicitly change it.
> >
> >  
> 
> Sounds like a bug.  Shouldn't Linux disable the write cache unless the 
> user explicitly enables it, if NCQ is available?  NCQ should provide 
> acceptable throughput even without the write cache.

How can it be a bug? Changing the cache policy of a drive would be a
policy decision in the kernel, that is never the right thing to do.
There's no such thing as 'acceptable throughput', manufacturers and
customers usually just want the go faster stripes and data consistency
is second. Additionally, write back caching is perfectly safe, if used
with a barrier enabled file system in Linux.

Also note that most users will not have deep queuing for most things. To
get good random write performance with write through caching and NCQ,
you naturally need to be able to fill the drive queue most of the time.
Most desktop workloads don't come close to that, so the user will
definitely see it as slower.

-- 
Jens Axboe





reply via email to

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