- Timestamp:
- Jan 18, 2012 4:55:06 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75772
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vd.h
r39519 r39798 193 193 * supported. */ 194 194 #define VD_OPEN_FLAGS_DISCARD RT_BIT(7) 195 /** Ignore all flush requests to workaround certain filesystems which are slow 196 * when writing a lot of cached data to the medium. 197 * Use with extreme care as a host crash can result in completely corrupted and 198 * unusable images. 199 */ 200 #define VD_OPEN_FLAGS_IGNORE_FLUSH RT_BIT(8) 195 201 /** Mask of valid flags. */ 196 #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 )202 #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) 197 203 /** @}*/ 198 204 -
trunk/src/VBox/Storage/VD.cpp
r39612 r39798 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 87 87 /** Disk this image is part of */ 88 88 PVBOXHDD pDisk; 89 /** Flag whether to ignore flush requests. */ 90 bool fIgnoreFlush; 89 91 } VDIO, *PVDIO; 90 92 … … 3944 3946 static int vdIOIntFlushSync(void *pvUser, PVDIOSTORAGE pIoStorage) 3945 3947 { 3948 int rc = VINF_SUCCESS; 3946 3949 PVDIO pVDIo = (PVDIO)pvUser; 3947 return pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser, 3948 pIoStorage->pStorage); 3950 3951 if (!pVDIo->fIgnoreFlush) 3952 rc = pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser, 3953 pIoStorage->pStorage); 3954 3955 return rc; 3949 3956 } 3950 3957 … … 4323 4330 LogFlowFunc(("pvUser=%#p pIoStorage=%#p pIoCtx=%#p\n", 4324 4331 pvUser, pIoStorage, pIoCtx)); 4332 4333 if (pVDIo->fIgnoreFlush) 4334 return VINF_SUCCESS; 4325 4335 4326 4336 /* Allocate a new meta transfer. */ … … 5221 5231 AssertRC(rc); 5222 5232 5223 pImage->uOpenFlags = uOpenFlags & (VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_DISCARD );5233 pImage->uOpenFlags = uOpenFlags & (VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH); 5224 5234 rc = pImage->Backend->pfnOpen(pImage->pszFilename, 5225 uOpenFlags & ~ VD_OPEN_FLAGS_HONOR_SAME,5235 uOpenFlags & ~(VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_IGNORE_FLUSH), 5226 5236 pDisk->pVDIfsDisk, 5227 5237 pImage->pVDIfsImage, … … 5258 5268 5259 5269 pImage->VDIo.pBackendData = pImage->pBackendData; 5270 pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0; 5260 5271 5261 5272 /* Check image type. As the image itself has only partial knowledge … … 5749 5760 { 5750 5761 pImage->VDIo.pBackendData = pImage->pBackendData; 5762 pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0; 5751 5763 pImage->uImageFlags = uImageFlags; 5752 5764 … … 6025 6037 { 6026 6038 pImage->VDIo.pBackendData = pImage->pBackendData; 6039 pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0; 6027 6040 pImage->uImageFlags = uImageFlags; 6028 6041 … … 6276 6289 6277 6290 pCache->VDIo.pBackendData = pCache->pBackendData; 6291 pCache->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0; 6278 6292 6279 6293 /* Re-check state, as the lock wasn't held and another image
Note:
See TracChangeset
for help on using the changeset viewer.