Changeset 3362 for trunk/src/lib/nt/kFsCache.c
- Timestamp:
- Jun 8, 2020, 9:28:44 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/kFsCache.c
r3359 r3362 429 429 ? pCache->auGenerations[ pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] 430 430 : pCache->auGenerationsMissing[pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; 431 pFsObj-> abUnused[0]+= 1; // for debugging431 pFsObj->cPathHashRefs += 1; // for debugging 432 432 } 433 433 else … … 486 486 ? pCache->auGenerations[ pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] 487 487 : pCache->auGenerationsMissing[pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; 488 pFsObj-> abUnused[0]+= 1; // for debugging488 pFsObj->cPathHashRefs += 1; // for debugging 489 489 } 490 490 else … … 593 593 pObj->bObjType = bObjType; 594 594 pObj->fHaveStats = K_FALSE; 595 pObj-> abUnused[0] = K_FALSE;596 pObj-> abUnused[1] = K_FALSE;595 pObj->cPathHashRefs = 0; 596 pObj->idxUserDataLock = KU8_MAX; 597 597 pObj->fFlags = pParent->Obj.fFlags & KFSOBJ_F_INHERITED_MASK; 598 598 pObj->pParent = pParent; … … 3386 3386 else 3387 3387 { 3388 pHashEntry->pFsObj->cPathHashRefs -= 1; 3388 3389 kFsCacheObjRelease(pCache, pHashEntry->pFsObj); 3389 3390 if (pHashEntry->fAbsolute) … … 3447 3448 else 3448 3449 { 3450 pHashEntry->pFsObj->cPathHashRefs -= 1; 3449 3451 kFsCacheObjRelease(pCache, pHashEntry->pFsObj); 3450 3452 if (pHashEntry->fAbsolute) … … 3900 3902 KFSCACHE_LOG(("Destroying %s/%s, type=%d, pObj=%p, pszWhere=%s\n", 3901 3903 pObj->pParent ? pObj->pParent->Obj.pszName : "", pObj->pszName, pObj->bObjType, pObj, pszWhere)); 3902 if (pObj-> abUnused[1]!= 0)3904 if (pObj->cPathHashRefs != 0) 3903 3905 { 3904 3906 fprintf(stderr, "Destroying %s/%s, type=%d, path hash entries: %d!\n", pObj->pParent ? pObj->pParent->Obj.pszName : "", 3905 pObj->pszName, pObj->bObjType, pObj-> abUnused[0]);3907 pObj->pszName, pObj->bObjType, pObj->cPathHashRefs); 3906 3908 fflush(stderr); 3907 3909 __debugbreak(); … … 4080 4082 { 4081 4083 kHlpAssert(cbUserData >= sizeof(*pNew)); 4082 KFSCACHE_ LOCK(pCache);4084 KFSCACHE_OBJUSERDATA_LOCK(pCache, pObj); 4083 4085 4084 4086 if (kFsCacheObjGetUserData(pCache, pObj, uKey) == NULL) … … 4091 4093 pNew->pNext = pObj->pUserDataHead; 4092 4094 pObj->pUserDataHead = pNew; 4093 KFSCACHE_ UNLOCK(pCache);4095 KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); 4094 4096 return pNew; 4095 4097 } 4096 4098 } 4097 4099 4098 KFSCACHE_ UNLOCK(pCache);4100 KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); 4099 4101 return NULL; 4100 4102 } … … 4115 4117 kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); 4116 4118 kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); 4117 KFSCACHE_ LOCK(pCache);4119 KFSCACHE_OBJUSERDATA_LOCK(pCache, pObj); 4118 4120 4119 4121 for (pCur = pObj->pUserDataHead; pCur; pCur = pCur->pNext) 4120 4122 if (pCur->uKey == uKey) 4121 4123 { 4122 KFSCACHE_ UNLOCK(pCache);4124 KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); 4123 4125 return pCur; 4124 4126 } 4125 4127 4126 KFSCACHE_ UNLOCK(pCache);4128 KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); 4127 4129 return NULL; 4128 4130 } 4129 4131 4132 4133 /** 4134 * Determins the idxUserDataLock value. 4135 * 4136 * Called by KFSCACHE_OBJUSERDATA_LOCK when idxUserDataLock is set to KU8_MAX. 4137 * 4138 * @returns The proper idxUserDataLock value. 4139 * @param pCache The cache. 4140 * @param pObj The object. 4141 */ 4142 KU8 kFsCacheObjGetUserDataLockIndex(PKFSCACHE pCache, PKFSOBJ pObj) 4143 { 4144 KU8 idxUserDataLock = pObj->idxUserDataLock; 4145 if (idxUserDataLock == KU8_MAX) 4146 { 4147 KFSCACHE_LOCK(pCache); 4148 idxUserDataLock = pObj->idxUserDataLock; 4149 if (idxUserDataLock == KU8_MAX) 4150 { 4151 idxUserDataLock = pCache->idxUserDataNext++; 4152 idxUserDataLock %= K_ELEMENTS(pCache->auUserDataLocks); 4153 pObj->idxUserDataLock = idxUserDataLock; 4154 } 4155 KFSCACHE_UNLOCK(pCache); 4156 } 4157 return idxUserDataLock; 4158 } 4130 4159 4131 4160 /** … … 4766 4795 4767 4796 #ifdef KFSCACHE_CFG_LOCKING 4768 InitializeCriticalSection(&pCache->u.CritSect); 4797 { 4798 KSIZE idx = K_ELEMENTS(pCache->auUserDataLocks); 4799 while (idx-- > 0) 4800 InitializeCriticalSection(&pCache->auUserDataLocks[idx].CritSect); 4801 InitializeCriticalSection(&pCache->u.CritSect); 4802 } 4769 4803 #endif 4770 4804 return pCache;
Note:
See TracChangeset
for help on using the changeset viewer.