From 2351e9ce8664a22916cd8b4a4911f840a51c7383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Tue, 18 Feb 2020 18:14:55 +0100 Subject: [PATCH] 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. --- repos/ports/ports/virtualbox5.hash | 2 +- .../ports/src/virtualbox5/patches/drvvd.patch | 11 +++++++ repos/ports/src/virtualbox5/patches/series | 1 + .../ports/src/virtualbox5/patches/vmdk.patch | 30 +++++++++++++++++-- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 repos/ports/src/virtualbox5/patches/drvvd.patch diff --git a/repos/ports/ports/virtualbox5.hash b/repos/ports/ports/virtualbox5.hash index 5a4e45e54..44d44226e 100644 --- a/repos/ports/ports/virtualbox5.hash +++ b/repos/ports/ports/virtualbox5.hash @@ -1 +1 @@ -e9340716743511dca9579b5c611862501ecd15e0 +7924d4f6309b52fab63175d135301da03004e53f diff --git a/repos/ports/src/virtualbox5/patches/drvvd.patch b/repos/ports/src/virtualbox5/patches/drvvd.patch new file mode 100644 index 000000000..addec0715 --- /dev/null +++ b/repos/ports/src/virtualbox5/patches/drvvd.patch @@ -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")); + diff --git a/repos/ports/src/virtualbox5/patches/series b/repos/ports/src/virtualbox5/patches/series index 4a715967c..4a4ce9702 100644 --- a/repos/ports/src/virtualbox5/patches/series +++ b/repos/ports/src/virtualbox5/patches/series @@ -36,3 +36,4 @@ rem_mem.patch vga.patch register.patch changeset82265.patch +drvvd.patch diff --git a/repos/ports/src/virtualbox5/patches/vmdk.patch b/repos/ports/src/virtualbox5/patches/vmdk.patch index 7a24851f8..cea83caaf 100644 --- a/repos/ports/src/virtualbox5/patches/vmdk.patch +++ b/repos/ports/src/virtualbox5/patches/vmdk.patch @@ -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;