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

Re: [libvirt] PATCH: Disable QEMU drive caching

Anthony Liguori wrote:
Mark McLoughlin wrote:

And let's take a step back too. If people are really concerned about this point, let's introduce a sync=on option that opens the image with O_SYNC. This will effectively make the cache write-through without the baggage associated with O_DIRECT.

I'm starting to slowly convince myself we should always open files with O_SYNC. Barriers should just force ordering within the thread pool. posix-aio has no interface for this but we could create one with our own thread pool implementation.

Ryan: could you give the following patch a perf-run so we can see how this would effect us?


Anthony Liguori

While I object to libvirt always setting cache=off, I think sync=on for IDE and SCSI may be reasonable (you don't want it for virtio-blk once we implement proper barriers with fdatasync I think).


Anthony Liguori


diff --git a/block-raw-posix.c b/block-raw-posix.c
index c0404fa..0d8ffdb 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -121,7 +121,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
     s->lseek_err_cnt = 0;
-    open_flags = O_BINARY;
+    open_flags = O_BINARY | O_SYNC;
     if ((flags & BDRV_O_ACCESS) == O_RDWR) {
         open_flags |= O_RDWR;
     } else {

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