XRootD
Loading...
Searching...
No Matches
XrdOssCache Class Reference

#include <XrdOssCache.hh>

+ Collaboration diagram for XrdOssCache:

Classes

struct  allocInfo
 

Public Member Functions

 XrdOssCache ()
 
 ~XrdOssCache ()
 

Static Public Member Functions

static void Adjust (const char *Path, off_t size, struct stat *buf=0)
 
static void Adjust (dev_t devid, off_t size)
 
static void Adjust (XrdOssCache_FS *fsp, off_t size)
 
static int Alloc (allocInfo &aInfo)
 
static void DevInfo (struct stat &buf, bool limits=false)
 
static XrdOssCache_FSFind (const char *Path, int lklen=0)
 
static int Init (const char *UDir, const char *Qfile, int isSOL, int usync=0)
 
static int Init (long long aMin, int ovhd, int aFuzz)
 
static void List (const char *lname, XrdSysError &Eroute)
 
static void MapDevs (bool dBug=false)
 
static char * Parse (const char *token, char *cbuff, int cblen)
 
static void * Scan (int cscanint)
 

Static Public Attributes

static int fsCount = 0
 
static XrdOssCache_FSDatafsdata = 0
 
static XrdOssCache_FSfsfirst = 0
 
static long long fsFree = 0
 
static long long fsLarge = 0
 
static XrdOssCache_FSfslast = 0
 
static long long fsSize = 0
 
static long long fsTotal = 0
 
static long long fsTotFr = 0
 
static XrdSysMutex Mutex
 

Detailed Description

Definition at line 212 of file XrdOssCache.hh.

Constructor & Destructor Documentation

◆ XrdOssCache()

XrdOssCache::XrdOssCache ( )
inline

Definition at line 259 of file XrdOssCache.hh.

259{}

◆ ~XrdOssCache()

XrdOssCache::~XrdOssCache ( )
inline

Definition at line 260 of file XrdOssCache.hh.

260{}

Member Function Documentation

◆ Adjust() [1/3]

void XrdOssCache::Adjust ( const char * Path,
off_t size,
struct stat * buf = 0 )
static

Definition at line 435 of file XrdOssCache.cc.

436{
437 EPNAME("Adjust")
438 XrdOssCache_FS *fsp;
439
440// If we have a struct then we need to do some more work
441//
442 if (buf)
443 {if ((buf->st_mode & S_IFMT) != S_IFLNK) Adjust(buf->st_dev, size);
444 else {char lnkbuff[MAXPATHLEN+64];
445 int lnklen = readlink(Path, lnkbuff, sizeof(lnkbuff)-1);
446 if (lnklen > 0)
447 {XrdOssPath::Trim2Base(lnkbuff+lnklen-1);
448 Adjust(lnkbuff, size);
449 }
450 }
451 return;
452 }
453
454// Search for matching logical partition
455//
456 fsp = fsfirst;
457 while(fsp && strcmp(fsp->path, Path))
458 if ((fsp = fsp->next) == fsfirst) {fsp = 0; break;}
459
460// Process the result
461//
462 if (fsp) Adjust(fsp, size);
463 else {DEBUG("cache path " <<Path <<" not found.");}
464}
#define DEBUG(x)
#define EPNAME(x)
XrdOucString Path
if(ec< 0) ec
const char * path
XrdOssCache_FS * next
static XrdOssCache_FS * fsfirst
static void Adjust(dev_t devid, off_t size)
static void Trim2Base(char *eP)

References Adjust(), DEBUG, EPNAME, fsfirst, XrdOssCache_FS::next, XrdOssCache_FS::path, Path, and XrdOssPath::Trim2Base().

+ Here is the call graph for this function:

◆ Adjust() [2/3]

void XrdOssCache::Adjust ( dev_t devid,
off_t size )
static

Definition at line 397 of file XrdOssCache.cc.

