Changeset 28947 in vbox
- Timestamp:
- Apr 30, 2010 9:17:27 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp
r28800 r28947 21 21 *******************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_PDM_ASYNC_COMPLETION 23 //#define DEBUG24 23 #include "PDMInternal.h" 25 24 #include <VBox/pdm.h> … … 259 258 PPDMASYNCCOMPLETIONTASKFILE pTaskFile = (PPDMASYNCCOMPLETIONTASKFILE)pvUser; 260 259 260 LogFlowFunc(("pTask=%#p pvUser=%#p rc=%Rrc\n", pTask, pvUser, rc)); 261 261 262 if (pTask->enmTransferType == PDMACTASKFILETRANSFER_FLUSH) 262 263 { … … 276 277 pdmR3AsyncCompletionCompleteTask(&pTaskFile->Core, pTaskFile->rc, true); 277 278 } 279 } 280 281 DECLINLINE(void) pdmacFileEpTaskInit(PPDMASYNCCOMPLETIONTASK pTask, size_t cbTransfer) 282 { 283 PPDMASYNCCOMPLETIONTASKFILE pTaskFile = (PPDMASYNCCOMPLETIONTASKFILE)pTask; 284 285 Assert((uint32_t)cbTransfer == cbTransfer && (int32_t)cbTransfer >= 0); 286 ASMAtomicWriteS32(&pTaskFile->cbTransferLeft, (int32_t)cbTransfer); 287 ASMAtomicWriteBool(&pTaskFile->fCompleted, false); 288 ASMAtomicWriteS32(&pTaskFile->rc, VINF_SUCCESS); 278 289 } 279 290 … … 290 301 Assert( (enmTransfer == PDMACTASKFILETRANSFER_READ) 291 302 || (enmTransfer == PDMACTASKFILETRANSFER_WRITE)); 292 293 Assert((uint32_t)cbTransfer == cbTransfer && (int32_t)cbTransfer >= 0);294 ASMAtomicWriteS32(&pTaskFile->cbTransferLeft, (int32_t)cbTransfer);295 ASMAtomicWriteBool(&pTaskFile->fCompleted, false);296 ASMAtomicWriteS32(&pTaskFile->rc, VINF_SUCCESS);297 303 298 304 for (unsigned i = 0; i < cSegments; i++) … … 970 976 PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEndpoint; 971 977 978 LogFlowFunc(("pTask=%#p pEndpoint=%#p off=%RTfoff paSegments=%#p cSegments=%zu cbRead=%zu\n", 979 pTask, pEndpoint, off, paSegments, cSegments, cbRead)); 980 972 981 STAM_PROFILE_ADV_START(&pEpFile->StatRead, Read); 982 983 pdmacFileEpTaskInit(pTask, cbRead); 973 984 974 985 if (pEpFile->fCaching) … … 996 1007 997 1008 STAM_PROFILE_ADV_START(&pEpFile->StatWrite, Write); 1009 1010 pdmacFileEpTaskInit(pTask, cbWrite); 998 1011 999 1012 if (pEpFile->fCaching) -
trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp
r28800 r28947 1722 1722 pEndpoint, pEndpoint->Core.pszUri, pTask, off, paSegments, cSegments, cbRead)); 1723 1723 1724 pTask->cbTransferLeft = cbRead;1725 pTask->rc = VINF_SUCCESS;1726 1724 /* Set to completed to make sure that the task is valid while we access it. */ 1727 1725 ASMAtomicWriteBool(&pTask->fCompleted, true); … … 1956 1954 pEndpoint, pEndpoint->Core.pszUri, pTask, off, paSegments, cSegments, cbWrite)); 1957 1955 1958 pTask->cbTransferLeft = cbWrite;1959 pTask->rc = VINF_SUCCESS;1960 1956 /* Set to completed to make sure that the task is valid while we access it. */ 1961 1957 ASMAtomicWriteBool(&pTask->fCompleted, true); -
trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp
r28884 r28947 446 446 447 447 pEndpoint->AioMgr.pReqsPendingTail = pTaskHead; 448 pTaskHead->pNext = NULL; 448 449 } 449 450 … … 466 467 467 468 pEndpoint->AioMgr.pReqsPendingTail = pTask; 469 pTask->pNext = NULL; 468 470 } 469 471 … … 560 562 561 563 if (pTask->cbBounceBuffer) 562 RTMem Free(pTask->pvBounceBuffer);564 RTMemPageFree(pTask->pvBounceBuffer, pTask->cbBounceBuffer); 563 565 564 566 pTask->fPrefetch = false; 567 pTask->cbBounceBuffer = 0; 565 568 566 569 /* Free the lock and process pending tasks if neccessary */ … … 1391 1394 1392 1395 /* Call completion callback */ 1396 LogFlow(("Task=%#p completed with %Rrc\n", pTask, rcReq)); 1393 1397 pTask->pfnCompleted(pTask, pTask->pvUser, rcReq); 1394 1398 pdmacFileTaskFree(pEndpoint, pTask); … … 1445 1449 1446 1450 while ( (pAioMgr->enmState == PDMACEPFILEMGRSTATE_RUNNING) 1447 || (pAioMgr->enmState == PDMACEPFILEMGRSTATE_SUSPENDING)) 1448 { 1449 ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, true); 1450 if (!ASMAtomicReadBool(&pAioMgr->fWokenUp)) 1451 rc = RTSemEventWait(pAioMgr->EventSem, RT_INDEFINITE_WAIT); 1452 ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, false); 1453 AssertRC(rc); 1454 1455 LogFlow(("Got woken up\n")); 1456 ASMAtomicWriteBool(&pAioMgr->fWokenUp, false); 1451 || (pAioMgr->enmState == PDMACEPFILEMGRSTATE_SUSPENDING) 1452 || (pAioMgr->enmState == PDMACEPFILEMGRSTATE_GROWING)) 1453 { 1454 if (!pAioMgr->cRequestsActive) 1455 { 1456 ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, true); 1457 if (!ASMAtomicReadBool(&pAioMgr->fWokenUp)) 1458 rc = RTSemEventWait(pAioMgr->EventSem, RT_INDEFINITE_WAIT); 1459 ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, false); 1460 AssertRC(rc); 1461 1462 LogFlow(("Got woken up\n")); 1463 ASMAtomicWriteBool(&pAioMgr->fWokenUp, false); 1464 } 1457 1465 1458 1466 /* Check for an external blocking event first. */ … … 1463 1471 } 1464 1472 1465 if (RT_LIKELY(pAioMgr->enmState == PDMACEPFILEMGRSTATE_RUNNING)) 1473 if (RT_LIKELY( pAioMgr->enmState == PDMACEPFILEMGRSTATE_RUNNING 1474 || pAioMgr->enmState == PDMACEPFILEMGRSTATE_GROWING)) 1466 1475 { 1467 1476 /* We got woken up because an endpoint issued new requests. Queue them. */ … … 1546 1555 AssertRC(rc); 1547 1556 Assert(pAioMgr->enmState == PDMACEPFILEMGRSTATE_RUNNING); 1557 1558 rc = pdmacFileAioMgrNormalCheckEndpoints(pAioMgr); 1559 CHECK_RC(pAioMgr, rc); 1548 1560 } 1549 1561 } /* if still running */ 1550 1562 } /* while running */ 1551 1563 1564 LogFlowFunc(("rc=%Rrc\n", rc)); 1552 1565 return rc; 1553 1566 }
Note:
See TracChangeset
for help on using the changeset viewer.