Changeset 28065 in vbox
- Timestamp:
- Apr 7, 2010 8:54:34 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxHDD.h
r27977 r28065 35 35 #include <iprt/mem.h> 36 36 #include <iprt/net.h> 37 #include <iprt/sg.h> 37 38 #include <VBox/cdefs.h> 38 39 #include <VBox/types.h> … … 589 590 */ 590 591 DECLR3CALLBACKMEMBER(int, pfnReadAsync, (void *pvUser, void *pStorage, uint64_t uOffset, 591 PC PDMDATASEG paSegments, size_t cSegments,592 PCRTSGSEG paSegments, size_t cSegments, 592 593 size_t cbRead, void *pvCompletion, 593 594 void **ppTask)); … … 607 608 */ 608 609 DECLR3CALLBACKMEMBER(int, pfnWriteAsync, (void *pvUser, void *pStorage, uint64_t uOffset, 609 PC PDMDATASEG paSegments, size_t cSegments,610 PCRTSGSEG paSegments, size_t cSegments, 610 611 size_t cbWrite, void *pvCompletion, 611 612 void **ppTask)); … … 2188 2189 */ 2189 2190 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 2190 P PDMDATASEG paSeg, unsigned cSeg,2191 PCRTSGSEG paSeg, unsigned cSeg, 2191 2192 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 2192 2193 void *pvUser1, void *pvUser2); … … 2206 2207 */ 2207 2208 VBOXDDU_DECL(int) VDAsyncWrite(PVBOXHDD pDisk, uint64_t uOffset, size_t cbWrite, 2208 P PDMDATASEG paSeg, unsigned cSeg,2209 PCRTSGSEG paSeg, unsigned cSeg, 2209 2210 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 2210 2211 void *pvUser1, void *pvUser2); -
trunk/include/VBox/pdmasynccompletion.h
r27920 r28065 35 35 #include <VBox/err.h> 36 36 #include <iprt/assert.h> 37 #include <iprt/sg.h> 37 38 38 39 RT_C_DECLS_BEGIN … … 258 259 */ 259 260 VMMR3DECL(int) PDMR3AsyncCompletionEpRead(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 260 PC PDMDATASEG paSegments, size_tcSegments,261 PCRTSGSEG paSegments, unsigned cSegments, 261 262 size_t cbRead, void *pvUser, 262 263 PPPDMASYNCCOMPLETIONTASK ppTask); … … 276 277 */ 277 278 VMMR3DECL(int) PDMR3AsyncCompletionEpWrite(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 278 PC PDMDATASEG paSegments, size_tcSegments,279 PCRTSGSEG paSegments, unsigned cSegments, 279 280 size_t cbWrite, void *pvUser, 280 281 PPPDMASYNCCOMPLETIONTASK ppTask); -
trunk/include/VBox/pdmifs.h
r28051 r28065 31 31 #define ___VBox_pdmifs_h 32 32 33 #include <iprt/sg.h> 33 34 #include <VBox/types.h> 34 35 #include <VBox/hgcmsvc.h> … … 1392 1393 * @thread Any thread. 1393 1394 */ 1394 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, P PDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));1395 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)); 1395 1396 1396 1397 /** … … 1406 1407 * @thread Any thread. 1407 1408 */ 1408 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, P PDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));1409 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser)); 1409 1410 1410 1411 } PDMIBLOCKASYNC; … … 1455 1456 * @thread Any thread. 1456 1457 */ 1457 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, P PDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));1458 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)); 1458 1459 1459 1460 /** … … 1469 1470 * @thread Any thread. 1470 1471 */ 1471 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, P PDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));1472 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser)); 1472 1473 1473 1474 } PDMIMEDIAASYNC; … … 2534 2535 uint32_t cScatterGatherEntries; 2535 2536 /** Pointer to the head of the scatter gather list. */ 2536 P PDMDATASEGpaScatterGatherHead;2537 PRTSGSEG paScatterGatherHead; 2537 2538 /** Size of the sense buffer. */ 2538 2539 uint32_t cbSenseBuffer; -
trunk/include/VBox/vscsi.h
r27901 r28065 34 34 #include <VBox/cdefs.h> 35 35 #include <VBox/types.h> 36 #include <iprt/sg.h> 36 37 37 38 RT_C_DECLS_BEGIN … … 222 223 uint32_t iLun, uint8_t *pbCDB, size_t cbCDB, 223 224 size_t cbSGList, unsigned cSGListEntries, 224 P PDMDATASEG paSGList, uint8_t *pbSense,225 PCRTSGSEG paSGList, uint8_t *pbSense, 225 226 size_t cbSense, void *pvVScsiReqUser); 226 227 … … 280 281 VBOXDDU_DECL(int) VSCSIIoReqParamsGet(VSCSIIOREQ hVScsiIoReq, uint64_t *puOffset, 281 282 size_t *pcbTransfer, unsigned *pcSeg, 282 size_t *pcbSeg, PC PDMDATASEG *ppaSeg);283 size_t *pcbSeg, PCRTSGSEG *ppaSeg); 283 284 284 285 RT_C_DECLS_END -
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r27734 r28065 257 257 uint32_t cSGListUsed; 258 258 /** Pointer to the first entry of the scatter gather list. */ 259 P PDMDATASEGpSGListHead;259 PRTSGSEG pSGListHead; 260 260 /** Number of scatter gather list entries. */ 261 261 uint32_t cSGEntries; … … 4042 4042 4043 4043 /* Allocate R3 scatter gather list. */ 4044 pAhciPortTaskState->pSGListHead = (P PDMDATASEG)RTMemAllocZ(cSGList * sizeof(PDMDATASEG));4044 pAhciPortTaskState->pSGListHead = (PRTSGSEG)RTMemAllocZ(cSGList * sizeof(RTSGSEG)); 4045 4045 if (!pAhciPortTaskState->pSGListHead) 4046 4046 return VERR_NO_MEMORY; … … 4091 4091 /* Make debugging easier. */ 4092 4092 #ifdef DEBUG 4093 memset(pAhciPortTaskState->pSGListHead, 0, pAhciPortTaskState->cSGListSize * sizeof( PDMDATASEG));4093 memset(pAhciPortTaskState->pSGListHead, 0, pAhciPortTaskState->cSGListSize * sizeof(RTSGSEG)); 4094 4094 memset(pAhciPortTaskState->paSGEntries, 0, pAhciPortTaskState->cSGListSize * sizeof(AHCIPORTTASKSTATESGENTRY)); 4095 4095 if (pAhciPortTaskState->pvBufferUnaligned) … … 4163 4163 return VERR_NO_MEMORY; 4164 4164 4165 pAhciPortTaskState->pSGListHead = (P PDMDATASEG)RTMemAllocZ(1 * sizeof(PDMDATASEG));4165 pAhciPortTaskState->pSGListHead = (PRTSGSEG)RTMemAllocZ(1 * sizeof(RTSGSEG)); 4166 4166 if (!pAhciPortTaskState->pSGListHead) 4167 4167 { … … 4245 4245 PAHCIPORTTASKSTATESGENTRY pSGInfoCurr = NULL; 4246 4246 PAHCIPORTTASKSTATESGENTRY pSGInfoPrev = NULL; 4247 P PDMDATASEGpSGEntryCurr = NULL;4248 P PDMDATASEGpSGEntryPrev = NULL;4247 PRTSGSEG pSGEntryCurr = NULL; 4248 PRTSGSEG pSGEntryPrev = NULL; 4249 4249 RTGCPHYS GCPhysBufferPageAlignedPrev = NIL_RTGCPHYS; 4250 4250 uint8_t *pu8BufferUnalignedPos = NULL; … … 4793 4793 unsigned cSGEntry = 0; 4794 4794 int cbCopied = 0; 4795 P PDMDATASEG pSGEntry = &pAhciPortTaskState->pSGListHead[cSGEntry];4795 PRTSGSEG pSGEntry = &pAhciPortTaskState->pSGListHead[cSGEntry]; 4796 4796 uint8_t *pu8Buf = (uint8_t *)pvBuf; 4797 4797 … … 5308 5308 rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState); 5309 5309 5310 if (RT_FAILURE(rc) )5310 if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS) 5311 5311 AssertMsgFailed(("%s: Failed to enqueue command %Rrc\n", __FUNCTION__, rc)); 5312 5312 } … … 5493 5493 uint64_t uOffset; 5494 5494 size_t cbTransfer; 5495 P PDMDATASEG pSegCurr;5495 PRTSGSEG pSegCurr; 5496 5496 PAHCIPORTTASKSTATESGENTRY pSGInfoCurr; 5497 5497 -
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r27660 r28065 738 738 PDMSCSIREQUEST PDMScsiRequest; 739 739 /** Data buffer segment */ 740 PDMDATASEGDataSeg;740 RTSGSEG DataSeg; 741 741 /** Pointer to the R3 sense buffer. */ 742 742 uint8_t *pbSenseBuffer; -
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r27699 r28065 331 331 uint32_t cSGListTooBig; 332 332 /** Pointer to the first entry of the scatter gather list. */ 333 P PDMDATASEGpSGListHead;333 PRTSGSEG pSGListHead; 334 334 /** How many entries would fit into the sg info list. */ 335 335 uint32_t cSGInfoSize; … … 1292 1292 { 1293 1293 unsigned cSGEntry = 0; 1294 P PDMDATASEG pSGEntry = &pTaskState->pSGListHead[cSGEntry];1294 PRTSGSEG pSGEntry = &pTaskState->pSGListHead[cSGEntry]; 1295 1295 uint8_t *pu8Buf = (uint8_t *)pvBuf; 1296 1296 … … 1362 1362 1363 1363 /* Allocate R3 scatter gather list. */ 1364 pTaskState->pSGListHead = (P PDMDATASEG)RTMemAllocZ(cSGList * sizeof(PDMDATASEG));1364 pTaskState->pSGListHead = (PRTSGSEG)RTMemAllocZ(cSGList * sizeof(RTSGSEG)); 1365 1365 if (!pTaskState->pSGListHead) 1366 1366 return VERR_NO_MEMORY; … … 1445 1445 /* Make debugging easier. */ 1446 1446 #ifdef DEBUG 1447 memset(pTaskState->pSGListHead, 0, pTaskState->cSGListSize * sizeof( PDMDATASEG));1447 memset(pTaskState->pSGListHead, 0, pTaskState->cSGListSize * sizeof(RTSGSEG)); 1448 1448 memset(pTaskState->paSGEntries, 0, pTaskState->cSGInfoSize * sizeof(LSILOGICTASKSTATESGENTRY)); 1449 1449 if (pTaskState->pvBufferUnaligned) … … 1712 1712 1713 1713 uint32_t cSGEntries; 1714 P PDMDATASEGpSGEntryCurr = pTaskState->pSGListHead;1714 PRTSGSEG pSGEntryCurr = pTaskState->pSGListHead; 1715 1715 pSGInfoCurr = pTaskState->paSGEntries; 1716 1716 -
trunk/src/VBox/Devices/Storage/DrvBlock.cpp
r27806 r28065 289 289 290 290 /** @copydoc PDMIBLOCKASYNC::pfnStartRead */ 291 static DECLCALLBACK(int) drvblockAsyncReadStart(PPDMIBLOCKASYNC pInterface, uint64_t off, P PDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)291 static DECLCALLBACK(int) drvblockAsyncReadStart(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser) 292 292 { 293 293 PDRVBLOCK pThis = PDMIBLOCKASYNC_2_DRVBLOCK(pInterface); … … 308 308 309 309 /** @copydoc PDMIBLOCKASYNC::pfnStartWrite */ 310 static DECLCALLBACK(int) drvblockAsyncWriteStart(PPDMIBLOCKASYNC pInterface, uint64_t off, P PDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser)310 static DECLCALLBACK(int) drvblockAsyncWriteStart(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser) 311 311 { 312 312 PDRVBLOCK pThis = PDMIBLOCKASYNC_2_DRVBLOCK(pInterface); -
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r27977 r28065 126 126 case VSCSIIOREQTXDIR_WRITE: 127 127 { 128 uint64_t uOffset = 0;129 size_t cbTransfer = 0;130 size_t cbSeg = 0;131 PC PDMDATASEG paSeg= NULL;132 unsigned cSeg= 0;128 uint64_t uOffset = 0; 129 size_t cbTransfer = 0; 130 size_t cbSeg = 0; 131 PCRTSGSEG paSeg = NULL; 132 unsigned cSeg = 0; 133 133 134 134 rc = VSCSIIoReqParamsGet(hVScsiIoReq, &uOffset, &cbTransfer, &cSeg, &cbSeg, … … 242 242 case VSCSIIOREQTXDIR_WRITE: 243 243 { 244 uint64_t uOffset = 0;245 size_t cbTransfer = 0;246 size_t cbSeg = 0;247 PC PDMDATASEG paSeg= NULL;248 unsigned cSeg= 0;244 uint64_t uOffset = 0; 245 size_t cbTransfer = 0; 246 size_t cbSeg = 0; 247 PCRTSGSEG paSeg = NULL; 248 unsigned cSeg = 0; 249 249 250 250 rc = VSCSIIoReqParamsGet(hVScsiIoReq, &uOffset, &cbTransfer, … … 256 256 pThis->pLed->Asserted.s.fReading = pThis->pLed->Actual.s.fReading = 1; 257 257 rc = pThis->pDrvBlockAsync->pfnStartRead(pThis->pDrvBlockAsync, uOffset, 258 (PPDMDATASEG)paSeg, cSeg, cbTransfer,258 paSeg, cSeg, cbTransfer, 259 259 hVScsiIoReq); 260 260 if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS) … … 266 266 pThis->pLed->Asserted.s.fWriting = pThis->pLed->Actual.s.fWriting = 1; 267 267 rc = pThis->pDrvBlockAsync->pfnStartWrite(pThis->pDrvBlockAsync, uOffset, 268 (PPDMDATASEG)paSeg, cSeg, cbTransfer,268 paSeg, cSeg, cbTransfer, 269 269 hVScsiIoReq); 270 270 if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS) -
trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp
r26173 r28065 111 111 { 112 112 unsigned cSGEntry = 0; 113 P PDMDATASEG pSGEntry = &pRequest->paScatterGatherHead[cSGEntry];113 PRTSGSEG pSGEntry = &pRequest->paScatterGatherHead[cSGEntry]; 114 114 uint8_t *pu8Buf = (uint8_t *)pvBuf; 115 115 -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r27977 r28065 36 36 #include <iprt/tcp.h> 37 37 #include <iprt/semaphore.h> 38 #include <iprt/sg.h> 38 39 39 40 #ifdef VBOX_WITH_INIP … … 388 389 PVBOXDISK pThis = (PVBOXDISK)pvUser; 389 390 PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage; 390 PDMDATASEG DataSeg;391 RTSGSEG DataSeg; 391 392 PPDMASYNCCOMPLETIONTASK pTask; 392 393 … … 420 421 PVBOXDISK pThis = (PVBOXDISK)pvUser; 421 422 PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage; 422 PDMDATASEG DataSeg;423 RTSGSEG DataSeg; 423 424 PPDMASYNCCOMPLETIONTASK pTask; 424 425 … … 473 474 474 475 static DECLCALLBACK(int) drvvdAsyncIOReadAsync(void *pvUser, void *pStorage, uint64_t uOffset, 475 PC PDMDATASEG paSegments, size_t cSegments,476 PCRTSGSEG paSegments, size_t cSegments, 476 477 size_t cbRead, void *pvCompletion, 477 478 void **ppTask) … … 489 490 490 491 static DECLCALLBACK(int) drvvdAsyncIOWriteAsync(void *pvUser, void *pStorage, uint64_t uOffset, 491 PC PDMDATASEG paSegments, size_t cSegments,492 PCRTSGSEG paSegments, size_t cSegments, 492 493 size_t cbWrite, void *pvCompletion, 493 494 void **ppTask) … … 1000 1001 1001 1002 static DECLCALLBACK(int) drvvdStartRead(PPDMIMEDIAASYNC pInterface, uint64_t uOffset, 1002 P PDMDATASEG paSeg, unsigned cSeg,1003 PCRTSGSEG paSeg, unsigned cSeg, 1003 1004 size_t cbRead, void *pvUser) 1004 1005 { … … 1013 1014 1014 1015 static DECLCALLBACK(int) drvvdStartWrite(PPDMIMEDIAASYNC pInterface, uint64_t uOffset, 1015 P PDMDATASEG paSeg, unsigned cSeg,1016 PCRTSGSEG paSeg, unsigned cSeg, 1016 1017 size_t cbWrite, void *pvUser) 1017 1018 { -
trunk/src/VBox/Devices/Storage/UsbMsd.cpp
r27901 r28065 143 143 PDMSCSIREQUEST ScsiReq; 144 144 /** The scatter-gather segment used by ScsiReq for describing pbBuf. */ 145 PDMDATASEGScsiReqSeg;145 RTSGSEG ScsiReqSeg; 146 146 /** The sense buffer for the current SCSI request. */ 147 147 uint8_t ScsiReqSense[64]; -
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r27977 r28065 40 40 #include <iprt/param.h> 41 41 #include <iprt/memcache.h> 42 #include <iprt/sg.h> 42 43 43 44 #include <VBox/VBoxHDD-Plugin.h> … … 191 192 typedef struct VDIOCTX 192 193 { 193 /** Completion callback */194 PFNVDASYNCTRANSFERCOMPLETE pfnComplete;195 /** User argument 1 passed on completion. */196 void *pvUser1;197 /** User argument 1 passed on completion. */198 void *pvUser2;199 194 /** Disk this is request is for. */ 200 195 PVBOXHDD pDisk; … … 207 202 /** Current offset */ 208 203 volatile uint64_t uOffset; 209 /** Pointer to the scatter/gather list. */ 210 PCPDMDATASEG paDataSeg; 211 /** Number of segments. */ 212 size_t cSeg; 213 /** Current segment we are in. */ 214 unsigned iSegIdx; 215 /** Pointer to the current buffer. */ 216 uint8_t *pbBuf; 217 /** Number of bytes left in the current buffer. */ 218 size_t cbBufLeft; 204 /** S/G buffer */ 205 RTSGBUF SgBuf; 219 206 /** How many meta data transfers are pending. */ 220 207 volatile uint32_t cMetaTransfersPending; 208 /** Flag whether the request finished */ 209 volatile bool fComplete; 210 /** Parent I/O context if any. Sets the type of the context (root/child) */ 211 PVDIOCTX pIoCtxParent; 212 /** Type dependent data (root/child) */ 213 union 214 { 215 /** Root data */ 216 struct 217 { 218 /** Completion callback */ 219 PFNVDASYNCTRANSFERCOMPLETE pfnComplete; 220 /** User argument 1 passed on completion. */ 221 void *pvUser1; 222 /** User argument 1 passed on completion. */ 223 void *pvUser2; 224 } Root; 225 /** Child data */ 226 struct 227 { 228 /** Saved start offset */ 229 uint64_t uOffsetSaved; 230 /** Saved transfer size */ 231 size_t cbTransferLeftSaved; 232 /** Number of bytes transfered from the parent if this context completes. */ 233 size_t cbTransferParent; 234 } Child; 235 } Type; 221 236 } VDIOCTX; 222 237 … … 510 525 } 511 526 512 static PVDIOCTX vdIoCtxAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 513 uint64_t uOffset, size_t cbTransfer, 514 PPDMDATASEG paSeg, unsigned cSeg, 515 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 516 void *pvUser1, void *pvUser2) 527 DECLINLINE(PVDIOCTX) vdIoCtxAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 528 uint64_t uOffset, size_t cbTransfer, 529 PCRTSGSEG pcaSeg, unsigned cSeg) 517 530 { 518 531 PVDIOCTX pIoCtx = NULL; 519 532 520 533 pIoCtx = (PVDIOCTX)RTMemCacheAlloc(pDisk->hMemCacheIoCtx); 521 if (pIoCtx) 522 { 523 pIoCtx->pfnComplete = pfnComplete; 524 pIoCtx->pvUser1 = pvUser1; 525 pIoCtx->pvUser2 = pvUser2; 526 pIoCtx->pDisk = pDisk; 527 pIoCtx->enmTxDir = enmTxDir; 528 pIoCtx->cbTransferLeft = cbTransfer; 529 pIoCtx->uOffset = uOffset; 530 pIoCtx->paDataSeg = paSeg; 531 pIoCtx->cSeg = cSeg; 532 pIoCtx->iSegIdx = 0; 533 pIoCtx->pbBuf = (uint8_t *)pIoCtx->paDataSeg[0].pvSeg; 534 pIoCtx->cbBufLeft = pIoCtx->paDataSeg[0].cbSeg; 534 if (RT_LIKELY(pIoCtx)) 535 { 536 pIoCtx->pDisk = pDisk; 537 pIoCtx->enmTxDir = enmTxDir; 538 pIoCtx->cbTransferLeft = cbTransfer; 539 pIoCtx->uOffset = uOffset; 535 540 pIoCtx->cMetaTransfersPending = 0; 541 pIoCtx->fComplete = false; 542 543 RTSgBufInit(&pIoCtx->SgBuf, pcaSeg, cSeg); 544 } 545 546 return pIoCtx; 547 } 548 549 static PVDIOCTX vdIoCtxRootAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 550 uint64_t uOffset, size_t cbTransfer, 551 PCRTSGSEG paSeg, unsigned cSeg, 552 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 553 void *pvUser1, void *pvUser2) 554 { 555 PVDIOCTX pIoCtx = vdIoCtxAlloc(pDisk, enmTxDir, uOffset, cbTransfer, 556 paSeg, cSeg); 557 558 if (RT_LIKELY(pIoCtx)) 559 { 560 pIoCtx->pIoCtxParent = NULL; 561 pIoCtx->Type.Root.pfnComplete = pfnComplete; 562 pIoCtx->Type.Root.pvUser1 = pvUser1; 563 pIoCtx->Type.Root.pvUser2 = pvUser2; 564 } 565 566 return pIoCtx; 567 } 568 569 static PVDIOCTX vdIoCtxChildAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 570 uint64_t uOffset, size_t cbTransfer, 571 PCRTSGSEG paSeg, unsigned cSeg, 572 PVDIOCTX pIoCtxParent, size_t cbTransferParent) 573 { 574 PVDIOCTX pIoCtx = vdIoCtxAlloc(pDisk, enmTxDir, uOffset, cbTransfer, 575 paSeg, cSeg); 576 577 if (RT_LIKELY(pIoCtx)) 578 { 579 pIoCtx->pIoCtxParent = pIoCtxParent; 580 pIoCtx->Type.Child.uOffsetSaved = uOffset; 581 pIoCtx->Type.Child.cbTransferLeftSaved = cbTransfer; 582 pIoCtx->Type.Child.cbTransferParent = cbTransferParent; 536 583 } 537 584 … … 583 630 } 584 631 585 static uint8_t *vdIoCtxGetBuffer(PVDIOCTX pIoCtx, size_t *pcbData) 586 { 587 size_t cbData = RT_MIN(*pcbData, pIoCtx->cbBufLeft); 588 uint8_t *pbBuf = pIoCtx->pbBuf; 589 590 pIoCtx->cbBufLeft -= cbData; 591 592 /* Advance to the next segment if required. */ 593 if (!pIoCtx->cbBufLeft) 594 { 595 pIoCtx->iSegIdx++; 596 597 if (RT_UNLIKELY(pIoCtx->iSegIdx == pIoCtx->cSeg)) 598 { 599 pIoCtx->cbBufLeft = 0; 600 pIoCtx->pbBuf = NULL; 601 } 602 else 603 { 604 pIoCtx->pbBuf = (uint8_t *)pIoCtx->paDataSeg[pIoCtx->iSegIdx].pvSeg; 605 pIoCtx->cbBufLeft = pIoCtx->paDataSeg[pIoCtx->iSegIdx].cbSeg; 606 } 607 608 *pcbData = cbData; 609 } 610 else 611 pIoCtx->pbBuf += cbData; 612 613 return pbBuf; 614 } 615 632 static void vdIoCtxChildReset(PVDIOCTX pIoCtx) 633 { 634 AssertPtr(pIoCtx->pIoCtxParent); 635 636 RTSgBufReset(&pIoCtx->SgBuf); 637 pIoCtx->uOffset = pIoCtx->Type.Child.uOffsetSaved; 638 pIoCtx->cbTransferLeft = pIoCtx->Type.Child.cbTransferLeftSaved; 639 } 640 641 static size_t vdIoCtxCopy(PVDIOCTX pIoCtxDst, PVDIOCTX pIoCtxSrc, size_t cbData) 642 { 643 return RTSgBufCopy(&pIoCtxDst->SgBuf, &pIoCtxSrc->SgBuf, cbData); 644 } 645 646 static int vdIoCtxCmp(PVDIOCTX pIoCtx1, PVDIOCTX pIoCtx2, size_t cbData) 647 { 648 return RTSgBufCmp(&pIoCtx1->SgBuf, &pIoCtx2->SgBuf, cbData); 649 } 616 650 617 651 static size_t vdIoCtxCopyTo(PVDIOCTX pIoCtx, uint8_t *pbData, size_t cbData) 618 652 { 619 size_t cbLeft = cbData; 620 621 while (cbLeft) 622 { 623 size_t cbCopy = cbLeft; 624 uint8_t *pbBuf = vdIoCtxGetBuffer(pIoCtx, &cbCopy); 625 626 if (!cbCopy) 627 break; 628 629 memcpy(pbBuf, pbData, cbCopy); 630 631 cbLeft -= cbCopy; 632 pbData += cbCopy; 633 } 634 635 return cbData - cbLeft; 653 return RTSgBufCopyToBuf(&pIoCtx->SgBuf, pbData, cbData); 636 654 } 637 655 … … 639 657 static size_t vdIoCtxCopyFrom(PVDIOCTX pIoCtx, uint8_t *pbData, size_t cbData) 640 658 { 641 size_t cbLeft = cbData; 642 643 while (cbLeft) 644 { 645 size_t cbCopy = cbData; 646 uint8_t *pbBuf = vdIoCtxGetBuffer(pIoCtx, &cbCopy); 647 648 if (!cbCopy) 649 break; 650 651 memcpy(pbData, pbBuf, cbCopy); 652 653 cbData -= cbCopy; 654 pbData += cbCopy; 655 } 656 657 return cbData - cbLeft; 658 } 659 660 static size_t vdIoCtxSet(PVDIOCTX pIoCtx, int ch, size_t cbData) 661 { 662 size_t cbLeft = cbData; 663 664 while (cbLeft) 665 { 666 size_t cbCopy = cbData; 667 uint8_t *pbBuf = vdIoCtxGetBuffer(pIoCtx, &cbCopy); 668 669 if (!cbCopy) 670 break; 671 672 memset(pbBuf, ch, cbCopy); 673 674 cbData -= cbCopy; 675 } 676 677 return cbData - cbLeft; 659 return RTSgBufCopyFromBuf(&pIoCtx->SgBuf, pbData, cbData); 660 } 661 662 static size_t vdIoCtxSet(PVDIOCTX pIoCtx, uint8_t ch, size_t cbData) 663 { 664 return RTSgBufSet(&pIoCtx->SgBuf, ch, cbData); 678 665 } 679 666 … … 720 707 /* No image in the chain contains the data for the block. */ 721 708 vdIoCtxSet(pIoCtx, '\0', cbThisRead); 709 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbThisRead); 722 710 rc = VINF_SUCCESS; 723 711 } 724 712 725 if (RT_SUCCESS(rc)) 726 { 727 /* Success and no async task is pending. */ 728 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbThisRead); 729 } 713 if (RT_FAILURE(rc)) 714 break; 730 715 731 716 cbRead -= cbThisRead; 732 717 uOffset += cbThisRead; 733 } while (cbRead != 0 && ( RT_SUCCESS(rc) 734 || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)); 718 } while (cbRead != 0 && RT_SUCCESS(rc)); 735 719 736 720 if (rc == VERR_VD_NOT_ENOUGH_METADATA) … … 1016 1000 1017 1001 /** 1002 * internal: write a complete block (only used for diff images), taking the 1003 * remaining data from parent images. This implementation does not optimize 1004 * anything (except that it tries to read only that portions from parent 1005 * images that are really needed) - async version. 1006 */ 1007 static int vdWriteHelperStandardAsync(PVBOXHDD pDisk, PVDIMAGE pImage, 1008 PVDIMAGE pImageParentOverride, 1009 uint64_t uOffset, size_t cbWrite, 1010 size_t cbThisWrite, size_t cbPreRead, 1011 size_t cbPostRead, PVDIOCTX pIoCtxSrc, 1012 PVDIOCTX pIoCtxDst) 1013 { 1014 int rc = VINF_SUCCESS; 1015 1016 /* Read the data that goes before the write to fill the block. */ 1017 if (cbPreRead) 1018 { 1019 rc = vdReadHelperAsync(pDisk, pImage, pImageParentOverride, pIoCtxDst, 1020 uOffset - cbPreRead, cbPreRead); 1021 if (RT_FAILURE(rc)) 1022 return rc; 1023 } 1024 1025 /* Copy the data to the right place in the buffer. */ 1026 vdIoCtxCopy(pIoCtxDst, pIoCtxSrc, cbThisWrite); 1027 1028 /* Read the data that goes after the write to fill the block. */ 1029 if (cbPostRead) 1030 { 1031 /* If we have data to be written, use that instead of reading 1032 * data from the image. */ 1033 size_t cbWriteCopy; 1034 if (cbWrite > cbThisWrite) 1035 cbWriteCopy = RT_MIN(cbWrite - cbThisWrite, cbPostRead); 1036 else 1037 cbWriteCopy = 0; 1038 /* Figure out how much we cannnot read from the image, because 1039 * the last block to write might exceed the nominal size of the 1040 * image for technical reasons. */ 1041 size_t cbFill; 1042 if (uOffset + cbThisWrite + cbPostRead > pDisk->cbSize) 1043 cbFill = uOffset + cbThisWrite + cbPostRead - pDisk->cbSize; 1044 else 1045 cbFill = 0; 1046 /* The rest must be read from the image. */ 1047 size_t cbReadImage = cbPostRead - cbWriteCopy - cbFill; 1048 1049 /* Now assemble the remaining data. */ 1050 if (cbWriteCopy) 1051 { 1052 vdIoCtxCopy(pIoCtxDst, pIoCtxSrc, cbWriteCopy); 1053 ASMAtomicSubU32(&pIoCtxDst->cbTransferLeft, cbWriteCopy); 1054 } 1055 1056 if (cbReadImage) 1057 rc = vdReadHelperAsync(pDisk, pImage, pImageParentOverride, pIoCtxDst, 1058 uOffset + cbThisWrite + cbWriteCopy, 1059 cbReadImage); 1060 if (RT_FAILURE(rc)) 1061 return rc; 1062 /* Zero out the remainder of this block. Will never be visible, as this 1063 * is beyond the limit of the image. */ 1064 if (cbFill) 1065 { 1066 vdIoCtxSet(pIoCtxDst, '\0', cbFill); 1067 ASMAtomicSubU32(&pIoCtxDst->cbTransferLeft, cbFill); 1068 } 1069 } 1070 1071 if ( !pIoCtxDst->cbTransferLeft 1072 && !pIoCtxDst->cMetaTransfersPending 1073 && ASMAtomicCmpXchgBool(&pIoCtxDst->fComplete, true, false)) 1074 { 1075 /* Write the full block to the virtual disk. */ 1076 vdIoCtxChildReset(pIoCtxDst); 1077 rc = pImage->Backend->pfnAsyncWrite(pImage->pvBackendData, 1078 uOffset - cbPreRead, 1079 cbPreRead + cbThisWrite + cbPostRead, 1080 pIoCtxDst, 1081 NULL, &cbPreRead, &cbPostRead, 0); 1082 Assert(rc != VERR_VD_BLOCK_FREE); 1083 Assert(cbPreRead == 0); 1084 Assert(cbPostRead == 0); 1085 } 1086 else 1087 { 1088 LogFlow(("cbTransferLeft=%u cMetaTransfersPending=%u fComplete=%RTbool\n", 1089 pIoCtxDst->cbTransferLeft, pIoCtxDst->cMetaTransfersPending, 1090 pIoCtxDst->fComplete)); 1091 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; 1092 } 1093 1094 return rc; 1095 } 1096 1097 /** 1098 * internal: write a complete block (only used for diff images), taking the 1099 * remaining data from parent images. This implementation optimizes out writes 1100 * that do not change the data relative to the state as of the parent images. 1101 * All backends which support differential/growing images support this - async version. 1102 */ 1103 static int vdWriteHelperOptimizedAsync(PVBOXHDD pDisk, PVDIMAGE pImage, 1104 PVDIMAGE pImageParentOverride, 1105 uint64_t uOffset, size_t cbWrite, 1106 size_t cbThisWrite, size_t cbPreRead, 1107 size_t cbPostRead, PVDIOCTX pIoCtxSrc, 1108 PVDIOCTX pIoCtxDst) 1109 { 1110 size_t cbFill = 0; 1111 size_t cbWriteCopy = 0; 1112 size_t cbReadImage = 0; 1113 int rc; 1114 1115 if (cbPostRead) 1116 { 1117 /* Figure out how much we cannnot read from the image, because 1118 * the last block to write might exceed the nominal size of the 1119 * image for technical reasons. */ 1120 if (uOffset + cbThisWrite + cbPostRead > pDisk->cbSize) 1121 cbFill = uOffset + cbThisWrite + cbPostRead - pDisk->cbSize; 1122 1123 /* If we have data to be written, use that instead of reading 1124 * data from the image. */ 1125 if (cbWrite > cbThisWrite) 1126 cbWriteCopy = RT_MIN(cbWrite - cbThisWrite, cbPostRead); 1127 1128 /* The rest must be read from the image. */ 1129 cbReadImage = cbPostRead - cbWriteCopy - cbFill; 1130 } 1131 1132 /* Read the entire data of the block so that we can compare whether it will 1133 * be modified by the write or not. */ 1134 rc = vdReadHelperAsync(pDisk, pImage, pImageParentOverride, pIoCtxDst, 1135 uOffset - cbPreRead, 1136 cbPreRead + cbThisWrite + cbPostRead - cbFill); 1137 if (RT_FAILURE(rc)) 1138 return rc; 1139 1140 #if 0 1141 /* Check if the write would modify anything in this block. */ 1142 if ( !memcmp((char *)pvTmp + cbPreRead, pvBuf, cbThisWrite) 1143 && (!cbWriteCopy || !memcmp((char *)pvTmp + cbPreRead + cbThisWrite, 1144 (char *)pvBuf + cbThisWrite, cbWriteCopy))) 1145 { 1146 /* Block is completely unchanged, so no need to write anything. */ 1147 return VINF_SUCCESS; 1148 } 1149 1150 /* Copy the data to the right place in the buffer. */ 1151 memcpy((char *)pvTmp + cbPreRead, pvBuf, cbThisWrite); 1152 1153 /* Handle the data that goes after the write to fill the block. */ 1154 if (cbPostRead) 1155 { 1156 /* Now assemble the remaining data. */ 1157 if (cbWriteCopy) 1158 memcpy((char *)pvTmp + cbPreRead + cbThisWrite, 1159 (char *)pvBuf + cbThisWrite, cbWriteCopy); 1160 /* Zero out the remainder of this block. Will never be visible, as this 1161 * is beyond the limit of the image. */ 1162 if (cbFill) 1163 memset((char *)pvTmp + cbPreRead + cbThisWrite + cbWriteCopy + cbReadImage, 1164 '\0', cbFill); 1165 } 1166 1167 /* Write the full block to the virtual disk. */ 1168 rc = pImage->Backend->pfnWrite(pImage->pvBackendData, 1169 uOffset - cbPreRead, pvTmp, 1170 cbPreRead + cbThisWrite + cbPostRead, 1171 NULL, &cbPreRead, &cbPostRead, 0); 1172 Assert(rc != VERR_VD_BLOCK_FREE); 1173 Assert(cbPreRead == 0); 1174 Assert(cbPostRead == 0); 1175 #endif 1176 return rc; 1177 } 1178 1179 /** 1018 1180 * internal: write buffer to the image, taking care of block boundaries and 1019 1181 * write optimizations - async version. … … 1043 1205 &cbThisWrite, &cbPreRead, 1044 1206 &cbPostRead, fWrite); 1045 #if 01046 1207 if (rc == VERR_VD_BLOCK_FREE) 1047 1208 { 1048 void *pvTmp = RTMemTmpAlloc(cbPreRead + cbThisWrite + cbPostRead); 1049 AssertBreakStmt(VALID_PTR(pvTmp), rc = VERR_NO_MEMORY); 1209 /* 1210 * Allocate segment and buffer in one go. 1211 * A bit hackish but avoids the need to allocate memory twice. 1212 */ 1213 PRTSGSEG pTmp = (PRTSGSEG)RTMemTmpAlloc(cbPreRead + cbThisWrite + cbPostRead + sizeof(RTSGSEG)); 1214 AssertBreakStmt(VALID_PTR(pTmp), rc = VERR_NO_MEMORY); 1215 1216 pTmp->pvSeg = pTmp + 1; 1217 pTmp->cbSeg = cbPreRead + cbThisWrite + cbPostRead; 1218 1219 PVDIOCTX pIoCtxWrite = vdIoCtxChildAlloc(pDisk, VDIOCTXTXDIR_WRITE, 1220 uOffset, pTmp->cbSeg, 1221 pTmp, 1, 1222 pIoCtx, cbThisWrite); 1223 if (!VALID_PTR(pIoCtxWrite)) 1224 { 1225 RTMemTmpFree(pTmp); 1226 rc = VERR_NO_MEMORY; 1227 break; 1228 } 1050 1229 1051 1230 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_HONOR_SAME)) … … 1053 1232 /* Optimized write, suppress writing to a so far unallocated 1054 1233 * block if the data is in fact not changed. */ 1055 rc = vdWriteHelperOptimized (pDisk, pImage, pImageParentOverride,1056 uOffset, cbWrite,1057 cbThisWrite, cbPreRead, cbPostRead,1058 pvBuf, pvTmp);1234 rc = vdWriteHelperOptimizedAsync(pDisk, pImage, pImageParentOverride, 1235 uOffset, cbWrite, 1236 cbThisWrite, cbPreRead, cbPostRead, 1237 pIoCtx, pIoCtxWrite); 1059 1238 } 1060 1239 else … … 1064 1243 * backend has some further optimization enabled) cause the 1065 1244 * block to be allocated. */ 1066 rc = vdWriteHelperStandard (pDisk, pImage, pImageParentOverride,1067 uOffset, cbWrite,1068 cbThisWrite, cbPreRead, cbPostRead,1069 pvBuf, pvTmp);1245 rc = vdWriteHelperStandardAsync(pDisk, pImage, pImageParentOverride, 1246 uOffset, cbWrite, 1247 cbThisWrite, cbPreRead, cbPostRead, 1248 pIoCtx, pIoCtxWrite); 1070 1249 } 1071 RTMemTmpFree(pvTmp); 1250 1072 1251 if (RT_FAILURE(rc)) 1252 { 1253 RTMemTmpFree(pTmp); 1254 vdIoCtxFree(pDisk, pIoCtxWrite); 1073 1255 break; 1074 } 1075 #endif 1076 1077 if (RT_SUCCESS(rc)) 1078 { 1079 /* Success and no async task is pending. */ 1080 Assert(rc == VINF_SUCCESS); 1081 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbThisWrite); 1082 } 1256 } 1257 1258 if ( !(pIoCtxWrite->cbTransferLeft || pIoCtxWrite->cMetaTransfersPending) 1259 && ASMAtomicCmpXchgBool(&pIoCtxWrite->fComplete, true, false)) 1260 { 1261 RTMemTmpFree(pTmp); 1262 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbThisWrite); 1263 vdIoCtxFree(pDisk, pIoCtxWrite); 1264 } 1265 } 1266 1267 if (RT_FAILURE(rc)) 1268 break; 1083 1269 1084 1270 cbWrite -= cbThisWrite; 1085 1271 uOffset += cbThisWrite; 1086 } while (cbWrite != 0 && ( RT_SUCCESS(rc) 1087 || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)); 1272 } while (cbWrite != 0 && RT_SUCCESS(rc)); 1088 1273 1089 1274 return rc; … … 1313 1498 */ 1314 1499 static int vdAsyncIOReadAsync(void *pvUser, void *pStorage, uint64_t uOffset, 1315 PC PDMDATASEG paSegments, size_t cSegments,1500 PCRTSGSEG paSegments, size_t cSegments, 1316 1501 size_t cbRead, void *pvCompletion, 1317 1502 void **ppTask) … … 1324 1509 */ 1325 1510 static int vdAsyncIOWriteAsync(void *pvUser, void *pStorage, uint64_t uOffset, 1326 PC PDMDATASEG paSegments, size_t cSegments,1511 PCRTSGSEG paSegments, size_t cSegments, 1327 1512 size_t cbWrite, void *pvCompletion, 1328 1513 void **ppTask) … … 1345 1530 PVDIOCTX pIoCtx = pIoTask->pIoCtx; 1346 1531 PVBOXHDD pDisk = pIoCtx->pDisk; 1347 uint32_t cbLeft = ASMAtomicSubU32(&pIoCtx->cbTransferLeft, pIoTask->Type.User.cbTransfer); 1348 1349 Assert(!pIoTask->fMeta); /* No meta tasks spawned at the moment. */ 1350 1351 if (cbLeft == pIoTask->Type.User.cbTransfer) 1352 { 1353 vdIoTaskFree(pDisk, pIoTask); 1354 pIoCtx->pfnComplete(pIoCtx->pvUser1, pIoCtx->pvUser2); 1532 1533 LogFlowFunc(("Task completed pIoTask=%#p pIoCtx=%#p pDisk=%#p\n", 1534 pIoTask, pIoCtx, pDisk)); 1535 1536 if (!pIoTask->fMeta) 1537 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, pIoTask->Type.User.cbTransfer); 1538 else 1539 { 1540 Assert(pIoTask->Type.Meta.enmTxDir == VDIOCTXTXDIR_WRITE); 1541 if (pIoTask->Type.Meta.pfnMetaComplete) 1542 pIoTask->Type.Meta.pfnMetaComplete(NULL, pIoTask->Type.Meta.pvMetaUser); 1543 ASMAtomicDecU32(&pIoCtx->cMetaTransfersPending); 1544 } 1545 1546 vdIoTaskFree(pDisk, pIoTask); 1547 1548 if ( !pIoCtx->cbTransferLeft 1549 && !pIoCtx->cMetaTransfersPending 1550 && ASMAtomicCmpXchgBool(&pIoCtx->fComplete, true, false)) 1551 { 1552 LogFlowFunc(("I/O context completed\n")); 1553 Assert(!pIoCtx->pIoCtxParent); 1554 pIoCtx->Type.Root.pfnComplete(pIoCtx->Type.Root.pvUser1, pIoCtx->Type.Root.pvUser2); 1355 1555 vdIoCtxFree(pDisk, pIoCtx); 1356 1556 } 1357 else1358 vdIoTaskFree(pDisk, pIoTask);1359 1557 1360 1558 return VINF_SUCCESS; … … 1459 1657 while (cbRead) 1460 1658 { 1461 PDMDATASEG aSeg[VD_IO_TASK_SEGMENTS_MAX]; 1462 unsigned cSegments = 0; 1463 unsigned cbTaskRead = 0; 1464 1465 while ( cbRead 1466 && cSegments < VD_IO_TASK_SEGMENTS_MAX) 1467 { 1468 1469 size_t cbThisSeg = cbRead; 1470 uint8_t *pbBuf = NULL; 1471 1472 pbBuf = vdIoCtxGetBuffer(pIoCtx, &cbThisSeg); 1473 1474 aSeg[cSegments].cbSeg = cbThisSeg; 1475 aSeg[cSegments].pvSeg = pbBuf; 1476 cSegments++; 1477 cbRead -= cbThisSeg; 1478 cbTaskRead += cbThisSeg; 1479 } 1659 RTSGSEG aSeg[VD_IO_TASK_SEGMENTS_MAX]; 1660 unsigned cSegments = VD_IO_TASK_SEGMENTS_MAX; 1661 size_t cbTaskRead = 0; 1662 1663 cbTaskRead = RTSgBufSegArrayCreate(&pIoCtx->SgBuf, aSeg, &cSegments, cbRead); 1480 1664 1481 1665 PVDIOTASK pIoTask = vdIoTaskUserAlloc(pDisk, pIoCtx, cbTaskRead); … … 1491 1675 &pvTask); 1492 1676 if (rc2 == VINF_SUCCESS) 1677 { 1678 AssertMsg(cbTaskRead <= pIoCtx->cbTransferLeft, ("Impossible!\n")); 1679 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbTaskRead); 1493 1680 vdIoTaskFree(pDisk, pIoTask); 1681 } 1494 1682 else if (rc2 == VERR_VD_ASYNC_IO_IN_PROGRESS) 1495 rc = V ERR_VD_ASYNC_IO_IN_PROGRESS;1683 rc = VINF_SUCCESS; 1496 1684 else if (RT_FAILURE(rc2)) 1685 { 1497 1686 rc = rc2; 1687 break; 1688 } 1498 1689 1499 1690 uOffset += cbTaskRead; … … 1513 1704 while (cbWrite) 1514 1705 { 1515 PDMDATASEG aSeg[VD_IO_TASK_SEGMENTS_MAX]; 1516 unsigned cSegments = 0; 1517 unsigned cbTaskWrite = 0; 1518 1519 while ( cbWrite 1520 && cSegments < VD_IO_TASK_SEGMENTS_MAX) 1521 { 1522 1523 size_t cbThisSeg = cbWrite; 1524 uint8_t *pbBuf = NULL; 1525 1526 pbBuf = vdIoCtxGetBuffer(pIoCtx, &cbThisSeg); 1527 1528 aSeg[cSegments].cbSeg = cbThisSeg; 1529 aSeg[cSegments].pvSeg = pbBuf; 1530 cSegments++; 1531 cbWrite -= cbThisSeg; 1532 cbTaskWrite += cbThisSeg; 1533 } 1706 RTSGSEG aSeg[VD_IO_TASK_SEGMENTS_MAX]; 1707 unsigned cSegments = VD_IO_TASK_SEGMENTS_MAX; 1708 size_t cbTaskWrite = 0; 1709 1710 cbTaskWrite = RTSgBufSegArrayCreate(&pIoCtx->SgBuf, aSeg, &cSegments, cbWrite); 1534 1711 1535 1712 PVDIOTASK pIoTask = vdIoTaskUserAlloc(pDisk, pIoCtx, cbTaskWrite); … … 1545 1722 &pvTask); 1546 1723 if (rc2 == VINF_SUCCESS) 1724 { 1725 AssertMsg(cbTaskWrite <= pIoCtx->cbTransferLeft, ("Impossible!\n")); 1726 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbTaskWrite); 1547 1727 vdIoTaskFree(pDisk, pIoTask); 1728 } 1548 1729 else if (rc2 == VERR_VD_ASYNC_IO_IN_PROGRESS) 1549 rc = V ERR_VD_ASYNC_IO_IN_PROGRESS;1730 rc = VINF_SUCCESS; 1550 1731 else if (RT_FAILURE(rc2)) 1732 { 1551 1733 rc = rc2; 1734 break; 1735 } 1552 1736 1553 1737 uOffset += cbTaskWrite; … … 1560 1744 uint64_t uOffset, void *pvBuf, 1561 1745 size_t cbRead, PVDIOCTX pIoCtx, 1562 PFNVDMETACOMPLETED pfnMetaComplete d,1746 PFNVDMETACOMPLETED pfnMetaComplete, 1563 1747 void *pvMetaUser) 1564 1748 { 1565 return VERR_NOT_IMPLEMENTED; 1566 } 1567 1568 static int vdIOWriteMetaAsync(void *pvUser, PVDIOSTORAGE pStorage, 1749 PVBOXHDD pDisk = (PVBOXHDD)pvUser; 1750 int rc = VINF_SUCCESS; 1751 RTSGSEG Seg; 1752 PVDIOTASK pIoTask; 1753 void *pvTask = NULL; 1754 1755 pIoTask = vdIoTaskMetaAlloc(pDisk, pIoCtx, VDIOCTXTXDIR_READ, 1756 pfnMetaComplete, pvMetaUser); 1757 if (!pIoTask) 1758 return VERR_NO_MEMORY; 1759 1760 Seg.cbSeg = cbRead; 1761 Seg.pvSeg = pvBuf; 1762 1763 ASMAtomicIncU32(&pIoCtx->cMetaTransfersPending); 1764 1765 int rc2 = pDisk->pInterfaceAsyncIOCallbacks->pfnReadAsync(pDisk->pInterfaceAsyncIO->pvUser, 1766 pIoStorage->u.pStorage, 1767 uOffset, &Seg, 1, 1768 cbRead, pIoTask, 1769 &pvTask); 1770 if (rc2 == VINF_SUCCESS) 1771 { 1772 ASMAtomicDecU32(&pIoCtx->cMetaTransfersPending); 1773 vdIoTaskFree(pDisk, pIoTask); 1774 } 1775 else if (rc2 == VERR_VD_ASYNC_IO_IN_PROGRESS) 1776 rc = VERR_VD_NOT_ENOUGH_METADATA; 1777 else if (RT_FAILURE(rc2)) 1778 rc = rc2; 1779 1780 return rc; 1781 } 1782 1783 static int vdIOWriteMetaAsync(void *pvUser, PVDIOSTORAGE pIoStorage, 1569 1784 uint64_t uOffset, void *pvBuf, 1570 1785 size_t cbWrite, PVDIOCTX pIoCtx, 1571 PFNVDMETACOMPLETED pfnMetaComplete d,1786 PFNVDMETACOMPLETED pfnMetaComplete, 1572 1787 void *pvMetaUser) 1573 1788 { 1574 return VERR_NOT_IMPLEMENTED; 1789 PVBOXHDD pDisk = (PVBOXHDD)pvUser; 1790 int rc = VINF_SUCCESS; 1791 RTSGSEG Seg; 1792 PVDIOTASK pIoTask; 1793 void *pvTask = NULL; 1794 1795 pIoTask = vdIoTaskMetaAlloc(pDisk, pIoCtx, VDIOCTXTXDIR_WRITE, 1796 pfnMetaComplete, pvMetaUser); 1797 if (!pIoTask) 1798 return VERR_NO_MEMORY; 1799 1800 Seg.cbSeg = cbWrite; 1801 Seg.pvSeg = pvBuf; 1802 1803 ASMAtomicIncU32(&pIoCtx->cMetaTransfersPending); 1804 1805 int rc2 = pDisk->pInterfaceAsyncIOCallbacks->pfnWriteAsync(pDisk->pInterfaceAsyncIO->pvUser, 1806 pIoStorage->u.pStorage, 1807 uOffset, &Seg, 1, 1808 cbWrite, pIoTask, 1809 &pvTask); 1810 if (rc2 == VINF_SUCCESS) 1811 { 1812 ASMAtomicDecU32(&pIoCtx->cMetaTransfersPending); 1813 vdIoTaskFree(pDisk, pIoTask); 1814 } 1815 else if (rc2 == VERR_VD_ASYNC_IO_IN_PROGRESS) 1816 rc = VINF_SUCCESS; 1817 else if (RT_FAILURE(rc2)) 1818 rc = rc2; 1819 1820 return rc; 1575 1821 } 1576 1822 … … 5247 5493 5248 5494 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 5249 P PDMDATASEG paSeg, unsigned cSeg,5495 PCRTSGSEG paSeg, unsigned cSeg, 5250 5496 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 5251 5497 void *pvUser1, void *pvUser2) … … 5284 5530 rc = VERR_INVALID_PARAMETER); 5285 5531 5286 pIoCtx = vdIoCtx Alloc(pDisk, VDIOCTXTXDIR_READ, uOffset,5287 cbRead, paSeg, cSeg,5288 pfnComplete, pvUser1, pvUser2);5532 pIoCtx = vdIoCtxRootAlloc(pDisk, VDIOCTXTXDIR_READ, uOffset, 5533 cbRead, paSeg, cSeg, 5534 pfnComplete, pvUser1, pvUser2); 5289 5535 if (!pIoCtx) 5290 5536 { … … 5305 5551 } 5306 5552 5307 if (rc == VINF_SUCCESS) 5308 { 5309 vdIoCtxFree(pDisk, pIoCtx); 5310 rc = VINF_VD_ASYNC_IO_FINISHED; 5553 if (RT_SUCCESS(rc)) 5554 { 5555 if ( !pIoCtx->cbTransferLeft 5556 && !pIoCtx->cMetaTransfersPending 5557 && ASMAtomicCmpXchgBool(&pIoCtx->fComplete, true, false)) 5558 { 5559 vdIoCtxFree(pDisk, pIoCtx); 5560 rc = VINF_VD_ASYNC_IO_FINISHED; 5561 } 5562 else 5563 { 5564 LogFlow(("cbTransferLeft=%u cMetaTransfersPending=%u fComplete=%RTbool\n", 5565 pIoCtx->cbTransferLeft, pIoCtx->cMetaTransfersPending, 5566 pIoCtx->fComplete)); 5567 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; 5568 } 5311 5569 } 5312 5570 … … 5317 5575 5318 5576 VBOXDDU_DECL(int) VDAsyncWrite(PVBOXHDD pDisk, uint64_t uOffset, size_t cbWrite, 5319 P PDMDATASEG paSeg, unsigned cSeg,5577 PCRTSGSEG paSeg, unsigned cSeg, 5320 5578 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 5321 5579 void *pvUser1, void *pvUser2) … … 5354 5612 rc = VERR_INVALID_PARAMETER); 5355 5613 5356 pIoCtx = vdIoCtx Alloc(pDisk, VDIOCTXTXDIR_READ, uOffset,5357 cbWrite, paSeg, cSeg,5358 pfnComplete, pvUser1, pvUser2);5614 pIoCtx = vdIoCtxRootAlloc(pDisk, VDIOCTXTXDIR_READ, uOffset, 5615 cbWrite, paSeg, cSeg, 5616 pfnComplete, pvUser1, pvUser2); 5359 5617 if (!pIoCtx) 5360 5618 { … … 5376 5634 } 5377 5635 5378 if (rc == VINF_SUCCESS) 5379 { 5380 vdIoCtxFree(pDisk, pIoCtx); 5381 rc = VINF_VD_ASYNC_IO_FINISHED; 5636 if (RT_SUCCESS(rc)) 5637 { 5638 if ( !pIoCtx->cbTransferLeft 5639 && !pIoCtx->cMetaTransfersPending 5640 && ASMAtomicCmpXchgBool(&pIoCtx->fComplete, true, false)) 5641 { 5642 vdIoCtxFree(pDisk, pIoCtx); 5643 rc = VINF_VD_ASYNC_IO_FINISHED; 5644 } 5645 else 5646 { 5647 LogFlow(("cbTransferLeft=%u cMetaTransfersPending=%u fComplete=%RTbool\n", 5648 pIoCtx->cbTransferLeft, pIoCtx->cMetaTransfersPending, 5649 pIoCtx->fComplete)); 5650 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; 5651 } 5382 5652 } 5383 5653 -
trunk/src/VBox/Devices/Storage/VBoxSCSI.cpp
r26495 r28065 248 248 249 249 /** Allocate scatter gather element. */ 250 pScsiRequest->paScatterGatherHead = (P PDMDATASEG)RTMemAllocZ(sizeof(PDMDATASEG) * 1); /* Only one element. */250 pScsiRequest->paScatterGatherHead = (PRTSGSEG)RTMemAllocZ(sizeof(RTSGSEG) * 1); /* Only one element. */ 251 251 if (!pScsiRequest->paScatterGatherHead) 252 252 { -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r27977 r28065 63 63 static int vdiUpdateBlockInfo(PVDIIMAGEDESC pImage, unsigned uBlock); 64 64 static void vdiFreeImage(PVDIIMAGEDESC pImage, bool fDelete); 65 65 static int vdiUpdateHeaderAsync(PVDIIMAGEDESC pImage, PVDIOCTX pIoCtx); 66 static int vdiUpdateBlockInfoAsync(PVDIIMAGEDESC pImage, unsigned uBlock, PVDIOCTX pIoCtx); 66 67 67 68 /** … … 206 207 207 208 return rc; 209 } 210 211 static int vdiFileWriteMetaAsync(PVDIIMAGEDESC pImage, uint64_t off, void *pcvBuf, size_t cbWrite, 212 PVDIOCTX pIoCtx, PFNVDMETACOMPLETED pfnMetaComplete, void *pvMetaUser) 213 { 214 return pImage->pInterfaceIOCallbacks->pfnWriteMetaAsync(pImage->pInterfaceIO->pvUser, 215 pImage->pStorage, 216 off, pcvBuf, cbWrite, pIoCtx, 217 pfnMetaComplete, pvMetaUser); 218 } 219 220 static int vdiFileReadMetaAsync(PVDIIMAGEDESC pImage, uint64_t off, void *pvBuf, size_t cbRead, 221 PVDIOCTX pIoCtx, PFNVDMETACOMPLETED pfnMetaComplete, void *pvMetaUser) 222 { 223 return pImage->pInterfaceIOCallbacks->pfnReadMetaAsync(pImage->pInterfaceIO->pvUser, 224 pImage->pStorage, 225 off, pvBuf, cbRead, pIoCtx, 226 pfnMetaComplete, pvMetaUser); 208 227 } 209 228 … … 845 864 846 865 /** 866 * Internal: Save header to file - async version. 867 */ 868 static int vdiUpdateHeaderAsync(PVDIIMAGEDESC pImage, PVDIOCTX pIoCtx) 869 { 870 int rc; 871 switch (GET_MAJOR_HEADER_VERSION(&pImage->Header)) 872 { 873 case 0: 874 rc = vdiFileWriteMetaAsync(pImage, sizeof(VDIPREHEADER), 875 &pImage->Header.u.v0, sizeof(pImage->Header.u.v0), 876 pIoCtx, NULL, NULL); 877 break; 878 case 1: 879 if (pImage->Header.u.v1plus.cbHeader < sizeof(pImage->Header.u.v1plus)) 880 rc = vdiFileWriteMetaAsync(pImage, sizeof(VDIPREHEADER), 881 &pImage->Header.u.v1, sizeof(pImage->Header.u.v1), 882 pIoCtx, NULL, NULL); 883 else 884 rc = vdiFileWriteMetaAsync(pImage, sizeof(VDIPREHEADER), 885 &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), 886 pIoCtx, NULL, NULL); 887 break; 888 default: 889 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 890 break; 891 } 892 AssertMsgRC(rc, ("vdiUpdateHeader failed, filename=\"%s\" rc=%Rrc\n", pImage->pszFilename, rc)); 893 return rc; 894 } 895 896 /** 847 897 * Internal: Save block pointer to file, save header to file. 848 898 */ … … 859 909 sizeof(VDIIMAGEBLOCKPOINTER), 860 910 NULL); 911 AssertMsgRC(rc, ("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n", 912 uBlock, pImage->pszFilename, rc)); 913 } 914 return rc; 915 } 916 917 /** 918 * Internal: Save block pointer to file, save header to file - async version. 919 */ 920 static int vdiUpdateBlockInfoAsync(PVDIIMAGEDESC pImage, unsigned uBlock, 921 PVDIOCTX pIoCtx) 922 { 923 /* Update image header. */ 924 int rc = vdiUpdateHeaderAsync(pImage, pIoCtx); 925 if (RT_SUCCESS(rc)) 926 { 927 /* write only one block pointer. */ 928 rc = vdiFileWriteMetaAsync(pImage, 929 pImage->offStartBlocks + uBlock * sizeof(VDIIMAGEBLOCKPOINTER), 930 &pImage->paBlocks[uBlock], 931 sizeof(VDIIMAGEBLOCKPOINTER), 932 pIoCtx, 933 NULL, NULL); 861 934 AssertMsgRC(rc, ("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n", 862 935 uBlock, pImage->pszFilename, rc)); … … 2125 2198 setImageBlocksAllocated(&pImage->Header, cBlocksAllocated + 1); 2126 2199 2127 /** @todo Async */ 2128 rc = vdiUpdateBlockInfo(pImage, uBlock); 2200 rc = vdiUpdateBlockInfoAsync(pImage, uBlock, pIoCtx); 2129 2201 if (RT_FAILURE(rc)) 2130 2202 goto out; -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIDevice.cpp
r27665 r28065 312 312 uint32_t iLun, uint8_t *pbCDB, size_t cbCDB, 313 313 size_t cbSGList, unsigned cSGListEntries, 314 P PDMDATASEG paSGList, uint8_t *pbSense,314 PCRTSGSEG paSGList, uint8_t *pbSense, 315 315 size_t cbSense, void *pvVScsiReqUser) 316 316 { -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h
r27653 r28065 88 88 { 89 89 /** Pointer to the scatter/gather list. */ 90 PC PDMDATASEGpaDataSeg;90 PCRTSGSEG paDataSeg; 91 91 /** Number of segments. */ 92 92 size_t cSegments; … … 142 142 unsigned cSeg; 143 143 /** Segment array. */ 144 PC PDMDATASEGpaSeg;144 PCRTSGSEG paSeg; 145 145 } VSCSIIOREQINT; 146 146 … … 207 207 * @param cSegments Number of segments in the S/G list. 208 208 */ 209 void vscsiIoMemCtxInit(PVSCSIIOMEMCTX pIoMemCtx, PC PDMDATASEG paDataSeg, size_t cSegments);209 void vscsiIoMemCtxInit(PVSCSIIOMEMCTX pIoMemCtx, PCRTSGSEG paDataSeg, size_t cSegments); 210 210 211 211 /** -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIIoReq.cpp
r27671 r28065 142 142 VBOXDDU_DECL(int) VSCSIIoReqParamsGet(VSCSIIOREQ hVScsiIoReq, uint64_t *puOffset, 143 143 size_t *pcbTransfer, unsigned *pcSeg, 144 size_t *pcbSeg, PC PDMDATASEG *ppaSeg)144 size_t *pcbSeg, PCRTSGSEG *ppaSeg) 145 145 { 146 146 PVSCSIIOREQINT pVScsiIoReq = hVScsiIoReq; -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSISgBuf.cpp
r27976 r28065 27 27 28 28 29 void vscsiIoMemCtxInit(PVSCSIIOMEMCTX pIoMemCtx, PC PDMDATASEG paDataSeg, size_t cSegments)29 void vscsiIoMemCtxInit(PVSCSIIOMEMCTX pIoMemCtx, PCRTSGSEG paDataSeg, size_t cSegments) 30 30 { 31 31 if (RT_UNLIKELY(!cSegments)) -
trunk/src/VBox/VMM/PDMAsyncCompletion.cpp
r27920 r28065 1117 1117 1118 1118 VMMR3DECL(int) PDMR3AsyncCompletionEpRead(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 1119 PC PDMDATASEG paSegments, size_tcSegments,1119 PCRTSGSEG paSegments, unsigned cSegments, 1120 1120 size_t cbRead, void *pvUser, 1121 1121 PPPDMASYNCCOMPLETIONTASK ppTask) … … 1149 1149 1150 1150 VMMR3DECL(int) PDMR3AsyncCompletionEpWrite(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 1151 PC PDMDATASEG paSegments, size_tcSegments,1151 PCRTSGSEG paSegments, unsigned cSegments, 1152 1152 size_t cbWrite, void *pvUser, 1153 1153 PPPDMASYNCCOMPLETIONTASK ppTask) -
trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp
r27978 r28065 284 284 int pdmacFileEpTaskInitiate(PPDMASYNCCOMPLETIONTASK pTask, 285 285 PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 286 PC PDMDATASEG paSegments, size_t cSegments,286 PCRTSGSEG paSegments, size_t cSegments, 287 287 size_t cbTransfer, PDMACTASKFILETRANSFER enmTransfer) 288 288 { … … 968 968 static int pdmacFileEpRead(PPDMASYNCCOMPLETIONTASK pTask, 969 969 PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 970 PC PDMDATASEG paSegments, size_t cSegments,970 PCRTSGSEG paSegments, size_t cSegments, 971 971 size_t cbRead) 972 972 { … … 990 990 static int pdmacFileEpWrite(PPDMASYNCCOMPLETIONTASK pTask, 991 991 PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 992 PC PDMDATASEG paSegments, size_t cSegments,992 PCRTSGSEG paSegments, size_t cSegments, 993 993 size_t cbWrite) 994 994 { -
trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp
r27921 r28065 43 43 { 44 44 /** Pointer to the scatter/gather list. */ 45 PC PDMDATASEGpaDataSeg;45 PCRTSGSEG paDataSeg; 46 46 /** Number of segments. */ 47 47 size_t cSegments; … … 118 118 * @param cSegments Number of segments in the S/G list. 119 119 */ 120 DECLINLINE(void) pdmIoMemCtxInit(PPDMIOMEMCTX pIoMemCtx, PC PDMDATASEG paDataSeg, size_t cSegments)120 DECLINLINE(void) pdmIoMemCtxInit(PPDMIOMEMCTX pIoMemCtx, PCRTSGSEG paDataSeg, size_t cSegments) 121 121 { 122 122 AssertMsg((cSegments > 0) && paDataSeg, ("Trying to initialize a I/O memory context without a S/G list\n")); … … 1711 1711 */ 1712 1712 int pdmacFileEpCacheRead(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask, 1713 RTFOFF off, PC PDMDATASEG paSegments, size_t cSegments,1713 RTFOFF off, PCRTSGSEG paSegments, size_t cSegments, 1714 1714 size_t cbRead) 1715 1715 { … … 1945 1945 */ 1946 1946 int pdmacFileEpCacheWrite(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask, 1947 RTFOFF off, PC PDMDATASEG paSegments, size_t cSegments,1947 RTFOFF off, PCRTSGSEG paSegments, size_t cSegments, 1948 1948 size_t cbWrite) 1949 1949 { -
trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h
r27920 r28065 403 403 RTLISTNODE NodeCacheEndpoint; 404 404 #ifdef VBOX_WITH_STATISTICS 405 /** Alignment */ 406 bool afAlignment[3]; 405 407 /** Number of times a write was deferred because the cache entry was still in progress */ 406 408 STAMCOUNTER StatWriteDeferred; … … 520 522 */ 521 523 volatile uint64_t cbFile; 522 /** Flag whether caching is enabled for this file. */523 bool fCaching;524 /** Flag whether the file was opened readonly. */525 bool fReadonly;526 524 /** List of new tasks. */ 527 525 R3PTRTYPE(volatile PPDMACTASKFILE) pTasksNewHead; … … 544 542 PPDMACTASKFILE pFlushReq; 545 543 546 /** Event sempahore for blocking external events.547 * The caller waits on it until the async I/O manager548 * finished processing the event. */549 RTSEMEVENT EventSemBlock;550 /** Flag whether a blocking event is pending and needs551 * processing by the I/O manager. */552 bool fBlockingEventPending;553 /** Blocking event type */554 PDMACEPFILEBLOCKINGEVENT enmBlockingEvent;555 556 544 #ifdef VBOX_WITH_STATISTICS 557 545 /** Time spend in a read. */ … … 560 548 STAMPROFILEADV StatWrite; 561 549 #endif 550 551 /** Event sempahore for blocking external events. 552 * The caller waits on it until the async I/O manager 553 * finished processing the event. */ 554 RTSEMEVENT EventSemBlock; 555 /** Flag whether caching is enabled for this file. */ 556 bool fCaching; 557 /** Flag whether the file was opened readonly. */ 558 bool fReadonly; 559 /** Flag whether a blocking event is pending and needs 560 * processing by the I/O manager. */ 561 bool fBlockingEventPending; 562 /** Blocking event type */ 563 PDMACEPFILEBLOCKINGEVENT enmBlockingEvent; 562 564 563 565 /** Additional data needed for the event types. */ … … 640 642 RTFOFF Off; 641 643 /** Data segment. */ 642 PDMDATASEGDataSeg;644 RTSGSEG DataSeg; 643 645 /** Flag whether this segment uses a bounce buffer 644 646 * because the provided buffer doesn't meet host requirements. */ … … 698 700 699 701 int pdmacFileEpCacheRead(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask, 700 RTFOFF off, PC PDMDATASEG paSegments, size_t cSegments,702 RTFOFF off, PCRTSGSEG paSegments, size_t cSegments, 701 703 size_t cbRead); 702 704 int pdmacFileEpCacheWrite(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask, 703 RTFOFF off, PC PDMDATASEG paSegments, size_t cSegments,705 RTFOFF off, PCRTSGSEG paSegments, size_t cSegments, 704 706 size_t cbWrite); 705 707 int pdmacFileEpCacheFlush(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask); -
trunk/src/VBox/VMM/PDMAsyncCompletionInternal.h
r27920 r28065 26 26 #include <iprt/critsect.h> 27 27 #include <iprt/memcache.h> 28 #include <iprt/sg.h> 28 29 #include <VBox/types.h> 29 30 #include <VBox/cfgm.h> … … 114 115 DECLR3CALLBACKMEMBER(int, pfnEpRead, (PPDMASYNCCOMPLETIONTASK pTask, 115 116 PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 116 PC PDMDATASEG paSegments, size_t cSegments,117 PCRTSGSEG paSegments, size_t cSegments, 117 118 size_t cbRead)); 118 119 … … 130 131 DECLR3CALLBACKMEMBER(int, pfnEpWrite, (PPDMASYNCCOMPLETIONTASK pTask, 131 132 PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, 132 PC PDMDATASEG paSegments, size_t cSegments,133 PCRTSGSEG paSegments, size_t cSegments, 133 134 size_t cbWrite)); 134 135 -
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp
r27920 r28065 180 180 { 181 181 size_t cbRead = ((size_t)offSrc + BUFFER_SIZE) <= cbSrc ? BUFFER_SIZE : cbSrc - offSrc; 182 PDMDATASEG DataSeg;182 RTSGSEG DataSeg; 183 183 184 184 DataSeg.pvSeg = g_AsyncCompletionTasksBuffer[i]; … … 200 200 { 201 201 size_t cbWrite = (offDst + BUFFER_SIZE) <= cbSrc ? BUFFER_SIZE : cbSrc - offDst; 202 PDMDATASEG DataSeg;202 RTSGSEG DataSeg; 203 203 204 204 DataSeg.pvSeg = g_AsyncCompletionTasksBuffer[i]; -
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletionStress.cpp
r27920 r28065 114 114 RTFOFF off; 115 115 /** Data segment */ 116 PDMDATASEGDataSeg;116 RTSGSEG DataSeg; 117 117 /** Task handle. */ 118 118 PPDMASYNCCOMPLETIONTASK hTask;
Note:
See TracChangeset
for help on using the changeset viewer.