virtualbox5: enable storage device flushing

The patches forcefully set the 'IgnoreFlush' option to false and change
a sanity check in the VMDK backend. This enables passing the guest's
flush request down to the Block VFS plugin.

Issue #3743.
This commit is contained in:
Josef Söntgen 2020-02-18 18:14:55 +01:00 committed by Christian Helmuth
parent ba93df2d9d
commit 2351e9ce86
4 changed files with 41 additions and 3 deletions

View File

@ -1 +1 @@
e9340716743511dca9579b5c611862501ecd15e0
7924d4f6309b52fab63175d135301da03004e53f

View File

@ -0,0 +1,11 @@
--- a/src/app/virtualbox/src/VBox/Devices/Storage/DrvVD.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/Storage/DrvVD.cpp
@@ -4611,7 +4611,7 @@
#endif /* VBOX_PERIODIC_FLUSH */
#ifdef VBOX_IGNORE_FLUSH
- rc = CFGMR3QueryBoolDef(pCfg, "IgnoreFlush", &pThis->fIgnoreFlush, true);
+ rc = CFGMR3QueryBoolDef(pCfg, "IgnoreFlush", &pThis->fIgnoreFlush, false);
if (RT_FAILURE(rc))
return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"IgnoreFlush\" from the config"));

View File

@ -36,3 +36,4 @@ rem_mem.patch
vga.patch
register.patch
changeset82265.patch
drvvd.patch

View File

@ -4,7 +4,33 @@ diff --git a/src/app/virtualbox/src/VBox/Storage/VMDK.cpp b/src/app/virtualbox/s
index f749ee4..0c5d49e 100644
--- a/src/app/virtualbox/src/VBox/Storage/VMDK.cpp
+++ b/src/app/virtualbox/src/VBox/Storage/VMDK.cpp
@@ -5771,7 +5771,6 @@ static int vmdkRead(void *pBackendData, uint64_t uOffset, size_t cbToRead,
@@ -4378,6 +4378,7 @@
PVMDKEXTENT pExtent;
int rc = VINF_SUCCESS;
+#if 0
/* Update descriptor if changed. */
if (pImage->Descriptor.fDirty)
{
@@ -4385,6 +4386,7 @@
if (RT_FAILURE(rc))
goto out;
}
+#endif
for (unsigned i = 0; i < pImage->cExtents; i++)
{
@@ -4440,8 +4442,7 @@
case VMDKETYPE_FLAT:
/** @todo implement proper path absolute check. */
if ( pExtent->pFile != NULL
- && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
- && !(pExtent->pszBasename[0] == RTPATH_SLASH))
+ && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
rc = vdIfIoIntFileFlush(pImage->pIfIo, pExtent->pFile->pStorage, pIoCtx,
NULL, NULL);
break;
@@ -5796,7 +5797,6 @@
}
pExtent->uGrainSectorAbs = uSectorExtentAbs;
pExtent->uGrain = uSectorExtentRel / pExtent->cSectorsPerGrain;
@ -12,7 +38,7 @@ index f749ee4..0c5d49e 100644
}
vdIfIoIntIoCtxCopyTo(pImage->pIfIo, pIoCtx,
(uint8_t *)pExtent->pvGrain
@@ -5920,7 +5919,6 @@ static int vmdkWrite(void *pBackendData, uint64_t uOffset, size_t cbToWrite,
@@ -5945,7 +5945,6 @@
* which is somewhere between expensive and impossible. */
rc = VERR_VD_VMDK_INVALID_STATE;
pExtent->uGrainSectorAbs = 0;