VirtualBox

Changeset 24359 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 4, 2009 10:28:48 PM (15 years ago)
Author:
vboxsync
Message:

AsyncCompletion: CFGM key to disable the cache globally

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

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

    r24278 r24359  
    527527    if (RT_SUCCESS(rc))
    528528    {
    529         /* Init cache structure */
    530         rc = pdmacFileCacheInit(pEpClassFile, pCfgNode);
    531         if (RT_FAILURE(rc))
    532             RTCritSectDelete(&pEpClassFile->CritSect);
     529        /* Check if the cache was disabled by the user. */
     530        rc = CFGMR3QueryBoolDef(pCfgNode, "CacheEnabled", &pEpClassFile->fCacheEnabled, true);
     531        AssertLogRelRCReturn(rc, rc);
     532
     533        if (pEpClassFile->fCacheEnabled)
     534        {
     535            /* Init cache structure */
     536            rc = pdmacFileCacheInit(pEpClassFile, pCfgNode);
     537            if (RT_FAILURE(rc))
     538            {
     539                RTCritSectDelete(&pEpClassFile->CritSect);
     540                pEpClassFile->fCacheEnabled = false;
     541                LogRel(("AIOMgr: Failed to initialise the cache (rc=%Rrc), disabled caching\n"));
     542            }
     543        }
     544        else
     545            LogRel(("AIOMgr: Cache was globally disabled\n"));
    533546    }
    534547
     
    546559    while (pEpClassFile->pAioMgrHead)
    547560        pdmacFileAioMgrDestroy(pEpClassFile, pEpClassFile->pAioMgrHead);
     561
     562    /* Destroy the cache. */
     563    if (pEpClassFile->fCacheEnabled)
     564        pdmacFileCacheDestroy(pEpClassFile);
    548565
    549566    RTCritSectDelete(&pEpClassFile->CritSect);
     
    657674                else
    658675                {
    659                     if (fFlags & PDMACEP_FILE_FLAGS_CACHING)
     676                    if (   (fFlags & PDMACEP_FILE_FLAGS_CACHING)
     677                        && (pEpClassFile->fCacheEnabled))
    660678                    {
    661679                        pEpFile->fCaching = true;
  • trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp

    r24356 r24359  
    681681    /* Initialize the critical section */
    682682    rc = RTCritSectInit(&pCache->CritSect);
     683
     684    if (RT_SUCCESS(rc))
     685        LogRel(("AIOMgr: Cache successfully initialised. Cache size is %u bytes\n", pCache->cbMax));
     686
    683687    return rc;
    684688}
  • trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h

    r24356 r24359  
    332332    /** Flag whether we use the failsafe method. */
    333333    bool                                fFailsafe;
     334    /** Flag whether the file data cache is enabled. */
     335    bool                                fCacheEnabled;
    334336    /** Critical section protecting the list of async I/O managers. */
    335337    RTCRITSECT                          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