Changeset 3362 for trunk/src/lib/nt/kFsCache.h
- Timestamp:
- Jun 8, 2020, 9:28:44 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/kFsCache.h
r3359 r3362 161 161 /** Set if the Stats member is valid, clear if not. */ 162 162 KBOOL fHaveStats; 163 /** Unused flags. */ 164 KBOOL abUnused[2]; 163 /** Internal debug field for counting path hash references. 164 * @internal */ 165 KU8 cPathHashRefs; 166 /** Index into KFSCACHE::auUserData. */ 167 KU8 idxUserDataLock; 165 168 /** Flags, KFSOBJ_F_XXX. */ 166 169 KU32 fFlags; … … 381 384 /** @def KFSCACHE_UNLOCK 382 385 * Counterpart to KFSCACHE_LOCK. */ 386 /** @def KFSCACHE_OBJUSERDATA_LOCK 387 * Locks the user data list of an object exclusively. */ 388 /** @def KFSCACHE_OBJUSERDATA_UNLOCK 389 * Counterpart to KFSCACHE_OBJUSERDATA_LOCK. */ 383 390 #ifdef KFSCACHE_CFG_LOCKING 384 391 # define KFSCACHE_LOCK(a_pCache) EnterCriticalSection(&(a_pCache)->u.CritSect) 385 392 # define KFSCACHE_UNLOCK(a_pCache) LeaveCriticalSection(&(a_pCache)->u.CritSect) 393 # define KFSCACHE_OBJUSERDATA_LOCK(a_pCache, a_pObj) do { \ 394 KU8 idxUserDataLock = (a_pObj)->idxUserDataLock; \ 395 if (idxUserDataLock != KU8_MAX) \ 396 { /* likely */ } \ 397 else \ 398 idxUserDataLock = kFsCacheObjGetUserDataLockIndex(a_pCache, a_pObj); \ 399 idxUserDataLock &= (KU8)(K_ELEMENTS((a_pCache)->auUserDataLocks) - 1); \ 400 EnterCriticalSection(&(a_pCache)->auUserDataLocks[idxUserDataLock].CritSect); \ 401 } while (0) 402 # define KFSCACHE_OBJUSERDATA_UNLOCK(a_pCache, a_pObj) \ 403 LeaveCriticalSection(&(a_pCache)->auUserDataLocks[(a_pObj)->idxUserDataLock & (K_ELEMENTS((a_pCache)->auUserDataLocks) - 1)].CritSect) 386 404 #else 387 405 # define KFSCACHE_LOCK(a_pCache) do { } while (0) 388 406 # define KFSCACHE_UNLOCK(a_pCache) do { } while (0) 407 # define KFSCACHE_OBJUSERDATA_LOCK(a_pCache, a_pObj) do { } while (0) 408 # define KFSCACHE_OBJUSERDATA_UNLOCK(a_pCache, a_pObj) do { } while (0) 389 409 #endif 390 410 … … 456 476 457 477 #ifdef KFSCACHE_CFG_LOCKING 458 /** Critical section protecting the cache. */459 478 union 460 479 { … … 463 482 # endif 464 483 KU64 abPadding[2 * 4 + 4 * sizeof(void *)]; 465 } u; 484 } 485 /** Critical section protecting the cache. */ 486 u, 487 /** Critical section protecting the pUserDataHead of objects. 488 * @note Array size must be a power of two. */ 489 auUserDataLocks[8]; 490 /** The next auUserData index. */ 491 KU8 idxUserDataNext; 466 492 #endif 467 493 … … 544 570 PKFSUSERDATA kFsCacheObjAddUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey, KSIZE cbUserData); 545 571 PKFSUSERDATA kFsCacheObjGetUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey); 572 KU8 kFsCacheObjGetUserDataLockIndex(PKFSCACHE pCache, PKFSOBJ pObj); 546 573 KBOOL kFsCacheObjGetFullPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash); 547 574 KBOOL kFsCacheObjGetFullPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash);
Note:
See TracChangeset
for help on using the changeset viewer.