VirtualBox

Changeset 34223 in vbox


Ignore:
Timestamp:
Nov 21, 2010 11:51:36 PM (14 years ago)
Author:
vboxsync
Message:

BlockCache: Bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMBlkCache.cpp

    r34219 r34223  
    603603        return VERR_NO_MEMORY;
    604604
     605    ASMAtomicIncU32(&pReq->cXfersPending);
    605606    pIoXfer->fIoCache    = false;
    606607    pIoXfer->pReq        = pReq;
     
    945946    int rc = VINF_SUCCESS;
    946947    PPDMBLKCACHE pBlkCache = NULL;
     948    bool fAlreadyExists = false;
    947949    PPDMBLKCACHEGLOBAL pBlkCacheGlobal = pVM->pUVM->pdm.s.pBlkCacheGlobal;
    948950
     
    959961    {
    960962        if (!RTStrCmp(pBlkCache->pszId, pcszId))
     963        {
     964            fAlreadyExists = true;
    961965            break;
    962     }
    963 
    964     if (!pBlkCache)
     966        }
     967    }
     968
     969    if (!fAlreadyExists)
    965970    {
    966971        pBlkCache = (PPDMBLKCACHE)RTMemAllocZ(sizeof(PDMBLKCACHE));
     
    10451050    if (RT_SUCCESS(rc))
    10461051    {
     1052        pBlkCache->enmType = PDMBLKCACHETYPE_DRV;
    10471053        pBlkCache->u.Drv.pfnXferComplete = pfnXferComplete;
    10481054        pBlkCache->u.Drv.pfnXferEnqueue  = pfnXferEnqueue;
    10491055        pBlkCache->u.Drv.pDrvIns         = pDrvIns;
     1056        *ppBlkCache = pBlkCache;
    10501057    }
    10511058
     
    10651072    if (RT_SUCCESS(rc))
    10661073    {
     1074        pBlkCache->enmType = PDMBLKCACHETYPE_DEV;
    10671075        pBlkCache->u.Dev.pfnXferComplete = pfnXferComplete;
    10681076        pBlkCache->u.Dev.pfnXferEnqueue  = pfnXferEnqueue;
    10691077        pBlkCache->u.Dev.pDevIns         = pDevIns;
     1078        *ppBlkCache = pBlkCache;
    10701079    }
    10711080
     
    10861095    if (RT_SUCCESS(rc))
    10871096    {
     1097        pBlkCache->enmType = PDMBLKCACHETYPE_USB;
    10881098        pBlkCache->u.Usb.pfnXferComplete = pfnXferComplete;
    10891099        pBlkCache->u.Usb.pfnXferEnqueue  = pfnXferEnqueue;
    10901100        pBlkCache->u.Usb.pUsbIns         = pUsbIns;
     1101        *ppBlkCache = pBlkCache;
    10911102    }
    10921103
     
    11071118    if (RT_SUCCESS(rc))
    11081119    {
     1120        pBlkCache->enmType = PDMBLKCACHETYPE_INTERNAL;
    11091121        pBlkCache->u.Int.pfnXferComplete = pfnXferComplete;
    11101122        pBlkCache->u.Int.pfnXferEnqueue  = pfnXferEnqueue;
    11111123        pBlkCache->u.Int.pvUser          = pvUser;
     1124        *ppBlkCache = pBlkCache;
    11121125    }
    11131126
     
    14881501        return VERR_NO_MEMORY;
    14891502
     1503    ASMAtomicIncU32(&pReq->cXfersPending);
    14901504    pWaiter->pReq          = pReq;
    14911505    pWaiter->offCacheEntry = offDiff;
     
    17331747    }
    17341748
     1749    LogFlowFunc(("pReq=%#p cXfersPending=%u cbXfer=%u\n", pReq, cXfersPending, (cbOld - cbComplete)));
    17351750    return false;
    17361751}
     
    17521767    /* Allocate new request structure. */
    17531768    pReq = pdmBlkCacheReqAlloc(cbRead, pvUser);
    1754     if (RT_UNLIKELY(pReq))
     1769    if (RT_UNLIKELY(!pReq))
    17551770        return VERR_NO_MEMORY;
    17561771
     
    18181833                    /* Read as much as we can from the entry. */
    18191834                    RTSgBufCopyFromBuf(&SgBuf, pEntry->pbData + offDiff, cbToRead);
     1835                    ASMAtomicSubU32(&pReq->cbXfer, cbToRead);
    18201836                }
    18211837
     
    19671983    /* Allocate new request structure. */
    19681984    pReq = pdmBlkCacheReqAlloc(cbWrite, pvUser);
    1969     if (RT_UNLIKELY(pReq))
     1985    if (RT_UNLIKELY(!pReq))
    19701986        return VERR_NO_MEMORY;
    19711987
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