62int XrdFrmMigrate::numMig = 0;
76 if ((Why = Eligible(sP, xTime)))
92int XrdFrmMigrate::Advance()
100 {xTime =
static_cast<int>(time(0) - fsDefer->
baseFile()->
Stat.st_mtime);
102 fP = fsDefer; fsDefer = fsDefer->
Next;
124 {pfP = fP; fP = fP->
Next;}
129 if (pfP) pfP->
Next = sP;
144 Say.Say(
"=====> ",
"Migrate configuration:");
149 {
Say.Say(
"=====> ",
"Scanning ", (vP->
Val?
"r/w: ":
"r/o: "), vP->
Name);
151 while(tP) {
Say.Say(
"=====> ",
"Excluded ", tP->
text); tP = tP->
next;}
160const char *XrdFrmMigrate::Eligible(
XrdFrmFileset *sP, time_t &xTime)
164 time_t mTimeBF, mTimeLK, nowTime = time(0);
170 if (!mTimeLK)
return "migration deferred";
174 mTimeBF = baseFile->
Stat.st_mtime;
175 if (mTimeLK >= mTimeBF)
return "file unchanged";
184 xTime =
static_cast<int>(nowTime - mTimeBF);
215 Say.Emsg(
"Migrate", retc,
"create migrtion thread");
225 while((wTime = Advance()))
226 {
if ((migWait -= wTime) <= 0)
break;
229 while(fsDefer) {fP = fsDefer; fsDefer = fsDefer->
Next;
delete fP;}
230 sprintf(buff,
"%d file%s selected for transfer.",numMig,(numMig==1?
"":
"s"));
231 Say.Emsg(
"Migrate", buff);
242 static int reqID = 0;
247 memset(&myReq, 0,
sizeof(myReq));
249 sprintf(myReq.
ID,
"Internal%d", reqID++);
251 myReq.
addTOD =
static_cast<long long>(time(0));
264void XrdFrmMigrate::Scan()
268 static time_t lastHP = time(0), nowT = time(0);
274 int ec = 0, Bad = 0, aFiles = 0, bFiles = 0;
282 VMSG(
"Scan",
"Name space scan started. . .");
287 while((sP = fP->
Get(
ec,1)))
289 if (sP->
Screen()) Add(sP);
290 else {
delete sP; bFiles++;}
294 }
while((vP = vP->
Next));
298 sprintf(buff,
"%d file%s with %d error%s", aFiles, (aFiles != 1 ?
"s":
""),
299 bFiles, (bFiles != 1 ?
"s":
""));
300 VMSG(
"Scan",
"Name space scan ended;", buff);
304 if (Bad)
Say.Emsg(
"Scan",
"Errors encountered while scanning for "
305 "migratable files.");
XrdOucPup XrdCmsParser::Pup & Say
void * XrdMigrateStart(void *parg)
#define XRDSYSTHREAD_BIND
int LogicalPath(const char *oldp, char *newp, int newpsz)
static const int CompressD
static const int NoAutoDel
XrdFrmFileset * Get(int &rc, int noBase=0)
static const int Recursive
int Refresh(int isMig=0, int doLock=1)
XrdOucNSWalk::NSEnt * baseFile()
XrdOucXAttr< XrdFrcXAttrCpy > cpyInfo
XrdOucNSWalk::NSEnt * failFile()
static void Queue(XrdFrmFileset *sP)
static void Migrate(int doinit=1)
static const char * checkFF(const char *Path)
static int Add(XrdFrcRequest *rP, XrdFrcReqFile *reqF, int theQ)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
static void Snooze(int seconds)