VirtualBox

Changeset 38562 in vbox


Ignore:
Timestamp:
Aug 29, 2011 7:26:32 PM (13 years ago)
Author:
vboxsync
Message:

QED: Bug fixes

File:
1 edited

Legend:

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

    r38469 r38562  
    309309static void qedHdrConvertFromHostEndianess(PQEDIMAGE pImage, PQedHeader pHeader)
    310310{
    311     pHeader->u32Magic                 = RT_LE2H_U32(QED_MAGIC);
    312     pHeader->u32ClusterSize           = RT_LE2H_U32(pImage->cbCluster);
    313     pHeader->u32TableSize             = RT_LE2H_U32(pImage->cbTable / pImage->cbCluster);
    314     pHeader->u32HeaderSize            = RT_LE2H_U32(1);
    315     pHeader->u64FeatureFlags          = RT_LE2H_U64(pImage->pszBackingFilename ? QED_FEATURE_BACKING_FILE : 0);
    316     pHeader->u64CompatFeatureFlags    = RT_LE2H_U64(0);
    317     pHeader->u64AutoresetFeatureFlags = RT_LE2H_U64(0);
    318     pHeader->u64OffL1Table            = RT_LE2H_U64(pImage->offL1Table);
    319     pHeader->u64Size                  = RT_LE2H_U64(pImage->cbSize);
    320     pHeader->u32OffBackingFilename    = RT_LE2H_U32(pImage->offBackingFilename);
    321     pHeader->u32BackingFilenameSize   = RT_LE2H_U32(pImage->cbBackingFilename);
     311    pHeader->u32Magic                 = RT_H2LE_U32(QED_MAGIC);
     312    pHeader->u32ClusterSize           = RT_H2LE_U32(pImage->cbCluster);
     313    pHeader->u32TableSize             = RT_H2LE_U32(pImage->cbTable / pImage->cbCluster);
     314    pHeader->u32HeaderSize            = RT_H2LE_U32(1);
     315    pHeader->u64FeatureFlags          = RT_H2LE_U64(pImage->pszBackingFilename ? QED_FEATURE_BACKING_FILE : 0);
     316    pHeader->u64CompatFeatureFlags    = RT_H2LE_U64(0);
     317    pHeader->u64AutoresetFeatureFlags = RT_H2LE_U64(0);
     318    pHeader->u64OffL1Table            = RT_H2LE_U64(pImage->offL1Table);
     319    pHeader->u64Size                  = RT_H2LE_U64(pImage->cbSize);
     320    pHeader->u32OffBackingFilename    = RT_H2LE_U32(pImage->offBackingFilename);
     321    pHeader->u32BackingFilenameSize   = RT_H2LE_U32(pImage->cbBackingFilename);
    322322}
    323323
     
    532532    {
    533533        /* Insert into search list. */
    534         RTListForEach(&pImage->ListSearch, pIt, QEDL2CACHEENTRY, NodeSearch)
    535         {
    536             Assert(pIt->offL2Tbl != pL2Entry->offL2Tbl);
    537             if (pIt->offL2Tbl < pL2Entry->offL2Tbl)
     534        pIt = RTListGetFirst(&pImage->ListSearch, QEDL2CACHEENTRY, NodeSearch);
     535        if (pIt->offL2Tbl > pL2Entry->offL2Tbl)
     536            RTListPrepend(&pImage->ListSearch, &pL2Entry->NodeSearch);
     537        else
     538        {
     539            bool fInserted = false;
     540
     541            RTListForEach(&pImage->ListSearch, pIt, QEDL2CACHEENTRY, NodeSearch)
    538542            {
    539                 RTListNodeInsertAfter(&pIt->NodeSearch, &pL2Entry->NodeSearch);
    540                 break;
     543                Assert(pIt->offL2Tbl != pL2Entry->offL2Tbl);
     544                if (pIt->offL2Tbl < pL2Entry->offL2Tbl)
     545                {
     546                    RTListNodeInsertAfter(&pIt->NodeSearch, &pL2Entry->NodeSearch);
     547                    fInserted = true;
     548                    break;
     549                }
    541550            }
     551             Assert(fInserted);
    542552        }
    543553    }
     
    575585            {
    576586#if defined(RT_BIG_ENDIAN)
    577                 qedTableConvertToHostEndianness(pL2Entry->paL2Tbl, pImage->cTableEntries);
     587                qedTableConvertToHostEndianess(pL2Entry->paL2Tbl, pImage->cTableEntries);
    578588#endif
    579589                qedL2TblCacheEntryInsert(pImage, pL2Entry);
    580590            }
    581591            else
     592            {
     593                qedL2TblCacheEntryRelease(pL2Entry);
    582594                qedL2TblCacheEntryFree(pImage, pL2Entry);
     595            }
    583596        }
    584597        else
     
    628641                vdIfIoIntMetaXferRelease(pImage->pIfIo, pMetaXfer);
    629642#if defined(RT_BIG_ENDIAN)
    630                 qedTableConvertToHostEndianness(pL2Entry->paL2Tbl, pImage->cTableEntries);
     643                qedTableConvertToHostEndianess(pL2Entry->paL2Tbl, pImage->cTableEntries);
    631644#endif
    632645                qedL2TblCacheEntryInsert(pImage, pL2Entry);
     
    857870        if (paL1TblImg)
    858871        {
    859             qedTableConvertFromHostEndianess(p1L1TblImg, pImage->paL1Table,
     872            qedTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table,
    860873                                             pImage->cTableEntries);
    861874            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
     
    906919        if (paL1TblImg)
    907920        {
    908             qedTableConvertFromHostEndianess(p1L1TblImg, pImage->paL1Table,
     921            qedTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table,
    909922                                             pImage->cTableEntries);
    910923            rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
     
    14231436            qedL2TblCacheEntryRelease(pClusterAlloc->pL2Entry); /* Release L2 cache entry. */
    14241437            qedL2TblCacheEntryFree(pImage, pClusterAlloc->pL2Entry); /* Free it, it is not in the cache yet. */
     1438            break;
    14251439        }
    14261440        case QEDCLUSTERASYNCALLOCSTATE_USER_ALLOC:
     
    14301444            rc = vdIfIoIntFileSetSize(pImage->pIfIo, pImage->pStorage, pClusterAlloc->cbImageOld);
    14311445            qedL2TblCacheEntryRelease(pClusterAlloc->pL2Entry); /* Release L2 cache entry. */
     1446            break;
    14321447        }
    14331448        default:
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