398{
399 EPNAME("Adjust")
400 XrdOssCache_FSData *fsdp;
401
402// Search for matching filesystem
403//
404 fsdp = XrdOssCache::fsdata;
405 while(fsdp && fsdp->fsid != devid) fsdp = fsdp->next;
406
407// Adjust file system free space
408//
409 Mutex.Lock();
410 if (fsdp)
411 {DEBUG("free=" <<fsdp->frsz <<'-' <<size <<" path=" <<fsdp->path);
412 if ((fsdp->frsz -= size) < 0) fsdp->frsz = 0;
414 } else {
415 DEBUG("dev " <<devid <<" not found.");
416 }
417
418// Adjust group usage
419//
421 {DEBUG("usage=" <<XrdOssCache_Group::PubGroup->Usage <<'+' <<size
422 <<" space=" <<XrdOssCache_Group::PubGroup->group);
423 if ((XrdOssCache_Group::PubGroup->Usage += size) < 0)
425 if (Usage) XrdOssSpace::Adjust(XrdOssCache_Group::PubGroup->GRPid, size);
426 }
427
428// All done
429//
430 Mutex.UnLock();
431}
#define XrdOssFSData_ADJUSTED
const char * path
static XrdOssCache_Group * PubGroup
static XrdOssCache_FSData * fsdata
static XrdSysMutex Mutex
static void Adjust(int Gent, off_t Space, sType=Serv)

References XrdOssSpace::Adjust(), DEBUG, EPNAME, XrdOssCache_FSData::frsz, fsdata, XrdOssCache_FSData::fsid, XrdSysMutex::Lock(), Mutex, XrdOssCache_FSData::next, XrdOssCache_FSData::path, XrdOssCache_Group::PubGroup, XrdOssCache_FSData::stat, XrdSysMutex::UnLock(), Usage(), XrdOssCache_Group::Usage, and XrdOssFSData_ADJUSTED.

Referenced by Adjust(), XrdOssSys::BreakLink(), XrdOssFile::Close(), XrdOssSys::Create(), XrdOssSys::Reloc(), XrdOssSys::RenameLink(), XrdOssSys::Truncate(), XrdOssSys::Unlink(), and XrdOssAt::Unlink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Adjust() [3/3]

void XrdOssCache::Adjust ( XrdOssCache_FS * fsp,
off_t size )
static

Definition at line 468 of file XrdOssCache.cc.

469{
470 EPNAME("Adjust")
471 XrdOssCache_FSData *fsdp;
472
473// Process the result
474//
475 if (fsp)
476 {fsdp = fsp->fsdata;
477 DEBUG("used=" <<fsp->fsgroup->Usage <<'+' <<size <<" path=" <<fsp->path);
478 DEBUG("free=" <<fsdp->frsz <<'-' <<size <<" path=" <<fsdp->path);
479 Mutex.Lock();
480 if ((fsp->fsgroup->Usage += size) < 0) fsp->fsgroup->Usage = 0;
481 if ( (fsdp->frsz -= size) < 0) fsdp->frsz = 0;
483 if (Usage) XrdOssSpace::Adjust(fsp->fsgroup->GRPid, size);
484 Mutex.UnLock();
485 }
486}

References XrdOssSpace::Adjust(), DEBUG, EPNAME, XrdOssCache_FSData::frsz, XrdOssCache_FS::fsdata, XrdOssCache_FS::fsgroup, XrdOssCache_Group::GRPid, XrdSysMutex::Lock(), Mutex, XrdOssCache_FSData::path, XrdOssCache_FS::path, XrdOssCache_FSData::stat, XrdSysMutex::UnLock(), Usage(), XrdOssCache_Group::Usage, and XrdOssFSData_ADJUSTED.

+ Here is the call graph for this function:

◆ Alloc()

int XrdOssCache::Alloc ( XrdOssCache::allocInfo & aInfo)
static

Definition at line 492 of file XrdOssCache.cc.

