67 :
XrdJob(
"cache scrubber"), myList(List) {}
137 {iP->
Loc.deadline = QDelay + time(0);
149 if (isrw) {iP->
Loc.deadline = 0;
159 if ((iP = CTable.
Add(Sel.
Path)))
164 iP->
Loc.deadline = QDelay + time(0);
205 if ((gone4good = (iP->
Loc.
hfvec == 0)))
211 }
else gone4good = 0;
245 {
if ((bVec = (iP->
Loc.
TOD_B < BClock
250 iP->
Loc.deadline = QDelay + time(0);
253 }
else if (iP->
Loc.deadline)
254 if (iP->
Loc.deadline > time(0)) retc = -1;
255 else {iP->
Loc.deadline = 0; retc = 1;}
258 if (nilTMO && retc == 1 && iP->
Loc.
hfvec == 0
315 if (!Sel.
InfoP)
return DLTime;
322 else if (iP->
Loc.
hfvec != mask) retc = 1;
323 else {Now = time(0); retc = 0;
324 if (iP->
Loc.deadline && iP->
Loc.deadline <= Now)
325 iP->
Loc.deadline = DLTime + Now;
349 Bounced[SNum] = ++BClock;
351 if (SNum > vecHi) vecHi = SNum;
392 DLTime = fxDelay; QDelay = fxQuery;
401 nilTMO =
static_cast<unsigned int>(nxHold);
408 {
Say.
Emsg(
"Init", errno,
"start cache clock");
436 Bhistory[Tock].Start = Bhistory[Tock].End = 0;
464 if (!(Slot =
RRQ.
Add(Slot, Info))) Info->Key = 0;
474 short roQ,
short rwQ)
485 if((rwQ && Sel.
Vec.wf)
505SMask_t XrdCmsCache::getBVec(
unsigned int TODa,
unsigned int &TODb)
513 if (Bhistory[TODa].End == BClock && Bhistory[TODa].Start <= TODb)
514 {Bhits++; TODb = BClock;
return Bhistory[TODa].Vec;}
518 for (i = 0; i <= vecHi; i++)
519 if (TODb < Bounced[i]) BVec |= 1ULL << i;
521 Bhistory[TODa].Vec = BVec;
522 Bhistory[TODa].Start = TODb;
523 Bhistory[TODa].End = BClock;
526 if (!(Bmiss & 0xff))
DEBUG(
"hits=" <<Bhits <<
" miss=" <<Bmiss);
538 int numNull, numHave, numFree, numRecycled = 0;
542 while((iP = theList))
556 if (!(numNull /= 4)) numNull = 1;
567 sprintf(msgBuff,
"%d cache items; %d allocated %d free",
568 numRecycled, numHave, numFree);
void * XrdCmsStartTickTock(void *carg)
unsigned long long SMask_t
XrdCmsCacheJob(XrdCmsKeyItem *List)
void Bounce(SMask_t smask, int SNum)
int GetFile(XrdCmsSelect &Sel, SMask_t mask)
int DelFile(XrdCmsSelect &Sel, SMask_t mask)
int AddFile(XrdCmsSelect &Sel, SMask_t mask)
friend class XrdCmsCacheJob
int UnkFile(XrdCmsSelect &Sel, SMask_t mask)
void Drop(SMask_t mask, int SNum, int xHi)
int WT4File(XrdCmsSelect &Sel, SMask_t mask)
int Init(int fxHold, int fxDelay, int fxQuery, int seFS, int nxHold)
static const int min_nxTime
static XrdCmsKeyItem * Unload(unsigned int theTock)
static const unsigned int TickMask
static XrdCmsKeyItem * Alloc(unsigned int theTock)
static const int minAlloc
static const unsigned int TickRate
static void Stats(int &isAlloc, int &isFree, int &wasEmpty)
int Equiv(XrdCmsKey &oth)
XrdCmsKeyItem * Add(XrdCmsKey &Key)
XrdCmsKeyItem * Find(XrdCmsKey &Key)
int Recycle(XrdCmsKeyItem *rip)
void Remove(SMask_t mask)
short Add(short Snum, XrdCmsRRQInfo *ip)
void Del(short Snum, const void *Key)
int Ready(int Snum, const void *Key, SMask_t mask1, SMask_t mask2)
struct XrdCmsSelect::@93 Vec
void Schedule(XrdJob *jp)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
static void Snooze(int seconds)