Changeset 28224 in vbox for trunk/src/VBox
- Timestamp:
- Apr 12, 2010 7:45:20 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h
r28065 r28224 159 159 /** Number of requests active currently. */ 160 160 unsigned cRequestsActive; 161 /** Number of maximum requests active. */ 162 uint32_t cRequestsActiveMax; 161 163 /** Pointer to an array of free async I/O request handles. */ 162 164 RTFILEAIOREQ *pahReqsFree; -
trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp
r28045 r28224 43 43 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint); 44 44 45 static PPDMACTASKFILE pdmacFileAioMgrNormalRangeLockFree(PPDMACEPFILEMGR pAioMgr, 46 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, 47 PPDMACFILERANGELOCK pRangeLock); 45 48 46 49 int pdmacFileAioMgrNormalInit(PPDMACEPFILEMGR pAioMgr) 47 50 { 48 51 int rc = VINF_SUCCESS; 52 53 pAioMgr->cRequestsActiveMax = PDMACEPFILEMGR_REQS_MAX; 49 54 50 55 rc = RTFileAioCtxCreate(&pAioMgr->hAioCtx, RTFILEAIO_UNLIMITED_REQS); … … 57 62 pAioMgr->iFreeEntryNext = 0; 58 63 pAioMgr->iFreeReqNext = 0; 59 pAioMgr->cReqEntries = PDMACEPFILEMGR_REQS_MAX+ 1;64 pAioMgr->cReqEntries = pAioMgr->cRequestsActiveMax + 1; 60 65 pAioMgr->pahReqsFree = (RTFILEAIOREQ *)RTMemAllocZ(pAioMgr->cReqEntries * sizeof(RTFILEAIOREQ)); 61 66 … … 421 426 422 427 PPDMACTASKFILE pTask = (PPDMACTASKFILE)RTFileAioReqGetUser(pahReqs[i]); 428 PPDMACTASKFILE pTasksWaiting; 423 429 424 430 /* Put the entry on the free array */ … … 426 432 pAioMgr->iFreeEntryNext = (pAioMgr->iFreeEntryNext + 1) % pAioMgr->cReqEntries; 427 433 434 if (pTask->fBounceBuffer) 435 RTMemFree(pTask->pvBounceBuffer); 436 437 pTask->fPrefetch = false; 438 439 /* Free the lock and process pending tasks if neccessary */ 440 pTasksWaiting = pdmacFileAioMgrNormalRangeLockFree(pAioMgr, pEndpoint, pTask->pRangeLock); 441 428 442 pdmacFileAioMgrEpAddTask(pEndpoint, pTask); 443 pdmacFileAioMgrEpAddTaskList(pEndpoint, pTasksWaiting); 444 429 445 pAioMgr->cRequestsActive--; 430 446 pEndpoint->AioMgr.cRequestsActive--; 431 447 } 432 } 448 449 pAioMgr->cRequestsActiveMax = pAioMgr->cRequestsActive; 450 } 451 433 452 LogFlow(("Removed requests. I/O manager has a total of %d active requests now\n", pAioMgr->cRequestsActive)); 434 453 LogFlow(("Endpoint has a total of %d active requests now\n", pEndpoint->AioMgr.cRequestsActive)); … … 549 568 } 550 569 551 static intpdmacFileAioMgrNormalRangeLockFree(PPDMACEPFILEMGR pAioMgr,552 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint,553 PPDMACFILERANGELOCK pRangeLock)570 static PPDMACTASKFILE pdmacFileAioMgrNormalRangeLockFree(PPDMACEPFILEMGR pAioMgr, 571 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, 572 PPDMACFILERANGELOCK pRangeLock) 554 573 { 555 574 PPDMACTASKFILE pTasksWaitingHead; … … 564 583 RTMemCacheFree(pAioMgr->hMemCacheRangeLocks, pRangeLock); 565 584 566 return p dmacFileAioMgrNormalProcessTaskList(pTasksWaitingHead, pAioMgr, pEndpoint);585 return pTasksWaitingHead; 567 586 } 568 587 … … 783 802 RTFILEAIOREQ apReqs[20]; 784 803 unsigned cRequests = 0; 785 unsigned cMaxRequests = PDMACEPFILEMGR_REQS_MAX- pAioMgr->cRequestsActive;804 unsigned cMaxRequests = pAioMgr->cRequestsActiveMax - pAioMgr->cRequestsActive; 786 805 int rc = VINF_SUCCESS; 787 806 … … 792 811 while ( pTaskHead 793 812 && !pEndpoint->pFlushReq 794 && ( cMaxRequests > 0)813 && (pAioMgr->cRequestsActive + cRequests < pAioMgr->cRequestsActiveMax) 795 814 && RT_SUCCESS(rc)) 796 815 { … … 845 864 apReqs[cRequests] = hReq; 846 865 pEndpoint->AioMgr.cReqsProcessed++; 847 cMaxRequests--;848 866 cRequests++; 849 867 if (cRequests == RT_ELEMENTS(apReqs)) … … 874 892 pdmacFileAioMgrEpAddTaskList(pEndpoint, pTaskHead); 875 893 876 if (RT_UNLIKELY( !cMaxRequests877 && !pEndpoint->pFlushReq878 && !pAioMgr->fBwLimitReached))894 if (RT_UNLIKELY( pAioMgr->cRequestsActiveMax == pAioMgr->cRequestsActive 895 && !pEndpoint->pFlushReq 896 && !pAioMgr->fBwLimitReached)) 879 897 { 880 898 /* … … 1102 1120 int rcReq = RTFileAioReqGetRC(hReq, &cbTransfered); 1103 1121 PPDMACTASKFILE pTask = (PPDMACTASKFILE)RTFileAioReqGetUser(hReq); 1122 PPDMACTASKFILE pTasksWaiting; 1104 1123 1105 1124 pEndpoint = pTask->pEndpoint; … … 1118 1137 1119 1138 /* Free the lock and process pending tasks if neccessary */ 1120 pdmacFileAioMgrNormalRangeLockFree(pAioMgr, pEndpoint, pTask->pRangeLock); 1139 pTasksWaiting = pdmacFileAioMgrNormalRangeLockFree(pAioMgr, pEndpoint, pTask->pRangeLock); 1140 rc = pdmacFileAioMgrNormalProcessTaskList(pTasksWaiting, pAioMgr, pEndpoint); 1141 AssertRC(rc); 1121 1142 1122 1143 pAioMgr->cRequestsActive--; … … 1216 1237 1217 1238 /* Free the lock and process pending tasks if neccessary */ 1218 pdmacFileAioMgrNormalRangeLockFree(pAioMgr, pEndpoint, pTask->pRangeLock); 1239 pTasksWaiting = pdmacFileAioMgrNormalRangeLockFree(pAioMgr, pEndpoint, pTask->pRangeLock); 1240 rc = pdmacFileAioMgrNormalProcessTaskList(pTasksWaiting, pAioMgr, pEndpoint); 1241 AssertRC(rc); 1219 1242 1220 1243 /* Call completion callback */
Note:
See TracChangeset
for help on using the changeset viewer.