493{
494 EPNAME("Alloc");
495 static const mode_t theMode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
496 XrdSysMutexHelper myMutex(&Mutex);
497 double diffree;
499 XrdOssCache_FS *fsp, *fspend, *fsp_sel;
500 XrdOssCache_Group *cgp = 0;
501 long long size, maxfree, curfree;
502 int rc, madeDir, datfd = 0;
503
504// Compute appropriate allocation size
505//
506 if (!aInfo.cgSize
507 || (size=aInfo.cgSize*ovhAlloc/100+aInfo.cgSize) < minAlloc)
508 aInfo.cgSize = size = minAlloc;
509
510// Find the corresponding cache group
511//
513 while(cgp && strcmp(aInfo.cgName, cgp->group)) cgp = cgp->next;
514 if (!cgp) return -ENOENT;
515
516// Find a cache that will fit this allocation request. We start with the next
517// entry past the last one we selected and go full round looking for a
518// compatable entry (enough space and in the right space group).
519//
520 fsp_sel = 0; maxfree = 0;
521 fsp = cgp->curr->next; fspend = fsp; // End when we hit the start again
522 do {
523 if (strcmp(aInfo.cgName, fsp->group)
524 || (aInfo.cgPath && (aInfo.cgPlen > fsp->plen
525 || strncmp(aInfo.cgPath,fsp->path,aInfo.cgPlen)))) continue;
526 curfree = fsp->fsdata->frsz;
527 if (size > curfree) continue;
528
529 if (fuzAlloc > 0.999) {fsp_sel = fsp; break;}
530 else if (!fuzAlloc || !fsp_sel)
531 {if (curfree > maxfree) {fsp_sel = fsp; maxfree = curfree;}}
532 else {diffree = (!(curfree + maxfree) ? 0.0
533 : static_cast<double>(XRDABS(maxfree - curfree)) /
534 static_cast<double>( maxfree + curfree));
535 if (diffree > fuzAlloc) {fsp_sel = fsp; maxfree = curfree;}
536 }
537 } while((fsp = fsp->next) != fspend);
538
539// Check if we can realy fit this file. If so, update current scan pointer
540//
541 if (!fsp_sel) return -ENOSPC;
542 cgp->curr = fsp_sel;
543
544// Construct the target filename
545//
546 Info.Path = fsp_sel->path;
547 Info.Plen = fsp_sel->plen;
548 Info.Sfx = fsp_sel->suffix;
549 aInfo.cgPsfx = XrdOssPath::genPFN(Info, aInfo.cgPFbf, aInfo.cgPFsz,
550 (fsp_sel->opts & XrdOssCache_FS::isXA ? 0 : aInfo.Path));
551
552// Verify that target name was constructed
553//
554 if (!(*aInfo.cgPFbf)) return -ENAMETOOLONG;
555
556// Simply open the file in the local filesystem, creating it if need be.
557//
558 if (aInfo.aMode)
559 {madeDir = 0;
560 do {do {datfd = open(aInfo.cgPFbf,O_CREAT|O_TRUNC|O_WRONLY,aInfo.aMode);}
561 while(datfd < 0 && errno == EINTR);
562 if (datfd >= 0 || errno != ENOENT || madeDir) break;
563 *Info.Slash='\0'; rc=mkdir(aInfo.cgPFbf,theMode); *Info.Slash='/';
564 madeDir = 1;
565 } while(!rc);
566 if (datfd < 0) return (errno ? -errno : -EFAULT);
567 }
568
569// All done (temporarily adjust down the free space)x
570//
571 DEBUG("free=" <<fsp_sel->fsdata->frsz <<'-' <<size <<" path="
572 <<fsp_sel->fsdata->path);
573 fsp_sel->fsdata->frsz -= size;
574 fsp_sel->fsdata->stat |= XrdOssFSData_REFRESH;
575 aInfo.cgFSp = fsp_sel;
576 return datfd;
577}
#define XrdOssFSData_REFRESH
#define mkdir(a, b)
Definition XrdPosix.hh:69
#define open
Definition XrdPosix.hh:71
#define XRDABS(x)
const char * group
XrdOssCache_FSData * fsdata
static XrdOssCache_Group * fsgroups
XrdOssCache_FS * curr
XrdOssCache_Group * next
static char * genPFN(fnInfo &Info, char *buff, int blen, const char *Path=0)
XrdOssCache_FS * cgFSp

References XrdOssCache::allocInfo::aMode, XrdOssCache::allocInfo::cgFSp, XrdOssCache::allocInfo::cgName, XrdOssCache::allocInfo::cgPath, XrdOssCache::allocInfo::cgPFbf, XrdOssCache::allocInfo::cgPFsz, XrdOssCache::allocInfo::cgPlen, XrdOssCache::allocInfo::cgPsfx, XrdOssCache::allocInfo::cgSize, XrdOssCache_Group::curr, DEBUG, EPNAME, XrdOssCache_FSData::frsz, XrdOssCache_FS::fsdata, XrdOssCache_Group::fsgroups, XrdOssPath::genPFN(), XrdOssCache_FS::group, XrdOssCache_Group::group, XrdOssCache_FS::isXA, mkdir, Mutex, XrdOssCache_FS::next, XrdOssCache_Group::next, open, XrdOssCache_FS::opts, XrdOssCache_FSData::path, XrdOssCache_FS::path, XrdOssCache::allocInfo::Path, XrdOssCache_FS::plen, XrdOssCache_FSData::stat, XrdOssCache_FS::suffix, XRDABS, and XrdOssFSData_REFRESH.

