Changeset 51749 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Jun 27, 2014 8:38:04 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
r51619 r51749 196 196 /** Flag whether to do a immediate read after write for verification. */ 197 197 bool fReadAfterWrite; 198 /** Flag whether to record the data to write before the write completed successfully. 199 * Useful in case the data is modified in place later on (encryption for instance). */ 200 bool fRecordWriteBeforeCompletion; 198 201 199 202 /** I/O logger to use if enabled. */ … … 819 822 } 820 823 824 if (pThis->fRecordWriteBeforeCompletion) 825 { 826 RTSGSEG Seg; 827 Seg.cbSeg = cbWrite; 828 Seg.pvSeg = (void *)pvBuf; 829 830 rc = drvdiskintWriteRecord(pThis, &Seg, 1, off, cbWrite); 831 if (RT_FAILURE(rc)) 832 return rc; 833 } 834 821 835 rc = pThis->pDrvMedia->pfnWrite(pThis->pDrvMedia, off, pvBuf, cbWrite); 822 836 … … 830 844 return rc; 831 845 832 if (pThis->fCheckConsistency) 846 if ( pThis->fCheckConsistency 847 && !pThis->fRecordWriteBeforeCompletion) 833 848 { 834 849 /* Record the write. */ … … 918 933 } 919 934 935 if (pThis->fRecordWriteBeforeCompletion) 936 { 937 int rc2 = drvdiskintWriteRecord(pThis, paSeg, cSeg, uOffset, cbWrite); 938 AssertRC(rc2); 939 } 940 920 941 int rc = pThis->pDrvMediaAsync->pfnStartWrite(pThis->pDrvMediaAsync, uOffset, paSeg, cSeg, 921 942 cbWrite, pIoReq); … … 923 944 { 924 945 /* Record the write. */ 925 if (pThis->fCheckConsistency) 946 if ( pThis->fCheckConsistency 947 && !pThis->fRecordWriteBeforeCompletion) 926 948 { 927 949 int rc2 = drvdiskintWriteRecord(pThis, paSeg, cSeg, uOffset, cbWrite); … … 1153 1175 if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_READ) 1154 1176 rc = drvdiskintReadVerify(pThis, pIoReq->paSeg, pIoReq->cSeg, pIoReq->off, pIoReq->cbTransfer); 1155 else if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_WRITE) 1177 else if ( pIoReq->enmTxDir == DRVDISKAIOTXDIR_WRITE 1178 && !pThis->fRecordWriteBeforeCompletion) 1156 1179 rc = drvdiskintWriteRecord(pThis, pIoReq->paSeg, pIoReq->cSeg, pIoReq->off, pIoReq->cbTransfer); 1157 1180 else if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_DISCARD) … … 1160 1183 rc = drvdiskintReadAfterWriteVerify(pThis, pIoReq); 1161 1184 else 1162 AssertMsg(pIoReq->enmTxDir == DRVDISKAIOTXDIR_FLUSH, ("Huh?\n")); 1185 AssertMsg( pIoReq->enmTxDir == DRVDISKAIOTXDIR_FLUSH 1186 || ( pIoReq->enmTxDir == DRVDISKAIOTXDIR_WRITE 1187 && pThis->fRecordWriteBeforeCompletion), ("Huh?\n")); 1163 1188 1164 1189 AssertRC(rc); … … 1316 1341 "IoLog\0" 1317 1342 "PrepopulateRamDisk\0" 1318 "ReadAfterWrite\0")) 1343 "ReadAfterWrite\0" 1344 "RecordWriteBeforeCompletion\0")) 1319 1345 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1320 1346 … … 1334 1360 AssertRC(rc); 1335 1361 rc = CFGMR3QueryBoolDef(pCfg, "ReadAfterWrite", &pThis->fReadAfterWrite, false); 1362 AssertRC(rc); 1363 rc = CFGMR3QueryBoolDef(pCfg, "RecordWriteBeforeCompletion", &pThis->fRecordWriteBeforeCompletion, false); 1336 1364 AssertRC(rc); 1337 1365
Note:
See TracChangeset
for help on using the changeset viewer.