Changeset 51619 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 16, 2014 9:10:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
r46859 r51619 53 53 DRVDISKAIOTXDIR_FLUSH, 54 54 /** Discard */ 55 DRVDISKAIOTXDIR_DISCARD 55 DRVDISKAIOTXDIR_DISCARD, 56 /** Read after write for immediate verification. */ 57 DRVDISKAIOTXDIR_READ_AFTER_WRITE 56 58 } DRVDISKAIOTXDIR; 57 59 … … 191 193 /** Current entry in the array. */ 192 194 unsigned iEntry; 195 196 /** Flag whether to do a immediate read after write for verification. */ 197 bool fReadAfterWrite; 193 198 194 199 /** I/O logger to use if enabled. */ … … 716 721 } 717 722 723 /** 724 * Verify a completed read after write request. 725 * 726 * @returns VBox status code. 727 * @param pThis The driver instance data. 728 * @param pIoReq The request to be verified. 729 */ 730 static int drvdiskintReadAfterWriteVerify(PDRVDISKINTEGRITY pThis, PDRVDISKAIOREQ pIoReq) 731 { 732 int rc = VINF_SUCCESS; 733 734 if (pThis->fCheckConsistency) 735 rc = drvdiskintReadVerify(pThis, pIoReq->paSeg, pIoReq->cSeg, pIoReq->off, pIoReq->cbTransfer); 736 else /** @todo: Implement read after write verification without a memory based image of the disk. */ 737 AssertMsgFailed(("TODO\n")); 738 739 return rc; 740 } 741 718 742 /* -=-=-=-=- IMedia -=-=-=-=- */ 719 743 … … 1072 1096 PDRVDISKINTEGRITY pThis = PDMIMEDIA_2_DRVDISKINTEGRITY(pInterface); 1073 1097 return pThis->pDrvMedia->pfnGetUuid(pThis->pDrvMedia, pUuid); 1098 } 1099 1100 /** @copydoc PDMIMEDIA::pfnGetSectorSize */ 1101 static DECLCALLBACK(uint32_t) drvdiskintGetSectorSize(PPDMIMEDIA pInterface) 1102 { 1103 PDRVDISKINTEGRITY pThis = PDMIMEDIA_2_DRVDISKINTEGRITY(pInterface); 1104 return pThis->pDrvMedia->pfnGetSectorSize(pThis->pDrvMedia); 1074 1105 } 1075 1106 … … 1126 1157 else if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_DISCARD) 1127 1158 rc = drvdiskintDiscardRecords(pThis, pIoReq->paRanges, pIoReq->cRanges); 1159 else if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_READ_AFTER_WRITE) 1160 rc = drvdiskintReadAfterWriteVerify(pThis, pIoReq); 1128 1161 else 1129 1162 AssertMsg(pIoReq->enmTxDir == DRVDISKAIOTXDIR_FLUSH, ("Huh?\n")); … … 1143 1176 } 1144 1177 1145 void *pvUserComplete = pIoReq->pvUser; 1146 1147 drvdiskintIoReqFree(pThis, pIoReq); 1148 1149 rc = pThis->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pThis->pDrvMediaAsyncPort, pvUserComplete, rcReq); 1178 if ( pThis->fReadAfterWrite 1179 && pIoReq->enmTxDir == DRVDISKAIOTXDIR_WRITE) 1180 { 1181 pIoReq->enmTxDir = DRVDISKAIOTXDIR_READ_AFTER_WRITE; 1182 1183 /* Readd because it was rmeoved above. */ 1184 if (pThis->fTraceRequests) 1185 drvdiskintIoReqAdd(pThis, pIoReq); 1186 1187 rc = pThis->pDrvMediaAsync->pfnStartRead(pThis->pDrvMediaAsync, pIoReq->off, pIoReq->paSeg, pIoReq->cSeg, 1188 pIoReq->cbTransfer, pIoReq); 1189 if (rc == VINF_VD_ASYNC_IO_FINISHED) 1190 { 1191 rc = drvdiskintReadAfterWriteVerify(pThis, pIoReq); 1192 1193 if (pThis->fTraceRequests) 1194 drvdiskintIoReqRemove(pThis, pIoReq); 1195 RTMemFree(pIoReq); 1196 } 1197 else if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1198 rc = VINF_SUCCESS; 1199 else if (RT_FAILURE(rc)) 1200 RTMemFree(pIoReq); 1201 } 1202 else 1203 { 1204 void *pvUserComplete = pIoReq->pvUser; 1205 drvdiskintIoReqFree(pThis, pIoReq); 1206 1207 rc = pThis->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pThis->pDrvMediaAsyncPort, pvUserComplete, rcReq); 1208 } 1150 1209 1151 1210 return rc; … … 1256 1315 "HistorySize\0" 1257 1316 "IoLog\0" 1258 "PrepopulateRamDisk\0")) 1317 "PrepopulateRamDisk\0" 1318 "ReadAfterWrite\0")) 1259 1319 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1260 1320 … … 1273 1333 rc = CFGMR3QueryBoolDef(pCfg, "PrepopulateRamDisk", &pThis->fPrepopulateRamDisk, false); 1274 1334 AssertRC(rc); 1335 rc = CFGMR3QueryBoolDef(pCfg, "ReadAfterWrite", &pThis->fReadAfterWrite, false); 1336 AssertRC(rc); 1275 1337 1276 1338 char *pszIoLogFilename = NULL; … … 1297 1359 pThis->IMedia.pfnBiosSetLCHSGeometry = drvdiskintBiosSetLCHSGeometry; 1298 1360 pThis->IMedia.pfnGetUuid = drvdiskintGetUuid; 1361 pThis->IMedia.pfnGetSectorSize = drvdiskintGetSectorSize; 1299 1362 1300 1363 /* IMediaAsync */
Note:
See TracChangeset
for help on using the changeset viewer.