Index: /trunk/include/VBox/vd.h
===================================================================
--- /trunk/include/VBox/vd.h	(revision 39797)
+++ /trunk/include/VBox/vd.h	(revision 39798)
@@ -193,6 +193,12 @@
  * supported. */
 #define VD_OPEN_FLAGS_DISCARD       RT_BIT(7)
+/** Ignore all flush requests to workaround certain filesystems which are slow
+ * when writing a lot of cached data to the medium.
+ * Use with extreme care as a host crash can result in completely corrupted and
+ * unusable images.
+ */
+#define VD_OPEN_FLAGS_IGNORE_FLUSH  RT_BIT(8)
 /** Mask of valid flags. */
-#define VD_OPEN_FLAGS_MASK          (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD)
+#define VD_OPEN_FLAGS_MASK          (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH)
 /** @}*/
 
Index: /trunk/src/VBox/Storage/VD.cpp
===================================================================
--- /trunk/src/VBox/Storage/VD.cpp	(revision 39797)
+++ /trunk/src/VBox/Storage/VD.cpp	(revision 39798)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -87,4 +87,6 @@
     /** Disk this image is part of */
     PVBOXHDD            pDisk;
+    /** Flag whether to ignore flush requests. */
+    bool                fIgnoreFlush;
 } VDIO, *PVDIO;
 
@@ -3944,7 +3946,12 @@
 static int vdIOIntFlushSync(void *pvUser, PVDIOSTORAGE pIoStorage)
 {
+    int rc = VINF_SUCCESS;
     PVDIO pVDIo = (PVDIO)pvUser;
-    return pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser,
-                                             pIoStorage->pStorage);
+
+    if (!pVDIo->fIgnoreFlush)
+        rc = pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser,
+                                               pIoStorage->pStorage);
+
+    return rc;
 }
 
@@ -4323,4 +4330,7 @@
     LogFlowFunc(("pvUser=%#p pIoStorage=%#p pIoCtx=%#p\n",
                  pvUser, pIoStorage, pIoCtx));
+
+    if (pVDIo->fIgnoreFlush)
+        return VINF_SUCCESS;
 
     /* Allocate a new meta transfer. */
@@ -5221,7 +5231,7 @@
         AssertRC(rc);
 
-        pImage->uOpenFlags = uOpenFlags & (VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_DISCARD);
+        pImage->uOpenFlags = uOpenFlags & (VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH);
         rc = pImage->Backend->pfnOpen(pImage->pszFilename,
-                                      uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME,
+                                      uOpenFlags & ~(VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_IGNORE_FLUSH),
                                       pDisk->pVDIfsDisk,
                                       pImage->pVDIfsImage,
@@ -5258,4 +5268,5 @@
 
         pImage->VDIo.pBackendData = pImage->pBackendData;
+        pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
 
         /* Check image type. As the image itself has only partial knowledge
@@ -5749,4 +5760,5 @@
         {
             pImage->VDIo.pBackendData = pImage->pBackendData;
+            pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
             pImage->uImageFlags = uImageFlags;
 
@@ -6025,4 +6037,5 @@
         {
             pImage->VDIo.pBackendData = pImage->pBackendData;
+            pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
             pImage->uImageFlags = uImageFlags;
 
@@ -6276,4 +6289,5 @@
 
             pCache->VDIo.pBackendData = pCache->pBackendData;
+            pCache->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
 
             /* Re-check state, as the lock wasn't held and another image
