Changeset 22978 in vbox
- Timestamp:
- Sep 13, 2009 1:38:16 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r22966 r22978 521 521 if (pImage->pInterfaceError) 522 522 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 523 524 #ifdef VBOX_WITH_NEW_IO_CODE 525 /* Try to get async I/O interface. */ 526 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ASYNCIO); 527 AssertPtr(pImage->pInterfaceAsyncIO); 528 pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO); 529 AssertPtr(pImage->pInterfaceAsyncIOCallbacks); 530 #endif 523 531 524 532 vdiInitPreHeader(&pImage->PreHeader); -
trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp
r22977 r22978 595 595 if (RT_SUCCESS(rc)) 596 596 { 597 /* Initialize the segment cache */ 598 rc = MMR3HeapAllocZEx(pEpClassFile->Core.pVM, MM_TAG_PDM_ASYNC_COMPLETION, 599 sizeof(PDMACTASKFILE), 600 (void **)&pEpFile->pTasksFreeHead); 597 rc = RTFileGetSize(pEpFile->File, (uint64_t *)&pEpFile->cbFile); 601 598 if (RT_SUCCESS(rc)) 602 599 { 603 PPDMACEPFILEMGR pAioMgr = NULL; 604 605 pEpFile->pTasksFreeTail = pEpFile->pTasksFreeHead; 606 pEpFile->cTasksCached = 0; 607 608 if (pEpClassFile->fFailsafe) 600 /* Initialize the segment cache */ 601 rc = MMR3HeapAllocZEx(pEpClassFile->Core.pVM, MM_TAG_PDM_ASYNC_COMPLETION, 602 sizeof(PDMACTASKFILE), 603 (void **)&pEpFile->pTasksFreeHead); 604 if (RT_SUCCESS(rc)) 609 605 { 610 /* Safe mode. Every file has its own async I/O manager. */ 611 rc = pdmacFileAioMgrCreate(pEpClassFile, &pAioMgr); 612 AssertRC(rc); 613 } 614 else 615 { 616 if (fFlags & PDMACEP_FILE_FLAGS_CACHING) 606 PPDMACEPFILEMGR pAioMgr = NULL; 607 608 pEpFile->pTasksFreeTail = pEpFile->pTasksFreeHead; 609 pEpFile->cTasksCached = 0; 610 611 if (pEpClassFile->fFailsafe) 617 612 { 618 pEpFile->fCaching = true; 619 rc = pdmacFileEpCacheInit(pEpFile, pEpClassFile); 620 if (RT_FAILURE(rc)) 621 { 622 LogRel(("AIOMgr: Endpoint for \"%s\" was opened with caching but initializing cache failed. Disabled caching\n", pszUri)); 623 pEpFile->fCaching = false; 624 } 625 } 626 627 /* Check for an idling one or create new if not found */ 628 if (!pEpClassFile->pAioMgrHead) 629 { 613 /* Safe mode. Every file has its own async I/O manager. */ 630 614 rc = pdmacFileAioMgrCreate(pEpClassFile, &pAioMgr); 631 615 AssertRC(rc); … … 633 617 else 634 618 { 635 pAioMgr = pEpClassFile->pAioMgrHead; 619 if (fFlags & PDMACEP_FILE_FLAGS_CACHING) 620 { 621 pEpFile->fCaching = true; 622 rc = pdmacFileEpCacheInit(pEpFile, pEpClassFile); 623 if (RT_FAILURE(rc)) 624 { 625 LogRel(("AIOMgr: Endpoint for \"%s\" was opened with caching but initializing cache failed. Disabled caching\n", pszUri)); 626 pEpFile->fCaching = false; 627 } 628 } 629 630 /* Check for an idling one or create new if not found */ 631 if (!pEpClassFile->pAioMgrHead) 632 { 633 rc = pdmacFileAioMgrCreate(pEpClassFile, &pAioMgr); 634 AssertRC(rc); 635 } 636 else 637 { 638 pAioMgr = pEpClassFile->pAioMgrHead; 639 } 636 640 } 641 642 pEpFile->enmState = PDMASYNCCOMPLETIONENDPOINTFILESTATE_ACTIVE; 643 644 /* Assign the endpoint to the thread. */ 645 rc = pdmacFileAioMgrAddEndpoint(pAioMgr, pEpFile); 646 if (RT_FAILURE(rc)) 647 MMR3HeapFree(pEpFile->pTasksFreeHead); 637 648 } 638 639 pEpFile->enmState = PDMASYNCCOMPLETIONENDPOINTFILESTATE_ACTIVE;640 641 /* Assign the endpoint to the thread. */642 rc = pdmacFileAioMgrAddEndpoint(pAioMgr, pEpFile);643 if (RT_FAILURE(rc))644 MMR3HeapFree(pEpFile->pTasksFreeHead);645 649 } 646 650 -
trunk/src/VBox/VMM/PDMAsyncCompletionFileFailsafe.cpp
r22757 r22978 35 35 PPDMACTASKFILE pCurr = pTasks; 36 36 37 pTasks = pTasks->pNext; 38 37 39 switch (pCurr->enmTransferType) 38 40 { … … 47 49 if (pCurr->enmTransferType == PDMACTASKFILETRANSFER_READ) 48 50 { 49 if (RT_UNLIKELY((pCurr->Off + pCurr->DataSeg.cbSeg) > pEndpoint->cbFile))50 {51 ASMAtomicWriteU64(&pEndpoint->cbFile, pCurr->Off + pCurr->DataSeg.cbSeg);52 RTFileSetSize(pEndpoint->File, pCurr->Off + pCurr->DataSeg.cbSeg);53 }54 55 51 rc = RTFileReadAt(pEndpoint->File, pCurr->Off, 56 52 pCurr->DataSeg.pvSeg, … … 60 56 else 61 57 { 58 if (RT_UNLIKELY((pCurr->Off + pCurr->DataSeg.cbSeg) > pEndpoint->cbFile)) 59 { 60 ASMAtomicWriteU64(&pEndpoint->cbFile, pCurr->Off + pCurr->DataSeg.cbSeg); 61 RTFileSetSize(pEndpoint->File, pCurr->Off + pCurr->DataSeg.cbSeg); 62 } 63 62 64 rc = RTFileWriteAt(pEndpoint->File, pCurr->Off, 63 65 pCurr->DataSeg.pvSeg, … … 76 78 pCurr->pfnCompleted(pCurr, pCurr->pvUser); 77 79 pdmacFileTaskFree(pEndpoint, pCurr); 78 79 pTasks = pTasks->pNext;80 80 } 81 81
Note:
See TracChangeset
for help on using the changeset viewer.