Referenced by XrdOssSys::Alloc_Cache(), and XrdOssSys::Reloc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DevInfo()

void XrdOssCache::DevInfo ( struct stat & buf,
bool limits = false )
static

Definition at line 583 of file XrdOssCache.cc.

584{
585
586// Check if only the maximum values ae to be returned
587//
588 if (limits)
589 {memset(&buf, 0, sizeof(struct stat));
590 buf.st_dev = static_cast<dev_t>(XrdOssCacheDevs::prtNMax);
591 buf.st_rdev = static_cast<dev_t>(XrdOssCacheDevs::devNMax);
592 return;
593 }
594
595// Look up the device info
596//
597 std::map<dev_t, devID>::iterator it = dev2ID.find(buf.st_dev);
598 if (it != dev2ID.end())
599 {buf.st_rdev = static_cast<dev_t>(it->second.bdevID);
600 buf.st_dev = static_cast<dev_t>(it->second.partID);
601 } else {
602 buf.st_rdev = 0;
603 buf.st_dev = 0;
604 }
605}
#define stat(a, b)
Definition XrdPosix.hh:96
std::map< dev_t, devID > dev2ID

References XrdOssCacheDevs::dev2ID, XrdOssCacheDevs::devNMax, XrdOssCacheDevs::prtNMax, and stat.

Referenced by XrdOssAt::Stat(), and XrdOssSys::StatPF().

+ Here is the caller graph for this function:

◆ Find()

XrdOssCache_FS * XrdOssCache::Find ( const char * Path,
int lklen = 0 )
static

Definition at line 611 of file XrdOssCache.cc.

612{
613 XrdOssCache_FS *fsp;
614 char lnkbuff[MAXPATHLEN+64];
615 struct stat sfbuff;
616
617// First see if this is a symlink that refers to a new style cache
618//
619 if (lnklen)
620 {if (strlcpy(lnkbuff,Path,sizeof(lnkbuff)) >= sizeof(lnkbuff)) return 0;}
621 else if (lstat(Path, &sfbuff)
622 || (sfbuff.st_mode & S_IFMT) != S_IFLNK
623 || (lnklen = readlink(Path,lnkbuff,sizeof(lnkbuff)-1)) <= 0)
624 return 0;
625
626// Trim the link to the base name
627//
628 XrdOssPath::Trim2Base(lnkbuff+lnklen-1);
629
630// Search for matching logical partition
631//
632 fsp = fsfirst;
633 while(fsp && strcmp(fsp->path, lnkbuff))
634 if ((fsp = fsp->next) == fsfirst) {fsp = 0; break;}
635 return fsp;
636}
int lstat(const char *path, struct stat *buf)
size_t strlcpy(char *dst, const char *src, size_t sz)

References fsfirst, lstat(), XrdOssCache_FS::next, XrdOssCache_FS::path, Path, stat, strlcpy(), and XrdOssPath::Trim2Base().

Referenced by XrdOssFile::Open(), and XrdOssSys::Reloc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Init() [1/2]

int XrdOssCache::Init ( const char * UDir,
const char * Qfile,
int isSOL,
int usync = 0 )
static

Definition at line 644 of file XrdOssCache.cc.

645{
647 long long bytesUsed;
648
649// If usage directory or quota file was passed then we initialize space handling
650// We need to create a space object to track usage across failures.
651//
652 if ((UPath || Qfile) && !XrdOssSpace::Init(UPath,Qfile,isSOL,us)) return 1;
653 if (Qfile) Quotas = !isSOL;
654 if (UPath) Usage = 1;
655
656// If we will be saving space information then we need to assign each group
657// to a save set. If there is no space object then skip all of this.
658//
659 if (UPath && (cgp = XrdOssCache_Group::fsgroups))
660 do {cgp->GRPid = XrdOssSpace::Assign(cgp->group, bytesUsed);
661 cgp->Usage = bytesUsed;
662 } while((cgp = cgp->next));
663 return 0;
664}
static int Init()

