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_FS * | Find (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_FSData * | fsdata = 0
static XrdOssCache_FS * | fsfirst = 0
static long long | fsFree = 0
static long long | fsLarge = 0
static XrdOssCache_FS * | fslast = 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.

{}

## ~XrdOssCache()

XrdOssCache::~XrdOssCache | ( |  | ) |

inline

Definition at line 260 of file XrdOssCache.hh.

{}

## 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.

{
EPNAME("Adjust")
XrdOssCache_FS *fsp;
// If we have a struct then we need to do some more work
//
if (buf)
{if ((buf->st_mode & S_IFMT) != S_IFLNK) Adjust(buf->st_dev, size);
else {char lnkbuff[MAXPATHLEN+64];
int lnklen = readlink(Path, lnkbuff, sizeof(lnkbuff)-1);
if (lnklen > 0)
{XrdOssPath::Trim2Base(lnkbuff+lnklen-1);
Adjust(lnkbuff, size);
}
}
return;
}
// Search for matching logical partition
//
fsp = fsfirst;
while(fsp && strcmp(fsp->path, Path))
if ((fsp = fsp->next) == fsfirst) {fsp = 0; break;}
// Process the result
//
if (fsp) Adjust(fsp, size);
else {DEBUG("cache path " <<Path <<" not found.");}
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
if
if(ec< 0) ec
XrdOssCache_FS::path
const char * path
Definition XrdOssCache.hh:140
XrdOssCache_FS::next
XrdOssCache_FS * next
Definition XrdOssCache.hh:138
XrdOssCache::fsfirst
static XrdOssCache_FS * fsfirst
Definition XrdOssCache.hh:269
XrdOssCache::Adjust
static void Adjust(dev_t devid, off_t size)
Definition XrdOssCache.cc:397

References Adjust(), DEBUG, EPNAME, fsfirst, XrdOssCache_FS::next, Path, XrdOssCache_FS::path, stat, 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.

{
EPNAME("Adjust")
XrdOssCache_FSData *fsdp;
// Search for matching filesystem
//
fsdp = XrdOssCache::fsdata;
while(fsdp && fsdp->fsid != devid) fsdp = fsdp->next;
// Adjust file system free space
//
Mutex.Lock();
if (fsdp)
{DEBUG("free=" <<fsdp->frsz <<'-' <<size <<" path=" <<fsdp->path);
if ((fsdp->frsz -= size) < 0) fsdp->frsz = 0;
fsdp->stat |= XrdOssFSData_ADJUSTED;
} else {
DEBUG("dev " <<devid <<" not found.");
}
// Adjust group usage
//
if (XrdOssCache_Group::PubGroup)
{DEBUG("usage=" <<XrdOssCache_Group::PubGroup->Usage <<'+' <<size
<<" space=" <<XrdOssCache_Group::PubGroup->group);
if ((XrdOssCache_Group::PubGroup->Usage += size) < 0)
XrdOssCache_Group::PubGroup->Usage = 0;
if (Usage) XrdOssSpace::Adjust(XrdOssCache_Group::PubGroup->GRPid, size);
}
// All done
//
Mutex.UnLock();
}
XrdOssFSData_ADJUSTED
#define XrdOssFSData_ADJUSTED
Definition XrdOssCache.hh:103
XrdOssCache_FSData::stat
int stat
Definition XrdOssCache.hh:118
XrdOssCache_FSData::path
const char * path
Definition XrdOssCache.hh:114
XrdOssCache_FSData::frsz
long long frsz
Definition XrdOssCache.hh:112
XrdOssCache_Group::Usage
long long Usage
Definition XrdOssCache.hh:190
XrdOssCache_Group::PubGroup
static XrdOssCache_Group * PubGroup
Definition XrdOssCache.hh:196
XrdOssCache::fsdata
static XrdOssCache_FSData * fsdata
Definition XrdOssCache.hh:271
XrdOssCache::XrdOssCache
XrdOssCache()
Definition XrdOssCache.hh:259
XrdOssCache::Mutex
static XrdSysMutex Mutex
Definition XrdOssCache.hh:262
XrdOssSpace::Adjust
static void Adjust(int Gent, off_t Space, sType=Serv)
Definition XrdOssSpace.cc:81

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

Referenced by Adjust(), XrdOssSys::BreakLink(), XrdOssFile::Close(), XrdOssSys::Create(), XrdOssSys::Reloc(), XrdOssSys::RenameLink(), XrdOssSys::Truncate(), XrdOssAt::Unlink(), and XrdOssSys::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.

{
EPNAME("Adjust")
XrdOssCache_FSData *fsdp;
// Process the result
//
if (fsp)
{fsdp = fsp->fsdata;
DEBUG("used=" <<fsp->fsgroup->Usage <<'+' <<size <<" path=" <<fsp->path);
DEBUG("free=" <<fsdp->frsz <<'-' <<size <<" path=" <<fsdp->path);
Mutex.Lock();
if ((fsp->fsgroup->Usage += size) < 0) fsp->fsgroup->Usage = 0;
if ( (fsdp->frsz -= size) < 0) fsdp->frsz = 0;
fsdp->stat |= XrdOssFSData_ADJUSTED;
if (Usage) XrdOssSpace::Adjust(fsp->fsgroup->GRPid, size);
Mutex.UnLock();
}
}

References XrdOssSpace::Adjust(), DEBUG, EPNAME, XrdOssCache_FSData::frsz, XrdOssCache_FS::fsdata, XrdOssCache_FS::fsgroup, XrdOssCache_Group::GRPid, Mutex, XrdOssCache_FS::path, XrdOssCache_FSData::path, XrdOssCache_FSData::stat, 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.

{
EPNAME("Alloc");
static const mode_t theMode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
XrdSysMutexHelper myMutex(&Mutex);
double diffree;
XrdOssPath::fnInfo Info;
XrdOssCache_FS *fsp, *fspend, *fsp_sel;
XrdOssCache_Group *cgp = 0;
long long size, maxfree, curfree;
int rc, madeDir, datfd = 0;
// Compute appropriate allocation size
//
if (!aInfo.cgSize
|| (size=aInfo.cgSize*ovhAlloc/100+aInfo.cgSize) < minAlloc)
aInfo.cgSize = size = minAlloc;
// Find the corresponding cache group
//
cgp = XrdOssCache_Group::fsgroups;
while(cgp && strcmp(aInfo.cgName, cgp->group)) cgp = cgp->next;
if (!cgp) return -ENOENT;
// Find a cache that will fit this allocation request. We start with the next
// entry past the last one we selected and go full round looking for a
// compatable entry (enough space and in the right space group).
//
fsp_sel = 0; maxfree = 0;
fsp = cgp->curr->next; fspend = fsp; // End when we hit the start again
do {
if (strcmp(aInfo.cgName, fsp->group)
|| (aInfo.cgPath && (aInfo.cgPlen > fsp->plen
|| strncmp(aInfo.cgPath,fsp->path,aInfo.cgPlen)))) continue;
curfree = fsp->fsdata->frsz;
if (size > curfree) continue;
if (fuzAlloc > 0.999) {fsp_sel = fsp; break;}
else if (!fuzAlloc || !fsp_sel)
{if (curfree > maxfree) {fsp_sel = fsp; maxfree = curfree;}}
else {diffree = (!(curfree + maxfree) ? 0.0
: static_cast<double>(XRDABS(maxfree - curfree)) /
static_cast<double>( maxfree + curfree));
if (diffree > fuzAlloc) {fsp_sel = fsp; maxfree = curfree;}
}
} while((fsp = fsp->next) != fspend);
// Check if we can realy fit this file. If so, update current scan pointer
//
if (!fsp_sel) return -ENOSPC;
cgp->curr = fsp_sel;
// Construct the target filename
//
Info.Path = fsp_sel->path;
Info.Plen = fsp_sel->plen;
Info.Sfx = fsp_sel->suffix;
aInfo.cgPsfx = XrdOssPath::genPFN(Info, aInfo.cgPFbf, aInfo.cgPFsz,
(fsp_sel->opts & XrdOssCache_FS::isXA ? 0 : aInfo.Path));
// Verify that target name was constructed
//
if (!(*aInfo.cgPFbf)) return -ENAMETOOLONG;
// Simply open the file in the local filesystem, creating it if need be.
//
if (aInfo.aMode)
{madeDir = 0;
do {do {datfd = open(aInfo.cgPFbf,O_CREAT|O_TRUNC|O_WRONLY,aInfo.aMode);}
while(datfd < 0 && errno == EINTR);
if (datfd >= 0 || errno != ENOENT || madeDir) break;
*Info.Slash='\0'; rc=mkdir(aInfo.cgPFbf,theMode); *Info.Slash='/';
madeDir = 1;
} while(!rc);
if (datfd < 0) return (errno ? -errno : -EFAULT);
}
// All done (temporarily adjust down the free space)x
//
DEBUG("free=" <<fsp_sel->fsdata->frsz <<'-' <<size <<" path="
<<fsp_sel->fsdata->path);
fsp_sel->fsdata->frsz -= size;
fsp_sel->fsdata->stat |= XrdOssFSData_REFRESH;
aInfo.cgFSp = fsp_sel;
return datfd;
}
XrdOssFSData_REFRESH
#define XrdOssFSData_REFRESH
Definition XrdOssCache.hh:104
mkdir
#define mkdir(a, b)
Definition XrdPosix.hh:74
open
#define open
Definition XrdPosix.hh:76
XRDABS
#define XRDABS(x)
Definition XrdSysPlatform.hh:298
XrdOssCache_FS::group
const char * group
Definition XrdOssCache.hh:139
XrdOssCache_FS::opts
FSOpts opts
Definition XrdOssCache.hh:142
XrdOssCache_FS::isXA
@ isXA
Definition XrdOssCache.hh:136
XrdOssCache_FS::plen
int plen
Definition XrdOssCache.hh:141
XrdOssCache_FS::suffix
char suffix[4]
Definition XrdOssCache.hh:143
XrdOssCache_FS::fsdata
XrdOssCache_FSData * fsdata
Definition XrdOssCache.hh:144
XrdOssCache_Group::fsgroups
static XrdOssCache_Group * fsgroups
Definition XrdOssCache.hh:199
XrdOssCache_Group::group
char * group
Definition XrdOssCache.hh:187
XrdOssCache_Group::curr
XrdOssCache_FS * curr
Definition XrdOssCache.hh:188
XrdOssCache_Group::next
XrdOssCache_Group * next
Definition XrdOssCache.hh:186
XrdOssPath::genPFN
static char * genPFN(fnInfo &Info, char *buff, int blen, const char *Path=0)
Definition XrdOssPath.cc:172
TPC::Info
@ Info
Definition XrdHttpTpcTPC.hh:29
XrdOssCache::allocInfo::cgSize
long long cgSize
Definition XrdOssCache.hh:225
XrdOssCache::allocInfo::cgFSp
XrdOssCache_FS * cgFSp
Definition XrdOssCache.hh:231
XrdOssCache::allocInfo::cgPlen
int cgPlen
Definition XrdOssCache.hh:227
XrdOssCache::allocInfo::cgPsfx
char * cgPsfx
Definition XrdOssCache.hh:230
XrdOssCache::allocInfo::cgPFsz
int cgPFsz
Definition XrdOssCache.hh:228
XrdOssCache::allocInfo::aMode
mode_t aMode
Definition XrdOssCache.hh:232
XrdOssCache::allocInfo::cgName
const char * cgName
Definition XrdOssCache.hh:224
XrdOssCache::allocInfo::Path
const char * Path
Definition XrdOssCache.hh:223
XrdOssCache::allocInfo::cgPath
const char * cgPath
Definition XrdOssCache.hh:226
XrdOssCache::allocInfo::cgPFbf
char * cgPFbf
Definition XrdOssCache.hh:229

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::allocInfo::Path, XrdOssCache_FS::path, XrdOssCache_FSData::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.

{
// Check if only the maximum values ae to be returned
//
if (limits)
{memset(&buf, 0, sizeof(struct stat));
buf.st_dev = static_cast<dev_t>(XrdOssCacheDevs::prtNMax);
buf.st_rdev = static_cast<dev_t>(XrdOssCacheDevs::devNMax);
return;
}
// Look up the device info
//
std::map<dev_t, devID>::iterator it = dev2ID.find(buf.st_dev);
if (it != dev2ID.end())
{buf.st_rdev = static_cast<dev_t>(it->second.bdevID);
buf.st_dev = static_cast<dev_t>(it->second.partID);
} else {
buf.st_rdev = 0;
buf.st_dev = 0;
}
}
stat
#define stat(a, b)
Definition XrdPosix.hh:101
XrdOssCacheDevs::devNMax
int devNMax
Definition XrdOssCache.cc:96
XrdOssCacheDevs::dev2ID
std::map< dev_t, devID > dev2ID
Definition XrdOssCache.cc:94
XrdOssCacheDevs::prtNMax
int prtNMax
Definition XrdOssCache.cc:97

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.

{
XrdOssCache_FS *fsp;
char lnkbuff[MAXPATHLEN+64];
struct stat sfbuff;
// First see if this is a symlink that refers to a new style cache
//
if (lnklen)
{if (strlcpy(lnkbuff,Path,sizeof(lnkbuff)) >= sizeof(lnkbuff)) return 0;}
else if (lstat(Path, &sfbuff)
|| (sfbuff.st_mode & S_IFMT) != S_IFLNK
|| (lnklen = readlink(Path,lnkbuff,sizeof(lnkbuff)-1)) <= 0)
return 0;
// Trim the link to the base name
//
XrdOssPath::Trim2Base(lnkbuff+lnklen-1);
// Search for matching logical partition
//
fsp = fsfirst;
while(fsp && strcmp(fsp->path, lnkbuff))
if ((fsp = fsp->next) == fsfirst) {fsp = 0; break;}
return fsp;
}
strlcpy
size_t strlcpy(char *dst, const char *src, size_t sz)
Definition XrdSysPlatform.cc:60
XrdOssPath::Trim2Base
static void Trim2Base(char *eP)
Definition XrdOssPath.cc:304

References fsfirst, XrdOssCache_FS::next, Path, XrdOssCache_FS::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.

{
XrdOssCache_Group *cgp;
long long bytesUsed;
// If usage directory or quota file was passed then we initialize space handling
// We need to create a space object to track usage across failures.
//
if ((UPath || Qfile) && !XrdOssSpace::Init(UPath,Qfile,isSOL,us)) return 1;
if (Qfile) Quotas = !isSOL;
if (UPath) Usage = 1;
// If we will be saving space information then we need to assign each group
// to a save set. If there is no space object then skip all of this.
//
if (UPath && (cgp = XrdOssCache_Group::fsgroups))
do {cgp->GRPid = XrdOssSpace::Assign(cgp->group, bytesUsed);
cgp->Usage = bytesUsed;
} while((cgp = cgp->next));
return 0;
}
XrdOssCache_Group::GRPid
int GRPid
Definition XrdOssCache.hh:192
XrdOssSpace::Init
static int Init()
Definition XrdOssSpace.cc:224

References XrdOssCache_Group::fsgroups, XrdOssCache_Group::group, XrdOssCache_Group::GRPid, XrdOssSpace::Init(), XrdOssCache_Group::next, 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.

{
// Set values
//
minAlloc = aMin;
ovhAlloc = ovhd;
fuzAlloc = static_cast<double>(aFuzz)/100.0;
return 0;
}

## List()

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

static

Definition at line 682 of file XrdOssCache.cc.

{
XrdOssCache_FS *fsp;
const char *theCmd, *rpath;
char *pP, buff[4096];
if ((fsp = fsfirst)) do
{if (fsp->opts & XrdOssCache_FS::isXA)
{pP = (char *)fsp->path + fsp->plen - 1;
do {pP--;} while(*pP != '/');
*pP = '\0'; theCmd = "space";
} else {pP=0; theCmd = "cache";}
rpath = (strcmp(fsp->fsdata->path, fsp->fsdata->pact)
? fsp->fsdata->pact : "");
snprintf(buff, sizeof(buff), "%s%s %s %s -> %s[%d:%d] %s",
lname, theCmd, fsp->group, fsp->path, fsp->fsdata->devN,
fsp->fsdata->bdevID, fsp->fsdata->partID, rpath);
if (pP) *pP = '/';
Eroute.Say(buff);
fsp = fsp->next;
} while(fsp != fsfirst);
}
XrdOssCache_FSData::devN
const char * devN
Definition XrdOssCache.hh:116
XrdOssCache_FSData::pact
const char * pact
Definition XrdOssCache.hh:115
XrdOssCache_FSData::partID
unsigned short partID
Definition XrdOssCache.hh:120
XrdOssCache_FSData::bdevID
unsigned short bdevID
Definition XrdOssCache.hh:119
XrdSysError::Say
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)
Definition XrdSysError.cc:141

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_FS::path, XrdOssCache_FSData::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.

{
#ifdef __linux__
const char *pPart = "/proc/partitions";
std::map<std::string, int> dn2id;
XrdOucStream strm;
std::string sOrg;
char *line, *sMaj, *sMin, *sBlk, *sDev, sAlt[16], sDN[sizeof(devID::nDev)];
dev_t dNode;
int dNum, n, fd, vMaj, vMin;
// Our first step is to find all of the block devices on this machine and
// map them to device numbers (our own as well as the st_dev values).
//
if ((fd = open(pPart, O_RDONLY)) < 0) return;
strm.Attach(fd);
// Read through the table until the end getting information we need
//
while((line = strm.GetLine()))
{if (!(sMaj = strm.GetToken()) || !isdigit(*sMaj)) continue;
if (!(vMaj = atoi(sMaj))) continue;
if (!(sMin = strm.GetToken()) || !isdigit(*sMin)) continue;
vMin = atoi(sMin);
if (!(sBlk = strm.GetToken()) || !isdigit(*sBlk)) continue;
if (!(sDev = strm.GetToken())) continue;
// Preprocess LVM devices
//
if (!strncmp(sDev, "dm-", 3))
{if (!MapDM(sDev, sAlt, sizeof(sAlt)))
{if (dBug) std::cerr <<"Config " <<sDev <<'[' <<vMaj <<':'
<<vMin <<"] -> dev[0]" <<std::endl;
continue;
}
sOrg = sDev;
sDev = sAlt;
} else sOrg = sDev;
// We are only concerned about normal block devices
//
if (sDev[1] != 'd' || (*sDev != 's' && *sDev != 'h')) continue;
strlcpy(sDN, sDev, sizeof(sDN));
sDN[sizeof(sDN)-1] = 0;
// Trim off any numbers from the id
//
n = strlen(sDev)-1;
while(isdigit(sDev[n])) sDev[n--] = 0;
// Generate the device number (existing or new)
//
std::map<std::string,int>::iterator it = dn2id.find(std::string(sDev));
if (it != dn2id.end()) dNum = it->second;
else {dNum = devNMax++;
dn2id[std::string(sDev)] = dNum;
}
// Add the device to out map
//
dNode = makedev(vMaj, vMin);
devID theID = {dNum, 0, {0}};
strcpy(theID.nDev, sDN);
dev2ID[dNode] = theID;
// Print result if so wanted
//
if (dBug) std::cerr <<"Config " <<sOrg <<'[' <<vMaj <<':' <<vMin
<<"] -> " <<sDev <<'[' <<dNum <<']' <<std::endl;
}
#endif
}
XrdOucStream::GetLine
char * GetLine()
Definition XrdOucStream.cc:554
XrdOucStream::Attach
int Attach(int FileDescriptor, int bsz=2047)
Definition XrdOucStream.cc:252
XrdOucStream::GetToken
char * GetToken(int lowcase=0)
Definition XrdOucStream.cc:631
XrdOssCacheDevs::devID::nDev
char nDev[16]
Definition XrdOssCache.cc:91

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.

{
char *Path;
// Check for default
//
if (!token || *token == ':')
{strlcpy(cbuff, OSS_CGROUP_DEFAULT, cblen);
return 0;
}
// Get the correct cache group and partition path
//
if (!(Path = (char *) index(token, ':'))) strlcpy(cbuff, token, cblen);
else {int n = Path - token;
if (n >= cblen) n = cblen-1;
strncpy(cbuff, token, n); cbuff[n] = '\0';
Path++;
}
// All done
//
return Path;
}
OSS_CGROUP_DEFAULT
#define OSS_CGROUP_DEFAULT
Definition XrdOssOpaque.hh:41

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.

{
EPNAME("CacheScan")
XrdOssCache_FSData *fsdp;
XrdOssCache_Group *fsgp;
const struct timespec naptime = {cscanint, 0};
long long frsz, llT; // llT is a dummy temporary
int retc, dbgMsg, dbgNoMsg, dbgDoMsg;
// Try to prevent floodingthe log with scan messages
//
if (cscanint > 60) dbgMsg = cscanint/60;
else dbgMsg = 1;
dbgNoMsg = dbgMsg;
// Loop scanning the cache
//
while(1)
{if (cscanint > 0) nanosleep(&naptime, 0);
dbgDoMsg = !dbgNoMsg--;
if (dbgDoMsg) dbgNoMsg = dbgMsg;
// Get the cache context lock
//
Mutex.Lock();
// Scan through all filesystems skip filesystem that have been
// recently adjusted to avoid fs statstics latency problems.
//
fsSize = 0;
fsTotFr= 0;
fsFree = 0;
fsdp = fsdata;
while(fsdp)
{retc = 0;
if ((fsdp->stat & XrdOssFSData_REFRESH)
|| !(fsdp->stat & XrdOssFSData_ADJUSTED) || cscanint <= 0)
{frsz = XrdOssCache_FS::freeSpace(llT,fsdp->path);
if (frsz < 0) OssEroute.Emsg("CacheScan", errno ,
"state file system ",(char *)fsdp->path);
else {fsdp->frsz = frsz;
fsdp->stat &= ~(XrdOssFSData_REFRESH |
XrdOssFSData_ADJUSTED);
if (dbgDoMsg)
{DEBUG("New free=" <<fsdp->frsz <<" path=" <<fsdp->path);}
}
} else fsdp->stat |= XrdOssFSData_REFRESH;
if (!retc)
{if (fsdp->frsz > fsFree)
{fsFree = fsdp->frsz; fsSize = fsdp->size;}
fsTotFr += fsdp->frsz;
}
fsdp = fsdp->next;
}
// Unlock the cache and if we have quotas check them out
//
Mutex.UnLock();
if (cscanint <= 0) return (void *)0;
if (Quotas) XrdOssSpace::Quotas();
// Update usage information if we are keeping track of it
if (Usage && XrdOssSpace::Readjust())
{fsgp = XrdOssCache_Group::fsgroups;
Mutex.Lock();
while(fsgp)
{fsgp->Usage = XrdOssSpace::Usage(fsgp->GRPid);
fsgp = fsgp->next;
}
Mutex.UnLock();
}
}
// Keep the compiler happy
//
return (void *)0;
}
OssEroute
XrdSysError OssEroute
XrdOssCache_FS::freeSpace
static long long freeSpace(long long &Size, const char *path=0)
Definition XrdOssCache.cc:279
XrdOssCache::fsSize
static long long fsSize
Definition XrdOssCache.hh:268
XrdOssCache::fsTotFr
static long long fsTotFr
Definition XrdOssCache.hh:266
XrdOssCache::fsFree
static long long fsFree
Definition XrdOssCache.hh:267
XrdOssSpace::Usage
static long long Usage(int gent)
Definition XrdOssSpace.cc:521
XrdOssSpace::Quotas
static int Quotas()
Definition XrdOssSpace.cc:345
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95

References DEBUG, EPNAME, XrdOssCache_FS::freeSpace(), XrdOssCache_FSData::frsz, fsdata, fsFree, XrdOssCache_Group::fsgroups, fsSize, fsTotFr, XrdOssCache_Group::GRPid, Mutex, XrdOssCache_FSData::next, XrdOssCache_Group::next, OssEroute, XrdOssCache_FSData::path, XrdOssSpace::Quotas(), XrdOssCache_FSData::size, XrdOssCache_FSData::stat, 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

Definition at line 267 of file XrdOssCache.hh.

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

## 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

Definition at line 262 of file XrdOssCache.hh.

Referenced by Adjust(), Adjust(), Alloc(), XrdOssCache_FS::freeSpace(), XrdOssCache_FS::getSpace(), Scan(), and XrdOssSys::StatVS().

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

- XrdOssCache.hh
- XrdOssCache.cc