[libvirt] [PATCH] Create raw storage files with O_DSYNC

Jiri Denemark jdenemar at redhat.com
Mon Feb 8 15:59:31 UTC 2010


When creating preallocated large raw files opening them with O_DSYNC
prevents long delays in reading because cache pages can be immediately
reused without writing them on a disk first.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/storage/storage_backend.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index e79294a..8aab9ab 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -301,7 +301,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
         goto cleanup;
     }
 
-    if ((fd = open(vol->target.path, O_RDWR | O_EXCL)) < 0) {
+    if ((fd = open(vol->target.path, O_RDWR | O_EXCL | O_DSYNC)) < 0) {
         virReportSystemError(conn, errno,
                              _("cannot open new path '%s'"),
                              vol->target.path);
-- 
1.6.6.1




More information about the libvir-list mailing list