References XrdOssCache_Group::fsgroups, XrdOssCache_Group::group, XrdOssCache_Group::GRPid, XrdOssSpace::Init(), XrdOssCache_Group::next, Usage(), and XrdOssCache_Group::Usage.

Referenced by XrdOssSys::Configure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Init() [2/2]

int XrdOssCache::Init ( long long aMin,
int ovhd,
int aFuzz )
static

Definition at line 668 of file XrdOssCache.cc.

669{
670// Set values
671//
672 minAlloc = aMin;
673 ovhAlloc = ovhd;
674 fuzAlloc = static_cast<double>(aFuzz)/100.0;
675 return 0;
676}

◆ List()

void XrdOssCache::List ( const char * lname,
XrdSysError & Eroute )
static

Definition at line 682 of file XrdOssCache.cc.

683{
684 XrdOssCache_FS *fsp;
685 const char *theCmd, *rpath;
686 char *pP, buff[4096];
687
688 if ((fsp = fsfirst)) do
689 {if (fsp->opts & XrdOssCache_FS::isXA)
690 {pP = (char *)fsp->path + fsp->plen - 1;
691 do {pP--;} while(*pP != '/');
692 *pP = '\0'; theCmd = "space";
693 } else {pP=0; theCmd = "cache";}
694 rpath = (strcmp(fsp->fsdata->path, fsp->fsdata->pact)
695 ? fsp->fsdata->pact : "");
696 snprintf(buff, sizeof(buff), "%s%s %s %s -> %s[%d:%d] %s",
697 lname, theCmd, fsp->group, fsp->path, fsp->fsdata->devN,
698 fsp->fsdata->bdevID, fsp->fsdata->partID, rpath);
699 if (pP) *pP = '/';
700 Eroute.Say(buff);
701 fsp = fsp->next;
702 } while(fsp != fsfirst);
703}
const char * devN
const char * pact
unsigned short partID
unsigned short bdevID
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)

References XrdOssCache_FSData::bdevID, XrdOssCache_FSData::devN, XrdOssCache_FS::fsdata, fsfirst, XrdOssCache_FS::group, XrdOssCache_FS::isXA, XrdOssCache_FS::next, XrdOssCache_FS::opts, XrdOssCache_FSData::pact, XrdOssCache_FSData::partID, XrdOssCache_FSData::path, XrdOssCache_FS::path, XrdOssCache_FS::plen, and XrdSysError::Say().

Referenced by XrdOssSys::Config_Display().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MapDevs()

void XrdOssCache::MapDevs ( bool dBug = false)
static

Definition at line 709 of file XrdOssCache.cc.

710{
711#ifdef __linux__
712 const char *pPart = "/proc/partitions";
713 std::map<std::string, int> dn2id;
714 XrdOucStream strm;
715 std::string sOrg;
716 char *line, *sMaj, *sMin, *sBlk, *sDev, sAlt[16], sDN[sizeof(devID::nDev)];
717 dev_t dNode;
718 int dNum, n, fd, vMaj, vMin;
719
720// Our first step is to find all of the block devices on this machine and
721// map them to device numbers (our own as well as the st_dev values).
722//
723 if ((fd = open(pPart, O_RDONLY)) < 0) return;
724 strm.Attach(fd);
725
726// Read through the table until the end getting information we need
727//
728 while((line = strm.GetLine()))
729 {if (!(sMaj = strm.GetToken()) || !isdigit(*sMaj)) continue;
730 if (!(vMaj = atoi(sMaj))) continue;
731 if (!(sMin = strm.GetToken()) || !isdigit(*sMin)) continue;
732 vMin = atoi(sMin);
733 if (!(sBlk = strm.GetToken()) || !isdigit(*sBlk)) continue;
734 if (!(sDev = strm.GetToken())) continue;
735
736 // Preprocess LVM devices
737 //
738 if (!strncmp(sDev, "dm-", 3))
739 {if (!MapDM(sDev, sAlt, sizeof(sAlt)))
740 {if (dBug) std::cerr <<"Config " <<sDev <<'[' <<vMaj <<':'
741 <<vMin <<"] -> dev[0]" <<std::endl;
742 continue;
743 }
744 sOrg = sDev;
745 sDev = sAlt;
746 } else sOrg = sDev;
747
748 // We are only concerned about normal block devices
749 //
750 if (sDev[1] != 'd' || (*sDev != 's' && *sDev != 'h')) continue;
751 strlcpy(sDN, sDev, sizeof(sDN));
752 sDN[sizeof(sDN)-1] = 0;
753
754 // Trim off any numbers from the id
755 //
756 n = strlen(sDev)-1;
757 while(isdigit(sDev[n])) sDev[n--] = 0;
758
759 // Generate the device number (existing or new)
760 //
761 std::map<std::string,int>::iterator it = dn2id.find(std::string(sDev));
762 if (it != dn2id.end()) dNum = it->second;
763 else {dNum = devNMax++;
764 dn2id[std::string(sDev)] = dNum;
765 }
766
767 // Add the device to out map
768 //
769 dNode = makedev(vMaj, vMin);
770 devID theID = {dNum, 0, {0}};
771 strcpy(theID.nDev, sDN);
772 dev2ID[dNode] = theID;
773
774 // Print result if so wanted
775 //
776 if (dBug) std::cerr <<"Config " <<sOrg <<'[' <<vMaj <<':' <<vMin
777 <<"] -> " <<sDev <<'[' <<dNum <<']' <<std::endl;
778 }
779#endif
780}
char * GetLine()
int Attach(int FileDescriptor, int bsz=2047)
char * GetToken(int lowcase=0)

