- Timestamp:
- Jun 12, 2020 11:36:10 AM (5 years ago)
- Location:
- trunk/src/lib/nt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/kFsCache.c
r3379 r3381 64 64 # define KFSCACHE_LOG2(a) do { } while (0) 65 65 #endif 66 67 /** The minimum time between a directory last populated time and its 68 * modification time for the cache to consider it up-to-date. 69 * 70 * This helps work around races between us reading a directory and someone else 71 * adding / removing files and directories to /from it. Given that the 72 * effective time resolution typically is around 2000Hz these days, unless you 73 * use the new *TimePrecise API variants, there is plenty of room for a race 74 * here. 75 * 76 * The current value is 20ms in NT time units (100ns each), which translates 77 * to a 50Hz time update frequency. */ 78 #define KFSCACHE_MIN_LAST_POPULATED_VS_WRITE (20*1000*10) 66 79 67 80 … … 662 675 pDirObj->uDevNo = pParent->uDevNo; 663 676 pDirObj->iLastWrite = 0; 677 pDirObj->iLastPopulated = 0; 664 678 pDirObj->fPopulated = K_FALSE; 665 679 } … … 1316 1330 KFSDIRREPOP DirRePop = { NULL, 0, 0, 0, NULL }; 1317 1331 MY_UNICODE_STRING UniStrStar = { 1 * sizeof(wchar_t), 2 * sizeof(wchar_t), L"*" }; 1332 FILETIME Now; 1318 1333 1319 1334 /** @todo May have to make this more flexible wrt information classes since … … 1437 1452 * restart that single file name query. 1438 1453 */ 1454 GetSystemTimeAsFileTime(&Now); 1455 pDir->iLastPopulated = ((KI64)Now.dwHighDateTime << 32) | Now.dwLowDateTime; 1439 1456 Ios.Information = -1; 1440 1457 Ios.u.Status = -1; … … 1526 1543 if ( !pCurDir->fPopulated 1527 1544 || ( pCurDir->iLastWrite == uPtr.pWithId->LastWriteTime.QuadPart 1528 && (pCur->fFlags & KFSOBJ_F_WORKING_DIR_MTIME) ) ) 1545 && (pCur->fFlags & KFSOBJ_F_WORKING_DIR_MTIME) 1546 && pCurDir->iLastPopulated - pCurDir->iLastWrite 1547 >= KFSCACHE_MIN_LAST_POPULATED_VS_WRITE )) 1529 1548 { /* kind of likely */ } 1530 1549 else … … 1775 1794 if (MY_NT_SUCCESS(rcNt)) 1776 1795 { 1777 if (BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite) 1796 if ( BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite 1797 || pDir->iLastPopulated - pDir->iLastWrite < KFSCACHE_MIN_LAST_POPULATED_VS_WRITE) 1778 1798 { 1779 1799 pDir->fNeedRePopulating = K_TRUE; … … 2059 2079 2060 2080 if ( pDir->iLastWrite == uBuf.FullInfo.LastWriteTime.QuadPart 2061 && (pObj->fFlags & KFSOBJ_F_WORKING_DIR_MTIME) ) 2081 && (pObj->fFlags & KFSOBJ_F_WORKING_DIR_MTIME) 2082 && pDir->iLastPopulated - pDir->iLastWrite >= KFSCACHE_MIN_LAST_POPULATED_VS_WRITE) 2062 2083 KFSCACHE_LOG(("Refreshing %s/%s/ - no re-populating necessary.\n", 2063 2084 pObj->pParent->Obj.pszName, pObj->pszName)); -
trunk/src/lib/nt/kFsCache.h
r3372 r3381 275 275 * parent directory is refreshed. */ 276 276 KI64 iLastWrite; 277 /** The time that iLastWrite was read. */ 278 KI64 iLastPopulated; 277 279 278 280 /** Set if populated. */ -
trunk/src/lib/nt/tstkFsCache.c
r3380 r3381 138 138 /* 139 139 * Try emulate the temp issue above. Seem to require several files. 140 * (The problem was related to long/short filename updating.) 140 141 */ 141 142 szPath[cchWorkDir++] = '\\'; … … 165 166 CHECK(pFsObj && pFsObj->bObjType == KFSOBJ_TYPE_MISSING); 166 167 167 Sleep(100);168 168 sprintf(&szPath[cchWorkDir], "longfilename3.txt"); 169 169 CHECK(myCreateFile(szPath) == 0);
Note:
See TracChangeset
for help on using the changeset viewer.