Changeset 46859 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Jun 28, 2013 10:02:54 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
r44528 r46859 161 161 /** Flag whether consistency checks are enabled. */ 162 162 bool fCheckConsistency; 163 /** Flag whether the RAM disk was prepopulated. */ 164 bool fPrepopulateRamDisk; 163 165 /** AVL tree containing the disk blocks to check. */ 164 166 PAVLRFOFFTREE pTreeSegments; … … 438 440 else 439 441 cbRange = pSeg->Core.Key - offCurr; 442 443 if (pThis->fPrepopulateRamDisk) 444 { 445 /* No segment means everything should be 0 for this part. */ 446 if (!RTSgBufIsZero(&SgBuf, cbRange)) 447 { 448 RTMsgError("Corrupted disk at offset %llu (expected everything to be 0)!\n", 449 offCurr); 450 RTAssertDebugBreak(); 451 } 452 } 440 453 } 441 454 else … … 1242 1255 "CheckDoubleCompletions\0" 1243 1256 "HistorySize\0" 1244 "IoLog\0")) 1257 "IoLog\0" 1258 "PrepopulateRamDisk\0")) 1245 1259 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1246 1260 … … 1257 1271 rc = CFGMR3QueryU32Def(pCfg, "HistorySize", &pThis->cEntries, 512); 1258 1272 AssertRC(rc); 1273 rc = CFGMR3QueryBoolDef(pCfg, "PrepopulateRamDisk", &pThis->fPrepopulateRamDisk, false); 1274 AssertRC(rc); 1259 1275 1260 1276 char *pszIoLogFilename = NULL; … … 1362 1378 rc = VDDbgIoLogCreate(&pThis->hIoLogger, pszIoLogFilename, VDDBG_IOLOG_LOG_DATA); 1363 1379 MMR3HeapFree(pszIoLogFilename); 1380 } 1381 1382 /* Read in all data before the start if requested. */ 1383 if (pThis->fPrepopulateRamDisk) 1384 { 1385 uint64_t cbDisk = 0; 1386 1387 LogRel(("DiskIntegrity: Prepopulating RAM disk, this will take some time...\n")); 1388 1389 cbDisk = pThis->pDrvMedia->pfnGetSize(pThis->pDrvMedia); 1390 if (cbDisk) 1391 { 1392 uint64_t off = 0; 1393 uint8_t abBuffer[_64K]; 1394 RTSGSEG Seg; 1395 1396 Seg.pvSeg = abBuffer; 1397 1398 while (cbDisk) 1399 { 1400 size_t cbThisRead = RT_MIN(cbDisk, sizeof(abBuffer)); 1401 1402 rc = pThis->pDrvMedia->pfnRead(pThis->pDrvMedia, off, abBuffer, cbThisRead); 1403 if (RT_FAILURE(rc)) 1404 break; 1405 1406 if (ASMBitFirstSet(abBuffer, sizeof(abBuffer) * 8) != -1) 1407 { 1408 Seg.cbSeg = cbThisRead; 1409 rc = drvdiskintWriteRecord(pThis, &Seg, 1, 1410 off, cbThisRead); 1411 if (RT_FAILURE(rc)) 1412 break; 1413 } 1414 1415 cbDisk -= cbThisRead; 1416 off += cbThisRead; 1417 } 1418 1419 LogRel(("DiskIntegrity: Prepopulating RAM disk finished with %Rrc\n", rc)); 1420 } 1421 else 1422 return PDMDRV_SET_ERROR(pDrvIns, VERR_INTERNAL_ERROR, 1423 N_("DiskIntegrity: Error querying the media size below")); 1364 1424 } 1365 1425
Note:
See TracChangeset
for help on using the changeset viewer.