Changeset 38562 in vbox
- Timestamp:
- Aug 29, 2011 7:26:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/QED.cpp
r38469 r38562 309 309 static void qedHdrConvertFromHostEndianess(PQEDIMAGE pImage, PQedHeader pHeader) 310 310 { 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); 322 322 } 323 323 … … 532 532 { 533 533 /* 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) 538 542 { 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 } 541 550 } 551 Assert(fInserted); 542 552 } 543 553 } … … 575 585 { 576 586 #if defined(RT_BIG_ENDIAN) 577 qedTableConvertToHostEndian ness(pL2Entry->paL2Tbl, pImage->cTableEntries);587 qedTableConvertToHostEndianess(pL2Entry->paL2Tbl, pImage->cTableEntries); 578 588 #endif 579 589 qedL2TblCacheEntryInsert(pImage, pL2Entry); 580 590 } 581 591 else 592 { 593 qedL2TblCacheEntryRelease(pL2Entry); 582 594 qedL2TblCacheEntryFree(pImage, pL2Entry); 595 } 583 596 } 584 597 else … … 628 641 vdIfIoIntMetaXferRelease(pImage->pIfIo, pMetaXfer); 629 642 #if defined(RT_BIG_ENDIAN) 630 qedTableConvertToHostEndian ness(pL2Entry->paL2Tbl, pImage->cTableEntries);643 qedTableConvertToHostEndianess(pL2Entry->paL2Tbl, pImage->cTableEntries); 631 644 #endif 632 645 qedL2TblCacheEntryInsert(pImage, pL2Entry); … … 857 870 if (paL1TblImg) 858 871 { 859 qedTableConvertFromHostEndianess(p 1L1TblImg, pImage->paL1Table,872 qedTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table, 860 873 pImage->cTableEntries); 861 874 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, … … 906 919 if (paL1TblImg) 907 920 { 908 qedTableConvertFromHostEndianess(p 1L1TblImg, pImage->paL1Table,921 qedTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table, 909 922 pImage->cTableEntries); 910 923 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage, … … 1423 1436 qedL2TblCacheEntryRelease(pClusterAlloc->pL2Entry); /* Release L2 cache entry. */ 1424 1437 qedL2TblCacheEntryFree(pImage, pClusterAlloc->pL2Entry); /* Free it, it is not in the cache yet. */ 1438 break; 1425 1439 } 1426 1440 case QEDCLUSTERASYNCALLOCSTATE_USER_ALLOC: … … 1430 1444 rc = vdIfIoIntFileSetSize(pImage->pIfIo, pImage->pStorage, pClusterAlloc->cbImageOld); 1431 1445 qedL2TblCacheEntryRelease(pClusterAlloc->pL2Entry); /* Release L2 cache entry. */ 1446 break; 1432 1447 } 1433 1448 default:
Note:
See TracChangeset
for help on using the changeset viewer.