Changeset 27280 in vbox
- Timestamp:
- Mar 11, 2010 12:55:06 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h
r26814 r27280 34 34 #include <iprt/list.h> 35 35 #include <iprt/spinlock.h> 36 #include <iprt/memcache.h> 36 37 37 38 #include "PDMAsyncCompletionInternal.h" … … 153 154 /** Flag whether at least one endpoint reached its bandwidth limit. */ 154 155 bool fBwLimitReached; 156 /** Memory cache for file range locks. */ 157 RTMEMCACHE hMemCacheRangeLocks; 155 158 /** Critical section protecting the blocking event handling. */ 156 159 RTCRITSECT CritSectBlockingEvent; -
trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp
r26689 r27280 62 62 if (pAioMgr->pahReqsFree) 63 63 { 64 return VINF_SUCCESS; 64 /* Create the range lock memcache. */ 65 rc = RTMemCacheCreate(&pAioMgr->hMemCacheRangeLocks, sizeof(PDMACFILERANGELOCK), 66 0, UINT32_MAX, NULL, NULL, NULL, 0); 67 if (RT_SUCCESS(rc)) 68 return VINF_SUCCESS; 69 70 RTMemFree(pAioMgr->pahReqsFree); 65 71 } 66 72 else … … 85 91 86 92 RTMemFree(pAioMgr->pahReqsFree); 93 RTMemCacheDestroy(pAioMgr->hMemCacheRangeLocks); 87 94 } 88 95 … … 511 518 } 512 519 513 static int pdmacFileAioMgrNormalRangeLock(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, 520 static int pdmacFileAioMgrNormalRangeLock(PPDMACEPFILEMGR pAioMgr, 521 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, 514 522 RTFOFF offStart, size_t cbRange, 515 523 PPDMACTASKFILE pTask) … … 519 527 offStart, cbRange)); 520 528 521 PPDMACFILERANGELOCK pRangeLock = (PPDMACFILERANGELOCK)RTMem AllocZ(sizeof(PDMACFILERANGELOCK));529 PPDMACFILERANGELOCK pRangeLock = (PPDMACFILERANGELOCK)RTMemCacheAlloc(pAioMgr->hMemCacheRangeLocks); 522 530 if (!pRangeLock) 523 531 return VERR_NO_MEMORY; … … 549 557 RTAvlrFileOffsetRemove(pEndpoint->AioMgr.pTreeRangesLocked, pRangeLock->Core.Key); 550 558 pTasksWaitingHead = pRangeLock->pWaitingTasksHead; 551 RTMem Free(pRangeLock);559 RTMemCacheFree(pAioMgr->hMemCacheRangeLocks, pRangeLock); 552 560 553 561 return pdmacFileAioMgrNormalProcessTaskList(pTasksWaitingHead, pAioMgr, pEndpoint); … … 595 603 * which checks whether a range is already used will add the task) 596 604 * 597 * This is neccessary because of the requirement to align all requests to a 512 boundary605 * This is neccessary because of the requirement to align all requests to a 512 boundary 598 606 * which is enforced by the host OS (Linux and Windows atm). It is possible that 599 607 * we have to process unaligned tasks and need to align them using bounce buffers. 600 * While the data is fet eched from the file another request might arrive writing to608 * While the data is fetched from the file another request might arrive writing to 601 609 * the same range. This will result in data corruption if both are executed concurrently. 602 610 */ … … 671 679 AssertRC(rc); 672 680 673 rc = pdmacFileAioMgrNormalRangeLock(p Endpoint, offStart, cbToTransfer, pTask);681 rc = pdmacFileAioMgrNormalRangeLock(pAioMgr, pEndpoint, offStart, cbToTransfer, pTask); 674 682 675 683 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.