Re: [PATCH 1/4] block: add enable_write_cache flag
Christoph Hellwig <hch <at> lst.de>
2009-08-31 23:06:12 GMT
On Mon, Aug 31, 2009 at 11:46:45PM +0100, Jamie Lokier wrote:
> > On Mon, Aug 31, 2009 at 11:09:50PM +0100, Jamie Lokier wrote:
> > > 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.
> > Currenly all modes are more or less unsafe with volatile write caches
> > at least when using ext3 or raw block device accesses. XFS is safe
> > two thirds due to doing the right thing and one third due to sheer
> > luck.
> Right, but now you've made it worse. By not calling fdatasync at all,
> you've reduced the integrity. Previously it would reach the drive's
> cache, and take whatever (short) time it took to reach the platter.
> Now you're leaving data in the host cache which can stay for much
> longer, and is vulnerable to host kernel crashes.
Your last comment is for data=writeback, which in Avi's proposal that
I implemented would indeed lost any guarantees and be for all pratical
matters unsafe. It's not true for any of the other options.
> Oh, and QEMU could call whatever "hdparm -F" does when using raw block
Actually for ide/scsi implementing cache control is on my todo list.
Not sure about virtio yet.
> Well I'd like to start by pointing out your patch introduces a