VirtualBox

Changeset 25271 in vbox


Ignore:
Timestamp:
Dec 9, 2009 2:55:54 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
55808
Message:

PDMAsyncCompletionFileCache.cpp: warnings and don't release pEntryBestFit until after using it.

File:
1 edited

Legend:

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

    r25147 r25271  
    992992
    993993    RTSemRWRequestRead(pEndpointCache->SemRWEntries, RT_INDEFINITE_WAIT);
    994     pEntry = (PPDMACFILECACHEENTRY)RTAvlrFileOffsetGetBestFit(pEndpointCache->pTree, off, true);
     994    pEntry = (PPDMACFILECACHEENTRY)RTAvlrFileOffsetGetBestFit(pEndpointCache->pTree, off, true /*fAbove*/);
    995995    if (pEntry)
    996996        pdmacFileEpCacheEntryRef(pEntry);
     
    10251025 * @param   pbBuffer  Pointer to the buffer to use.
    10261026 *                    NULL if a new buffer should be allocated.
    1027  *                    The buffer needs to have the same size of the entry. 
     1027 *                    The buffer needs to have the same size of the entry.
    10281028 */
    10291029static PPDMACFILECACHEENTRY pdmacFileCacheEntryAlloc(PPDMACFILECACHEGLOBAL pCache,
     
    13131313                /* Move the entry to Am and fetch it to the cache. */
    13141314                pdmacFileCacheEntryAddToList(&pCache->LruFrequentlyUsed, pEntry);
    1315                 RTCritSectLeave(&pCache->CritSect);               
     1315                RTCritSectLeave(&pCache->CritSect);
    13161316#else
    13171317                RTCritSectEnter(&pCache->CritSect);
     
    13691369                     pEntryBestFit ? pEntryBestFit->cbData : 0));
    13701370
    1371             if (pEntryBestFit && ((off + (RTFOFF)cbRead) > pEntryBestFit->Core.Key))
     1371            if (    pEntryBestFit
     1372                &&  off + (RTFOFF)cbRead > pEntryBestFit->Core.Key)
    13721373            {
    13731374                cbToRead = pEntryBestFit->Core.Key - off;
     
    13771378            else
    13781379            {
    1379                  if (pEntryBestFit)
    1380                     pdmacFileEpCacheEntryRelease(pEntryBestFit);
    1381 
    13821380                /*
    13831381                 * Align the size to a 4KB boundary.
     
    13861384                 * (For example reads with a size of 512 bytes.
    13871385                 */
    1388                 cbToRead = cbRead; 
     1386                cbToRead = cbRead;
    13891387                cbToReadAligned = RT_ALIGN_Z(cbRead, PAGE_SIZE);
    13901388
     
    13921390                cbToReadAligned = RT_MIN(pEndpoint->cbFile - off, cbToReadAligned);
    13931391                if (pEntryBestFit)
    1394                     cbToReadAligned = RT_MIN(cbToReadAligned, pEntryBestFit->Core.Key - off);
     1392                {
     1393                    Assert(pEntryBestFit->Core.Key >= off);
     1394                    cbToReadAligned = RT_MIN(cbToReadAligned, (uint64_t)pEntryBestFit->Core.Key - off);
     1395                    pdmacFileEpCacheEntryRelease(pEntryBestFit);
     1396                }
    13951397            }
    13961398
     
    17531755                /* Move the entry to Am and fetch it to the cache. */
    17541756                pdmacFileCacheEntryAddToList(&pCache->LruFrequentlyUsed, pEntry);
    1755                 RTCritSectLeave(&pCache->CritSect);               
     1757                RTCritSectLeave(&pCache->CritSect);
    17561758#else
    17571759                RTCritSectEnter(&pCache->CritSect);
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