References XrdOucStream::Attach(), XrdOssCacheDevs::dev2ID, XrdOssCacheDevs::devNMax, XrdOucStream::GetLine(), XrdOucStream::GetToken(), XrdOssCacheDevs::devID::nDev, open, and strlcpy().

Referenced by XrdOssSys::Configure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Parse()

char * XrdOssCache::Parse ( const char * token,
char * cbuff,
int cblen )
static

Definition at line 814 of file XrdOssCache.cc.

815{
816 char *Path;
817
818// Check for default
819//
820 if (!token || *token == ':')
821 {strlcpy(cbuff, OSS_CGROUP_DEFAULT, cblen);
822 return 0;
823 }
824
825// Get the correct cache group and partition path
826//
827 if (!(Path = (char *) index(token, ':'))) strlcpy(cbuff, token, cblen);
828 else {int n = Path - token;
829 if (n >= cblen) n = cblen-1;
830 strncpy(cbuff, token, n); cbuff[n] = '\0';
831 Path++;
832 }
833
834// All done
835//
836 return Path;
837}
#define OSS_CGROUP_DEFAULT

References OSS_CGROUP_DEFAULT, Path, and strlcpy().

Referenced by XrdOssSys::Alloc_Cache(), and XrdOssSys::Reloc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Scan()

void * XrdOssCache::Scan ( int cscanint)
static

Definition at line 843 of file XrdOssCache.cc.

844{
845 EPNAME("CacheScan")
846 XrdOssCache_FSData *fsdp;
847 XrdOssCache_Group *fsgp;
848 const struct timespec naptime = {cscanint, 0};
849 long long frsz, llT; // llT is a dummy temporary
850 int retc, dbgMsg, dbgNoMsg, dbgDoMsg;
851
852// Try to prevent floodingthe log with scan messages
853//
854 if (cscanint > 60) dbgMsg = cscanint/60;
855 else dbgMsg = 1;
856 dbgNoMsg = dbgMsg;
857
858// Loop scanning the cache
859//
860 while(1)
861 {if (cscanint > 0) nanosleep(&naptime, 0);
862 dbgDoMsg = !dbgNoMsg--;
863 if (dbgDoMsg) dbgNoMsg = dbgMsg;
864
865 // Get the cache context lock
866 //
867 Mutex.Lock();
868
869 // Scan through all filesystems skip filesystem that have been
870 // recently adjusted to avoid fs statstics latency problems.
871 //
872 fsSize = 0;
873 fsTotFr= 0;
874 fsFree = 0;
875 fsdp = fsdata;
876 while(fsdp)
877 {retc = 0;
878 if ((fsdp->stat & XrdOssFSData_REFRESH)
879 || !(fsdp->stat & XrdOssFSData_ADJUSTED) || cscanint <= 0)
880 {frsz = XrdOssCache_FS::freeSpace(llT,fsdp->path);
881 if (frsz < 0) OssEroute.Emsg("CacheScan", errno ,
882 "state file system ",(char *)fsdp->path);
883 else {fsdp->frsz = frsz;
884 fsdp->stat &= ~(XrdOssFSData_REFRESH |
886 if (dbgDoMsg)
887 {DEBUG("New free=" <<fsdp->frsz <<" path=" <<fsdp->path);}
888 }
889 } else fsdp->stat |= XrdOssFSData_REFRESH;
890 if (!retc)
891 {if (fsdp->frsz > fsFree)
892 {fsFree = fsdp->frsz; fsSize = fsdp->size;}
893 fsTotFr += fsdp->frsz;
894 }
895 fsdp = fsdp->next;
896 }
897
898 // Unlock the cache and if we have quotas check them out
899 //
900 Mutex.UnLock();
901 if (cscanint <= 0) return (void *)0;
902 if (Quotas) XrdOssSpace::Quotas();
903
904 // Update usage information if we are keeping track of it
905 if (Usage && XrdOssSpace::Readjust())
907 Mutex.Lock();
908 while(fsgp)
909 {fsgp->Usage = XrdOssSpace::Usage(fsgp->GRPid);
910 fsgp = fsgp->next;
911 }
912 Mutex.UnLock();
913 }
914 }
915
916// Keep the compiler happy
917//
918 return (void *)0;
919}
XrdSysError OssEroute
static long long freeSpace(long long &Size, const char *path=0)
static long long fsSize
static long long fsTotFr
static long long fsFree
static long long Usage(int gent)
static int Quotas()
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)

