VirtualBox

Ignore:
Timestamp:
Sep 15, 2008 7:02:54 PM (16 years ago)
Author:
vboxsync
Message:

Better fix for not working VMDK's with SATA, a missing define in the Main Makefile prevented async I/O. More checks in drvvdConstruct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r12467 r12474  
    564564    pThis->fTempReadOnly                = false;
    565565    pThis->pDisk                        = NULL;
     566    pThis->fAsyncIOSupported            = false;
    566567
    567568    /* IMedia */
     
    642643        {
    643644            /*
    644              * Though the device supports async I/O the backend seems to not support it.
     645             * Though the device supports async I/O there is no transport driver
     646             * which processes async requests.
    645647             * Revert to non async I/O.
    646648             */
     649            rc = VINF_SUCCESS;
    647650            pThis->pDrvMediaAsyncPort = NULL;
     651            pThis->fAsyncIOSupported = false;
    648652        }
    649653        else if (RT_FAILURE(rc))
     
    653657        else
    654658        {
     659            /*
     660             * The device supports async I/O and we successfully attached the transport driver.
     661             * Indicate that async I/O is supported for now as we check if the image backend supports
     662             * it later.
     663             */
     664            pThis->fAsyncIOSupported = true;
     665
    655666            /* Success query the async transport interface. */
    656667            pThis->pDrvTransportAsync = (PPDMITRANSPORTASYNC)pBase->pfnQueryInterface(pBase, PDMINTERFACE_TRANSPORT_ASYNC);
    657668            if (!pThis->pDrvTransportAsync)
    658669            {
    659                 /* Whoops. */
     670                /* An attached driver without an async transport interface - impossible. */
    660671                AssertMsgFailed(("Configuration error: No async transport interface below!\n"));
    661672                return VERR_PDM_MISSING_INTERFACE_ABOVE;
     
    670681    unsigned    iLevel = 0;
    671682    PCFGMNODE   pCurNode = pCfgHandle;
    672     rc = VINF_SUCCESS;
     683
    673684    for (;;)
    674685    {
     
    695706            break;
    696707        }
    697    
    698708
    699709        PCFGMNODE pParent = CFGMR3GetChild(pCurNode, "Parent");
     
    833843        return rc;
    834844    }
    835 
    836     /*
    837      * Check for async I/O support. Every opened image has to support
    838      * it.
    839      */
    840     pThis->fAsyncIOSupported = true;
    841     for (unsigned i = 0; i < VDGetCount(pThis->pDisk); i++)
    842     {
    843         VDBACKENDINFO vdBackendInfo;
    844 
    845         rc = VDBackendInfoSingle(pThis->pDisk, i, &vdBackendInfo);
    846         AssertRC(rc);
    847 
    848         if (vdBackendInfo.uBackendCaps & VD_CAP_ASYNC)
    849         {
    850             /*
    851              * Backend indicates support for at least some files.
    852              * Check if current file is supported with async I/O)
    853              */
    854             rc = VDImageIsAsyncIOSupported(pThis->pDisk, i, &pThis->fAsyncIOSupported);
    855             AssertRC(rc);
    856 
    857             /*
    858              * Check if current image is supported.
    859              * If not we can stop checking because
    860              * at least one does not support it.
    861              */
    862             if (!pThis->fAsyncIOSupported)
    863                 break;
    864         }
    865         else
    866         {
    867             pThis->fAsyncIOSupported = false;
    868             break;
    869         }
    870     }
    871 
    872     /* Create cache if async I/O is supported. */
    873     if (pThis->fAsyncIOSupported)
    874     {
    875         rc = RTCacheCreate(&pThis->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT);
    876         AssertMsg(RT_SUCCESS(rc), ("Failed to create cache rc=%Rrc\n", rc));
     845    else
     846    {
     847        /*
     848         * Check if every opened image supports async I/O.
     849         * If not we revert to non async I/O.
     850         */
     851        if (pThis->fAsyncIOSupported)
     852        {
     853            for (unsigned i = 0; i < VDGetCount(pThis->pDisk); i++)
     854            {
     855                VDBACKENDINFO vdBackendInfo;
     856
     857                rc = VDBackendInfoSingle(pThis->pDisk, i, &vdBackendInfo);
     858                AssertRC(rc);
     859
     860                if (vdBackendInfo.uBackendCaps & VD_CAP_ASYNC)
     861                {
     862                    /*
     863                     * Backend indicates support for at least some files.
     864                     * Check if current file is supported with async I/O)
     865                     */
     866                    rc = VDImageIsAsyncIOSupported(pThis->pDisk, i, &pThis->fAsyncIOSupported);
     867                    AssertRC(rc);
     868
     869                    /*
     870                     * Check if current image is supported.
     871                     * If not we can stop checking because
     872                     * at least one does not support it.
     873                     */
     874                    if (!pThis->fAsyncIOSupported)
     875                        break;
     876                }
     877                else
     878                {
     879                    pThis->fAsyncIOSupported = false;
     880                    break;
     881                }
     882            }
     883        }
     884
     885        /*
     886         * We know definitly if async I/O is supported now.
     887         * Create cache if it is supported.
     888         */
     889        if (pThis->fAsyncIOSupported)
     890        {
     891            rc = RTCacheCreate(&pThis->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT);
     892            AssertMsg(RT_SUCCESS(rc), ("Failed to create cache rc=%Rrc\n", rc));
     893        }
    877894    }
    878895
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette