Changeset 36001 in vbox
- Timestamp:
- Feb 16, 2011 9:21:39 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmasynccompletion.h
r35361 r36001 228 228 * @{ */ 229 229 /** Open the file in read-only mode. */ 230 #define PDMACEP_FILE_FLAGS_READ_ONLY RT_BIT_32(0)230 #define PDMACEP_FILE_FLAGS_READ_ONLY RT_BIT_32(0) 231 231 /** Whether the file should not be write protected. 232 232 * The default is to protect the file against writes by other processes … … 234 234 * concurrent access which can occur if the local writeback cache is enabled. 235 235 */ 236 #define PDMACEP_FILE_FLAGS_DONT_LOCK RT_BIT_32(2) 236 #define PDMACEP_FILE_FLAGS_DONT_LOCK RT_BIT_32(2) 237 /** Open the endpoint with the host cache enabled. */ 238 #define PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED RT_BIT_32(3) 237 239 /** @} */ 238 240 -
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletion.cpp
r35346 r36001 1191 1191 1192 1192 /* Check that the flags are valid. */ 1193 AssertReturn(((~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK ) & fFlags) == 0),1193 AssertReturn(((~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK | PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED) & fFlags) == 0), 1194 1194 VERR_INVALID_PARAMETER); 1195 1195 -
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
r35696 r36001 431 431 else 432 432 pAioMgrNew->enmMgrType = pEpClass->enmMgrTypeOverride; 433 434 pAioMgrNew->msBwLimitExpired = RT_INDEFINITE_WAIT; 433 435 434 436 rc = RTSemEventCreate(&pAioMgrNew->EventSem); … … 863 865 PDMACFILEEPBACKEND enmEpBackend = pEpClassFile->enmEpBackendDefault; 864 866 865 AssertMsgReturn((fFlags & ~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK )) == 0,867 AssertMsgReturn((fFlags & ~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK | PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED)) == 0, 866 868 ("PDMAsyncCompletion: Invalid flag specified\n"), VERR_INVALID_PARAMETER); 867 869 868 870 unsigned fFileFlags = RTFILE_O_OPEN; 871 872 /* 873 * Revert to the simple manager and the buffered backend if 874 * the host cache should be enabled. 875 */ 876 if (fFlags & PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED) 877 { 878 enmMgrType = PDMACEPFILEMGRTYPE_SIMPLE; 879 enmEpBackend = PDMACFILEEPBACKEND_BUFFERED; 880 } 869 881 870 882 if (fFlags & PDMACEP_FILE_FLAGS_READ_ONLY) -
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp
r35333 r36001 27 27 #include "PDMAsyncCompletionFileInternal.h" 28 28 29 30 static int pdmacFileAioMgrFailsafeProcessEndpointTaskList(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, 29 /** 30 * Put a list of tasks in the pending request list of an endpoint. 31 */ 32 DECLINLINE(void) pdmacFileAioMgrEpAddTaskList(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMACTASKFILE pTaskHead) 33 { 34 /* Add the rest of the tasks to the pending list */ 35 if (!pEndpoint->AioMgr.pReqsPendingHead) 36 { 37 Assert(!pEndpoint->AioMgr.pReqsPendingTail); 38 pEndpoint->AioMgr.pReqsPendingHead = pTaskHead; 39 } 40 else 41 { 42 Assert(pEndpoint->AioMgr.pReqsPendingTail); 43 pEndpoint->AioMgr.pReqsPendingTail->pNext = pTaskHead; 44 } 45 46 /* Update the tail. */ 47 while (pTaskHead->pNext) 48 pTaskHead = pTaskHead->pNext; 49 50 pEndpoint->AioMgr.pReqsPendingTail = pTaskHead; 51 pTaskHead->pNext = NULL; 52 } 53 54 /** 55 * Processes a given task list for assigned to the given endpoint. 56 */ 57 static int pdmacFileAioMgrFailsafeProcessEndpointTaskList(PPDMACEPFILEMGR pAioMgr, 58 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, 31 59 PPDMACTASKFILE pTasks) 32 60 { … … 35 63 while (pTasks) 36 64 { 65 RTMSINTERVAL msWhenNext; 37 66 PPDMACTASKFILE pCurr = pTasks; 67 68 if (!pdmacEpIsTransferAllowed(&pEndpoint->Core, (uint32_t)pCurr->DataSeg.cbSeg, &msWhenNext)) 69 { 70 pAioMgr->msBwLimitExpired = RT_MIN(pAioMgr->msBwLimitExpired, msWhenNext); 71 break; 72 } 38 73 39 74 pTasks = pTasks->pNext; … … 80 115 } 81 116 117 if (pTasks) 118 { 119 /* Add the rest of the tasks to the pending list */ 120 pdmacFileAioMgrEpAddTaskList(pEndpoint, pTasks); 121 } 122 82 123 return VINF_SUCCESS; 83 124 } 84 125 85 static int pdmacFileAioMgrFailsafeProcessEndpoint(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint) 126 static int pdmacFileAioMgrFailsafeProcessEndpoint(PPDMACEPFILEMGR pAioMgr, 127 PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint) 86 128 { 87 129 int rc = VINF_SUCCESS; … … 93 135 /* Process the request pending list first in case the endpoint was migrated due to an error. */ 94 136 if (pTasks) 95 rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(p Endpoint, pTasks);137 rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(pAioMgr, pEndpoint, pTasks); 96 138 97 139 if (RT_SUCCESS(rc)) … … 100 142 101 143 if (pTasks) 102 rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(p Endpoint, pTasks);144 rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(pAioMgr, pEndpoint, pTasks); 103 145 } 104 146 … … 120 162 ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, true); 121 163 if (!ASMAtomicReadBool(&pAioMgr->fWokenUp)) 122 rc = RTSemEventWait(pAioMgr->EventSem, RT_INDEFINITE_WAIT);164 rc = RTSemEventWait(pAioMgr->EventSem, pAioMgr->msBwLimitExpired); 123 165 ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, false); 124 Assert RC(rc);166 Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); 125 167 126 168 LogFlow(("Got woken up\n")); … … 131 173 while (pEndpoint) 132 174 { 133 rc = pdmacFileAioMgrFailsafeProcessEndpoint(pEndpoint); 175 pAioMgr->msBwLimitExpired = RT_INDEFINITE_WAIT; 176 rc = pdmacFileAioMgrFailsafeProcessEndpoint(pAioMgr, pEndpoint); 134 177 AssertRC(rc); 135 178 pEndpoint = pEndpoint->AioMgr.pEndpointNext; … … 160 203 * if the endpoint was migrated from another endpoint. 161 204 */ 162 rc = pdmacFileAioMgrFailsafeProcessEndpoint(p EndpointNew);205 rc = pdmacFileAioMgrFailsafeProcessEndpoint(pAioMgr, pEndpointNew); 163 206 AssertRC(rc); 164 207 break; … … 193 236 194 237 /* Make sure all tasks finished. */ 195 rc = pdmacFileAioMgrFailsafeProcessEndpoint(p EndpointClose);238 rc = pdmacFileAioMgrFailsafeProcessEndpoint(pAioMgr, pEndpointClose); 196 239 AssertRC(rc); 197 240 break; -
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp
r35333 r36001 62 62 pAioMgr->cReqEntries = pAioMgr->cRequestsActiveMax; 63 63 pAioMgr->pahReqsFree = (RTFILEAIOREQ *)RTMemAllocZ(pAioMgr->cReqEntries * sizeof(RTFILEAIOREQ)); 64 pAioMgr->msBwLimitExpired = RT_INDEFINITE_WAIT;65 64 66 65 if (pAioMgr->pahReqsFree)
Note:
See TracChangeset
for help on using the changeset viewer.