Changeset 2948 for trunk/src/lib/nt


Ignore:
Timestamp:
Sep 20, 2016, 5:36:07 PM (9 years ago)
Author:
bird
Message:

kWorker/kDep: save a few header stat calls while optimizing dependencies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/nt/kFsCache.c

    r2944 r2948  
    8989
    9090
     91
     92/*********************************************************************************************************************************
     93*   Internal Functions                                                                                                           *
     94*********************************************************************************************************************************/
     95static KBOOL kFsCacheRefreshObj(PKFSCACHE pCache, PKFSOBJ pObj, KFSLOOKUPERROR *penmError);
    9196
    9297
     
    12571262    else if (pDir->fPopulated)
    12581263    {
    1259         KU32  cAllocated = K_ALIGN_Z(pDir->cChildren, 16);
    1260         void *pvNew      = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated);
     1264        KU32  cAllocated;
     1265        void *pvNew;
     1266
     1267        /* Make sure we really need to do this first. */
     1268        if (!pDir->fNeedRePopulating)
     1269        {
     1270            if (   pDir->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE
     1271                || pDir->Obj.uCacheGen == pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN])
     1272                return K_TRUE;
     1273            if (   kFsCacheRefreshObj(pCache, &pDir->Obj, penmError)
     1274                && !pDir->fNeedRePopulating)
     1275                return K_TRUE;
     1276        }
     1277
     1278        /* Yes we do need to. */
     1279        cAllocated = K_ALIGN_Z(pDir->cChildren, 16);
     1280        pvNew      = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated);
    12611281        if (pvNew)
    12621282        {
     
    16081628        && (pDir->Obj.fFlags & KFSOBJ_F_WORKING_DIR_MTIME) )
    16091629    {
    1610         MY_IO_STATUS_BLOCK          Ios;
    1611         MY_FILE_BASIC_INFORMATION   BasicInfo;
    1612         MY_NTSTATUS                 rcNt;
    1613 
    1614         Ios.Information = -1;
    1615         Ios.u.Status    = -1;
    1616 
    1617         rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation);
    1618         if (MY_NT_SUCCESS(rcNt))
    1619             return BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite;
     1630        if (!pDir->fNeedRePopulating)
     1631        {
     1632            MY_IO_STATUS_BLOCK          Ios;
     1633            MY_FILE_BASIC_INFORMATION   BasicInfo;
     1634            MY_NTSTATUS                 rcNt;
     1635
     1636            Ios.Information = -1;
     1637            Ios.u.Status    = -1;
     1638
     1639            rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation);
     1640            if (MY_NT_SUCCESS(rcNt))
     1641            {
     1642                if (BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite)
     1643                {
     1644                    pDir->fNeedRePopulating = K_TRUE;
     1645                    return K_TRUE;
     1646                }
     1647                return K_FALSE;
     1648            }
     1649        }
    16201650    }
    16211651    /* The cache root never changes. */
Note: See TracChangeset for help on using the changeset viewer.