]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Create raw storage files with O_DSYNC
authorJiri Denemark <jdenemar@redhat.com>
Mon, 8 Feb 2010 15:10:02 +0000 (16:10 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 9 Feb 2010 15:51:15 +0000 (16:51 +0100)
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.

src/storage/storage_backend.c

index 8d85de8a11976b49cb43a9b4f64566d4d73d2156..4c62d48477793160d71e80064b249665c8a50838 100644 (file)
@@ -300,7 +300,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(errno,
                              _("cannot open new path '%s'"),
                              vol->target.path);