AFS_STATCNT(afs_glink);
#endif
/* we know this guy's in the LRUQ. We'll move dude into DCQ below */
- DZap(&adc->f.inode);
+ DZap(adc);
/* if this guy is in the hash table, pull him out */
if (adc->f.fid.Fid.Volume != 0) {
/* remove entry from first hash chains */
{
afs_int32 chunk;
register afs_int32 i, index;
- register struct dcache *tdc;
+ register struct dcache *tdc = NULL;
AFS_STATCNT(afs_FindDCache);
chunk = AFS_CHUNK(abyte);
register struct osi_file *file;
register struct conn *tc;
int downDCount = 0;
- struct server *newCallback;
+ struct server *newCallback = NULL;
char setNewCallback;
char setVcacheStatus;
char doVcacheUpdate;
int doReallyAdjustSize = 0;
int overWriteWholeChunk = 0;
- XSTATS_DECLS
+ XSTATS_DECLS;
#ifndef AFS_NOSTATS
struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */
osi_timeval_t xferStartTime, /*FS xfer start time */
* Right now, we only have one tool, and it's a hammer. So, we
* fetch the whole file.
*/
- DZap(&tdc->f.inode); /* pages in cache may be old */
+ DZap(tdc); /* pages in cache may be old */
#ifdef IHINT
if (file = tdc->ihint) {
if (tdc->f.inode == file->inum)
afs_CFileClose(file);
ZapDCE(tdc); /* sets DFEntryMod */
if (vType(avc) == VDIR) {
- DZap(&tdc->f.inode);
+ DZap(tdc);
}
ReleaseWriteLock(&tdc->lock);
afs_PutDCache(tdc);
{
register struct dcache *tdc;
register afs_int32 i, touchedit = 0;
- struct dcache **ents;
- int entmax, entcount;
+
+ struct afs_q DirtyQ, *tq;
AFS_STATCNT(afs_WriteThroughDSlots);
* for every dcache entry, and exit xdcache.
*/
MObtainWriteLock(&afs_xdcache, 283);
- entmax = afs_cacheFiles;
- ents = afs_osi_Alloc(entmax * sizeof(struct dcache *));
- entcount = 0;
+ QInit(&DirtyQ);
for (i = 0; i < afs_cacheFiles; i++) {
tdc = afs_indexTable[i];
tdc->refCount++;
ReleaseWriteLock(&tdc->tlock);
- ents[entcount++] = tdc;
+ QAdd(&DirtyQ, &tdc->dirty);
}
}
MReleaseWriteLock(&afs_xdcache);
* afs_cacheInodep, and flush it. Don't forget to put back
* the refcounts.
*/
- for (i = 0; i < entcount; i++) {
- tdc = ents[i];
+#define DQTODC(q) ((struct dcache *)(((char *) (q)) - sizeof(struct afs_q)))
+
+ for (tq = DirtyQ.prev; tq != &DirtyQ; tq = QPrev(tq)) {
+ tdc = DQTODC(tq);
if (tdc->dflags & DFEntryMod) {
int wrLock;
afs_PutDCache(tdc);
}
- afs_osi_Free(ents, entmax * sizeof(struct dcache *));
MObtainWriteLock(&afs_xdcache, 617);
if (!touchedit && (cacheDiskType != AFS_FCACHE_TYPE_MEM)) {
afs_dchashTbl[i] = NULLIDX;
}
+ afs_osi_Free(afs_dvhashTbl, afs_dhashsize * sizeof(afs_int32));
+ afs_osi_Free(afs_dchashTbl, afs_dhashsize * sizeof(afs_int32));
afs_blocksUsed = afs_dcentries = 0;
hzero(afs_indexCounter);