References DEBUG, XrdSysError::Emsg(), EPNAME, XrdOssCache_FS::freeSpace(), XrdOssCache_FSData::frsz, fsdata, fsFree, XrdOssCache_Group::fsgroups, fsSize, fsTotFr, XrdOssCache_Group::GRPid, XrdSysMutex::Lock(), Mutex, XrdOssCache_FSData::next, XrdOssCache_Group::next, OssEroute, XrdOssCache_FSData::path, XrdOssSpace::Quotas(), XrdOssCache_FSData::size, XrdOssCache_FSData::stat, XrdSysMutex::UnLock(), Usage(), XrdOssCache_Group::Usage, XrdOssSpace::Usage(), XrdOssFSData_ADJUSTED, and XrdOssFSData_REFRESH.

Referenced by XrdOssSys::StatVS(), and XrdOssCacheScan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fsCount

int XrdOssCache::fsCount = 0
static

Definition at line 272 of file XrdOssCache.hh.

Referenced by XrdOssCache_FSData::XrdOssCache_FSData(), and XrdOssSys::StatVS().

◆ fsdata

XrdOssCache_FSData * XrdOssCache::fsdata = 0
static

Definition at line 271 of file XrdOssCache.hh.

Referenced by XrdOssCache_FS::XrdOssCache_FS(), XrdOssCache_FS::Add(), Adjust(), and Scan().

◆ fsfirst

XrdOssCache_FS * XrdOssCache::fsfirst = 0
static

Definition at line 269 of file XrdOssCache.hh.

Referenced by XrdOssCache_FS::XrdOssCache_FS(), Adjust(), XrdOssSys::Create(), Find(), and List().

◆ fsFree

long long XrdOssCache::fsFree = 0
static

◆ fsLarge

long long XrdOssCache::fsLarge = 0
static

Definition at line 265 of file XrdOssCache.hh.

Referenced by XrdOssCache_FSData::XrdOssCache_FSData(), and XrdOssSys::StatVS().

◆ fslast

XrdOssCache_FS * XrdOssCache::fslast = 0
static

Definition at line 270 of file XrdOssCache.hh.

Referenced by XrdOssCache_FS::XrdOssCache_FS().

◆ fsSize

long long XrdOssCache::fsSize = 0
static

Definition at line 268 of file XrdOssCache.hh.

Referenced by XrdOssCache_FS::freeSpace(), and Scan().

◆ fsTotal

long long XrdOssCache::fsTotal = 0
static

Definition at line 264 of file XrdOssCache.hh.

Referenced by XrdOssCache_FSData::XrdOssCache_FSData(), and XrdOssSys::StatVS().

◆ fsTotFr

long long XrdOssCache::fsTotFr = 0
static

Definition at line 266 of file XrdOssCache.hh.

Referenced by XrdOssCache_FSData::XrdOssCache_FSData(), Scan(), and XrdOssSys::StatVS().

◆ Mutex

XrdSysMutex XrdOssCache::Mutex
static

The documentation for this class was generated from the following files: