VirtualBox

Changeset 64832 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 12, 2016 11:53:14 AM (8 years ago)
Author:
vboxsync
Message:

Storage/QED: Apply the fix as done to QCOW as they share the same issue (see r112215)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/QED.cpp

    r64766 r64832  
    207207    uint32_t            cL2Shift;
    208208
     209    /** Pointer to the L2 table we are currently allocating
     210     * (can be only one at a time). */
     211    PQEDL2CACHEENTRY    pL2TblAlloc;
     212
    209213    /** Memory occupied by the L2 table cache. */
    210214    size_t              cbL2Cache;
     
    418422static PQEDL2CACHEENTRY qedL2TblCacheRetain(PQEDIMAGE pImage, uint64_t offL2Tbl)
    419423{
     424    if (   pImage->pL2TblAlloc
     425        && pImage->pL2TblAlloc->offL2Tbl == offL2Tbl)
     426    {
     427        pImage->pL2TblAlloc->cRefs++;
     428        return pImage->pL2TblAlloc;
     429    }
     430
    420431    PQEDL2CACHEENTRY pL2Entry;
    421432    RTListForEach(&pImage->ListSearch, pL2Entry, QEDL2CACHEENTRY, NodeSearch)
     
    13281339            /* Revert the L1 table entry */
    13291340            pImage->paL1Table[pClusterAlloc->idxL1] = 0;
     1341            pImage->pL2TblAlloc = NULL;
    13301342
    13311343            /* Assumption right now is that the L1 table is not modified on storage if the link fails. */
    13321344            rc = vdIfIoIntFileSetSize(pImage->pIfIo, pImage->pStorage, pClusterAlloc->cbImageOld);
    13331345            qedL2TblCacheEntryRelease(pClusterAlloc->pL2Entry); /* Release L2 cache entry. */
     1346            Assert(!pClusterAlloc->pL2Entry->cRefs);
    13341347            qedL2TblCacheEntryFree(pImage, pClusterAlloc->pL2Entry); /* Free it, it is not in the cache yet. */
    13351348            break;
     
    13991412            uint64_t offData = qedClusterAllocate(pImage, 1);
    14001413
     1414            pImage->pL2TblAlloc = NULL;
    14011415            qedL2TblCacheEntryInsert(pImage, pClusterAlloc->pL2Entry);
    14021416
     
    17691783                        pL2ClusterAlloc->cbToWrite     = cbToWrite;
    17701784                        pL2ClusterAlloc->pL2Entry      = pL2Entry;
     1785
     1786                        pImage->pL2TblAlloc = pL2Entry;
     1787
     1788                        LogFlowFunc(("Allocating new L2 table at cluster offset %llu\n", offL2Tbl));
    17711789
    17721790                        /*
     
    17911809                    else
    17921810                    {
     1811                        LogFlowFunc(("Fetching L2 table at cluster offset %llu\n", pImage->paL1Table[idxL1]));
     1812
    17931813                        rc = qedL2TblCacheFetchAsync(pImage, pIoCtx, pImage->paL1Table[idxL1],
    17941814                                                     &pL2Entry);
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