Loading...
Searching...
No Matches
XrdCephOss Class Reference

`#include <XrdCephOss.hh>`

Inheritance diagram for XrdCephOss:
Collaboration diagram for XrdCephOss:

## Public Member Functions

| XrdCephOss (const char *, XrdSysError &)
virtual | ~XrdCephOss ()
virtual int | Chmod (const char *, mode_t mode, XrdOucEnv *eP=0)
int | Configure (const char *, XrdSysError &)
virtual int | Create (const char *, const char *, mode_t, XrdOucEnv &, int opts=0)
virtual int | Init (XrdSysLogger *, const char *)
virtual int | Mkdir (const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0)
virtual XrdOssDF * | newDir (const char *tident)
virtual XrdOssDF * | newFile (const char *tident)
virtual int | Remdir (const char *, int Opts=0, XrdOucEnv *eP=0)
virtual int | Rename (const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0)
virtual int | Stat (const char *, struct stat *, int opts=0, XrdOucEnv *eP=0)
| Return status information for an object ID.
virtual int | StatFS (const char *path, char *buff, int &blen, XrdOucEnv *eP=0)
virtual int | StatLS (XrdOucEnv &env, const char *path, char *buff, int &blen)
| Report on disk space use in this pool.
virtual int | StatVS (XrdOssVSInfo *sP, const char *sname=0, int updt=0)
virtual int | Truncate (const char *, unsigned long long, XrdOucEnv *eP=0)
virtual int | Unlink (const char *path, int Opts=0, XrdOucEnv *eP=0)
Public Member Functions inherited from XrdOss
| XrdOss ()
| Constructor and Destructor.
virtual | ~XrdOss ()
virtual void | Connect (XrdOucEnv &env)
virtual void | Disc (XrdOucEnv &env)
virtual void | EnvInfo (XrdOucEnv *envP)
virtual uint64_t | Features ()
virtual int | FSctl (int cmd, int alen, const char *args, char **resp=0)
virtual int | Init (XrdSysLogger *lp, const char *cfn, XrdOucEnv *envP)
virtual int | Lfn2Pfn (const char *Path, char *buff, int blen)
virtual const char * | Lfn2Pfn (const char *Path, char *buff, int blen, int &rc)
virtual int | StatPF (const char *path, struct stat *buff)
virtual int | StatPF (const char *path, struct stat *buff, int opts)
virtual int | Stats (char *buff, int blen)
virtual int | StatXA (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
virtual int | StatXP (const char *path, unsigned long long &attr, XrdOucEnv *envP=0)

## Public Attributes

int | m_useDefaultPreadAlg = 0
int | m_useDefaultReadvAlg = 0

## Additional Inherited Members

Static Public Attributes inherited from XrdOss
static const int | PF_csVer = 0x00000001
| verified file checksums present
static const int | PF_csVun = 0x00000002
| unverified file checksums present
static const int | PF_dInfo = 0x00000001
static const int | PF_dNums = 0x00000002
static const int | PF_dStat = 0x00000008
static const int | PF_isLFN = 0x00000004

## Detailed Description

This class implements XrdOss interface for usage with a CEPH storage. It should be loaded via the ofs.osslib directive.

This plugin is able to use any pool of ceph with any userId. There are several ways to provide the pool and userId to be used for a given operation. Here is the ordered list of possibilities. First one defined wins :

- the path can be prepended with userId and pool. Syntax is : [[userId@]pool:]<actual path>
- the XrdOucEnv parameter, when existing, can have 'cephUserId' and/or 'cephPool' entries
- the ofs.osslib directive can provide an argument with format : [userID@]pool
- default are 'admin' and 'default' for userId and pool respectively

Note that the definition of a default via the ofs.osslib directive may clash with one used in a ofs.xattrlib directive. In case both directives have a default and they are different, the behavior is not defined. In case one of the two only has a default, it will be applied for both plugins.

Definition at line 55 of file XrdCephOss.hh.

## Constructor & Destructor Documentation

## XrdCephOss()

XrdCephOss::XrdCephOss | ( | const char * | configfn,
|  | XrdSysError & | Eroute )

Definition at line 156 of file XrdCephOss.cc.

{
Configure(configfn, Eroute);
}
XrdCephOss::Configure
int Configure(const char *, XrdSysError &)
Definition XrdCephOss.cc:168

References Configure().

Here is the call graph for this function:

## ~XrdCephOss()

XrdCephOss::~XrdCephOss | ( |  | ) |

virtual

Definition at line 160 of file XrdCephOss.cc.

{
ceph_posix_disconnect_all();
}
ceph_posix_disconnect_all
void ceph_posix_disconnect_all()
Definition XrdCephPosix.cc:624

References ceph_posix_disconnect_all().

Here is the call graph for this function:

## Member Function Documentation

## Chmod()

int XrdCephOss::Chmod | ( | const char * | path,
|  | mode_t | mode,
|  | XrdOucEnv * | envP = 0 )

virtual

Change file mode settings.

Parameters

  path | - Pointer to the path of the file in question.
  mode | - The new file mode setting.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 381 of file XrdCephOss.cc.

{
return -ENOTSUP;
}

## Configure()

int XrdCephOss::Configure | ( | const char * | configfn,
|  | XrdSysError & | Eroute )

Definition at line 168 of file XrdCephOss.cc.

{
int NoGo = 0;
XrdOucEnv myEnv;
XrdOucStream Config(&Eroute, getenv("XRDINSTANCE"), &myEnv, "=====> ");
//disable posc
XrdOucEnv::Export("XRDXROOTD_NOPOSC", "1");
// If there is no config file, nothing to be done
if (configfn && *configfn) {
// Try to open the configuration file.
int cfgFD;
if ((cfgFD = open(configfn, O_RDONLY, 0)) < 0) {
Eroute.Emsg("Config", errno, "open config file", configfn);
return 1;
}
Config.Attach(cfgFD);
// Now start reading records until eof.
char *var;
while((var = Config.GetMyFirstWord())) {
if (!strncmp(var, "ceph.nbconnections", 18)) {
var = Config.GetWord();
if (var) {
unsigned long value = strtoul(var, 0, 10);
if (value > 0 and value <= 100) {
g_maxCephPoolIdx = value;
} else {
Eroute.Emsg("Config", "Invalid value for ceph.nbconnections in config file (must be between 1 and 100)", configfn, var);
return 1;
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.nbconnections in config file", configfn);
return 1;
}
}
if (!strncmp(var, "ceph.namelib", 12)) {
var = Config.GetWord();
if (var) {
std::string libname = var;
// Warn in case parameters were givne
char parms[1040];
bool hasParms{false};
if (!Config.GetRest(parms, sizeof(parms)) || parms[0]) {
hasParms = true;
}
// Load name lib
XrdOucN2NLoader n2nLoader(&Eroute,configfn,(hasParms?parms:""),NULL,NULL);
g_namelib = n2nLoader.Load(libname.c_str(), XrdVERSIONINFOVAR(XrdOssGetStorageSystem), NULL);
if (!g_namelib) {
Eroute.Emsg("Config", "Unable to load library given in ceph.namelib : %s", var);
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.namelib in config file ", configfn);
return 1;
}
}
int pread_flag_set = !strncmp(var, "ceph.usedefaultpreadalg", 24);
int readv_flag_set = !strncmp(var, "ceph.usedefaultreadvalg", 24);
if (pread_flag_set or readv_flag_set) {
var = Config.GetWord();
if (var) {
char* endptr;
long value = strtol(var, &endptr, 10);
if ((value == 0 || value == 1) && (var != endptr)) {
if (pread_flag_set) {
m_useDefaultPreadAlg = value;
} else if(readv_flag_set) {
m_useDefaultReadvAlg = value;
} else {
Eroute.Emsg("Config", "Bug encountered during parsing", var);
}
} else {
Eroute.Emsg("Config", "Invalid value for ceph.usedefault* in config file -- must be 0 or 1, got", var);
return 1;
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.usedefault* in config file");
return 1;
}
}
if (!strncmp(var, "ceph.aiowaitthresh", 19)) {
var = Config.GetWord();
if (var) {
unsigned long value = strtoul(var, 0, 10);
if ((value > 0) && (value < INT_MAX)){
g_cephAioWaitThresh = value;
} else {
Eroute.Emsg("Config", "Invalid value for ceph.aiowaitthresh:", var);
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.aiowaitthresh in config file");
return 1;
}
}
if (!strncmp(var, "ceph.usebuffer", 14)) { // allowable values: 0, 1
var = Config.GetWord();
if (var) {
unsigned long value = strtoul(var, 0, 10);
if (value <= 1) {
m_configBufferEnable = value;
Eroute.Emsg("Config", "ceph.usebuffer",std::to_string(m_configBufferEnable).c_str());
} else {
Eroute.Emsg("Config", "Invalid value for ceph.usebuffer in config file (must be 0 or 1)", configfn, var);
return 1;
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.usebuffer in config file", configfn);
return 1;
}
} // usebuffer
if (!strncmp(var, "ceph.buffersize", 15)) { // size in bytes
var = Config.GetWord();
if (var) {
unsigned long value = strtoul(var, 0, 10);
if (value > 0 and value <= 1000000000L) {
m_configBufferSize = value;
Eroute.Emsg("Config", "ceph.buffersize", std::to_string(m_configBufferSize).c_str() );
} else {
Eroute.Emsg("Config", "Invalid value for ceph.buffersize in config file; enter in bytes (no units)", configfn, var);
return 1;
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.buffersize in config file", configfn);
return 1;
}
} // buffersize
if (!strncmp(var, "ceph.buffermaxpersimul", 22)) { // size in bytes
var = Config.GetWord();
if (var) {
unsigned long value = strtoul(var, 0, 10);
if (value > 0 and value <= 1000000000L) {
m_configMaxSimulBufferCount = value;
Eroute.Emsg("Config", "ceph.buffermaxpersimul", std::to_string(m_configMaxSimulBufferCount).c_str() );
} else {
Eroute.Emsg("Config", "Invalid value for ceph.buffermaxpersimul in config file; enter in bytes (no units)", configfn, var);
return 1;
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.buffermaxpersimul in config file", configfn);
return 1;
}
} // buffersize
if (!strncmp(var, "ceph.usereadv", 13)) { // allowable values: 0, 1
var = Config.GetWord();
if (var) {
unsigned long value = strtoul(var, 0, 10);
if (value <= 1) {
m_configReadVEnable = value;
Eroute.Emsg("Config", "ceph.usereadvalg",std::to_string(m_configBufferEnable).c_str());
} else {
Eroute.Emsg("Config", "Invalid value for ceph.usereadv in config file (must be 0 or 1)", configfn, var);
return 1;
}
} else {
Eroute.Emsg("Config", "Missing value for ceph.usereadv in config file", configfn);
return 1;
}
} // usereadv
if (!strncmp(var, "ceph.readvalgname", 17)) {
var = Config.GetWord();
// Eroute.Emsg("Config", "readvalgname readvalgname readvalgname readvalgname", var);
if (var) {
// Warn in case parameters were givne
char parms[1040];
if (!Config.GetRest(parms, sizeof(parms)) || parms[0]) {
Eroute.Emsg("Config", "readvalgname parameters will be ignored");
}
m_configReadVAlgName = var;
} else {
Eroute.Emsg("Config", "Missing value for ceph.readvalgname in config file", configfn);
return 1;
}
}
if (!strncmp(var, "ceph.bufferiomode", 17)) {
var = Config.GetWord();
if (var) {
// Warn in case parameters were givne
char parms[1040];
if (!Config.GetRest(parms, sizeof(parms)) || parms[0]) {
Eroute.Emsg("Config", "readvalgname parameters will be ignored");
}
m_configBufferIOmode = var; // allowed values would be aio, io
} else {
Eroute.Emsg("Config", "Missing value for ceph.bufferiomode in config file", configfn);
return 1;
}
}
if (!strcmp(var, "ceph.reportingpools")) {
var = Config.GetWord();
if (var) {
m_configPoolnames = var;
} else {
Eroute.Emsg("Config", "Missing value for ceph.reportingpools in config file", configfn);
return 1;
}
}
} // while
// Now check if any errors occurred during file i/o
int retc = Config.LastError();
if (retc) {
NoGo = Eroute.Emsg("Config", -retc, "read config file",
configfn);
}
Config.Close();
}
return NoGo;
}
g_namelib
XrdOucName2Name * g_namelib
Definition XrdCephPosix.cc:98
XrdOssGetStorageSystem
XrdOss * XrdOssGetStorageSystem(XrdOss *native_oss, XrdSysLogger *lp, const char *config_fn, const char *parms)
Definition XrdCephOss.cc:134
g_maxCephPoolIdx
unsigned int g_maxCephPoolIdx
Definition XrdCephPosix.cc:95
g_cephAioWaitThresh
unsigned int g_cephAioWaitThresh
Definition XrdCephPosix.cc:91
open
#define open
Definition XrdPosix.hh:76
XrdCephOss::m_useDefaultPreadAlg
int m_useDefaultPreadAlg
Definition XrdCephOss.hh:78
XrdCephOss::m_useDefaultReadvAlg
int m_useDefaultReadvAlg
Definition XrdCephOss.hh:80
XrdOucEnv::Export
static int Export(const char *Var, const char *Val)
Definition XrdOucEnv.cc:170
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95
XrdCms::Config
XrdCmsConfig Config
Definition XrdCmsConfig.cc:108

References XrdSysError::Emsg(), XrdOucEnv::Export(), g_cephAioWaitThresh, g_maxCephPoolIdx, g_namelib, XrdOucN2NLoader::Load(), m_useDefaultPreadAlg, m_useDefaultReadvAlg, open, and XrdOssGetStorageSystem().

Referenced by XrdCephOss().

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

## Create()

int XrdCephOss::Create | ( | const char * | tid,
|  | const char * | path,
|  | mode_t | mode,
|  | XrdOucEnv & | env,
|  | int | opts = 0 )

virtual

Create file.

Parameters

  tid | - Pointer to the trace identifier.
  path | - Pointer to the path of the file to create.
  mode | - The new file mode setting.
  env | - Reference to environmental information.
  opts | - Create options: XRDOSS_mkpath - create dir path if it does not exist. XRDOSS_new - the file must not already exist. oflags<<8 - open flags shifted 8 bits to the left/

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 385 of file XrdCephOss.cc.

{
return -ENOTSUP;
}

References tident.

## Init()

int XrdCephOss::Init | ( | XrdSysLogger * | lp,
|  | const char * | cfn )

virtual

Initialize the storage system V1 (deprecated).

Parameters

  lp | - Pointer to the message logging object.
  cfn | - Pointer to the configuration file.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 390 of file XrdCephOss.cc.

{ return 0; }

## Mkdir()

int XrdCephOss::Mkdir | ( | const char * | path,
|  | mode_t | mode,
|  | int | mkpath = 0,
|  | XrdOucEnv * | envP = 0 )

virtual

Create a directory.

Parameters

  path | - Pointer to the path of the directory to be created.
  mode | - The directory mode setting.
  mkpath | - When true the path is created if it does not exist.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 393 of file XrdCephOss.cc.

{
return 0;
}

## newDir()

XrdOssDF * XrdCephOss::newDir | ( | const char * | tident | ) |

virtual

Obtain a new director object to be used for future directory requests.

Parameters

  tident | - The trace identifier.

Returns
  pointer- Pointer to an XrdOssDF object.
  nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 658 of file XrdCephOss.cc.

{
return new XrdCephOssDir(this);
}

References tident.

## newFile()

XrdOssDF * XrdCephOss::newFile | ( | const char * | tident | ) |

virtual

Obtain a new file object to be used for a future file requests.

Parameters

  tident | - The trace identifier.

Returns
  pointer- Pointer to an XrdOssDF object.
  nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 662 of file XrdCephOss.cc.

{
// Depending on the configuration settings stack up the underlying
// XrdCephOssFile instance with decorator objects for readV and Buffering requests
XrdCephOssFile* xrdCephOssDF = new XrdCephOssFile(this);
if (m_configReadVEnable) {
xrdCephOssDF = new XrdCephOssReadVFile(this,xrdCephOssDF,m_configReadVAlgName);
}
if (m_configBufferEnable) {
xrdCephOssDF = new XrdCephOssBufferedFile(this,xrdCephOssDF, m_configBufferSize,
m_configBufferIOmode, m_configMaxSimulBufferCount);
}
return xrdCephOssDF;
}

References tident.

## Remdir()

int XrdCephOss::Remdir | ( | const char * | path,
|  | int | Opts = 0,
|  | XrdOucEnv * | envP = 0 )

virtual

Relocate/Copy the file at `path' to a new location.

Parameters

  tident | - -> trace identifier for this operation.
  path | - -> fully qualified name of the file to relocate.
  cgName | - -> target space name[:path]
  anchor | - Processing directions (see XrdOssReloc.cc example).

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh). //--------------------------------------------------------------------------—

virtual int Reloc(const char *tident, const char *path, */ const char *cgName, const char *anchor=0);

/*! Remove a directory.

Parameters

  path | - Pointer to the path of the directory to be removed.
  Opts | - The processing options: XRDOSS_Online - only remove online copy XRDOSS_isPFN - path is already translated.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 398 of file XrdCephOss.cc.

{
return 0;
}

## Rename()

int XrdCephOss::Rename | ( | const char * | oPath,
|  | const char * | nPath,
|  | XrdOucEnv * | oEnvP = 0,
|  | XrdOucEnv * | nEnvP = 0 )

virtual

Rename a file or directory.

Parameters

  oPath | - Pointer to the path to be renamed.
  nPath | - Pointer to the path oPath is to have.
  oEnvP | - Environmental information for oPath.
  nEnvP | - Environmental information for nPath.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 402 of file XrdCephOss.cc.

{
return -ENOTSUP;
}

## Stat()

int XrdCephOss::Stat | ( | const char * | path,
|  | struct stat * | buff,
|  | int | opts = 0,
|  | XrdOucEnv * | env = 0 )

virtual

Return status information for an object ID.

Populate a struct stat* with information on an object ID. Determine whether the request relates to a pool name for disk space reporting via StatLS. If not, handle an object path or the notional root element "/"

Parameters

  (in) | path the object ID
  (out) | buff receive the status information
  (in) | opts not used
  (in) | env not used

Implementation of enhancements: Jyothish Thomas STFC RAL, jyoth.nosp@m.ish..nosp@m.thoma.nosp@m.s@st.nosp@m.fc.ac.nosp@m..uk, 2022 Ian Johnson STFC RAL, ian.j.nosp@m.ohns.nosp@m.on@st.nosp@m.fc.a.nosp@m.c.uk, 2022, 2023

Implements XrdOss.

Definition at line 454 of file XrdCephOss.cc.

{
XrdCephEroute.Say(__FUNCTION__, " path = ", path);
std::string spath {path};
m_translateFileName(spath,path);
if (spath.back() == '/') { // Request to stat the root
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, " - fake a return for stat'ing root element '/'");
#endif
// special case of a stat made by the locate interface
// we intend to then list all files
memset(buff, 0, sizeof(*buff));
buff->st_mode = S_IFDIR|S_IRWXU;
buff->st_dev = 1;
buff->st_ino = 1;
return XrdOssOK;
}
if (spath.find_first_of(":") == spath.length()-1) { // Request to stat just the pool name
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, "Found request to stat pool name");
#endif
spath.pop_back(); // remove colon from pool name
if (m_configPoolnames.find(spath) != std::string::npos) { // Support 'locate' for spaceinfo
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, " - preparing spaceinfo report for '", path, "'");
#endif
return XrdOssOK; // Only requires a status code, do not need to fill contents in struct stat
} else {
XrdCephEroute.Say(__FUNCTION__, " - cannot find pool '", path, "' in ceph.reportingpools");
return -EINVAL;
}
} else if (ceph_posix_stat(env, path, buff) == 0) { // Found object ID
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, " - found object ", spath.c_str(), " via ceph_posix_stat");
#endif
return XrdOssOK;
} else {
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, " - cannot find object '", spath.c_str(), "'");
#endif
return -ENOENT;
}
}
m_translateFileName
void m_translateFileName(std::string &physName, std::string logName)
converts a logical filename to physical one if needed
Definition XrdCephOss.cc:74
XrdCephEroute
XrdSysError XrdCephEroute(0)
Definition XrdCephOss.cc:50
ceph_posix_stat
int ceph_posix_stat(XrdOucEnv *env, const char *pathname, struct stat *buf)
Definition XrdCephPosix.cc:1243
XrdOssOK
#define XrdOssOK
Definition XrdOss.hh:50
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 ceph_posix_stat(), m_translateFileName(), opts, stat, XrdCephEroute, and XrdOssOK.

Here is the call graph for this function:

## StatFS()

int XrdCephOss::StatFS | ( | const char * | path,
|  | char * | buff,
|  | int & | blen,
|  | XrdOucEnv * | envP = 0 )

virtual

Return filesystem physical space information associated with a path.

Parameters

  path | - Path in the partition in question.
  buff | - Pointer to the buffer to hold the information.
  blen | - Length of the buffer. This is updated with the actual number of bytes placed in the buffer as in snprintf().
  envP | - Pointer to environmental information.

Returns
  "<wval> <fsp> <utl> <sval> <fsp> <utl>" where: <wval> is "0" if XRDEXP_NOTRW specified, otherwise "1" <fsp> is free space in megabytes. <utl> is percentage utilization (i.e. allocated space) <sval> is "1' if XRDEXP_STAGE specified, otherwise "0" Upon failure -errno or -osserr (see XrdOssError.hh) returned.

Reimplemented from XrdOss.

Definition at line 524 of file XrdCephOss.cc.

{
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, " path = ", path);
#endif
XrdOssVSInfo sP;
int rc = StatVS(&sP, 0, 0);
if (rc) {
return rc;
}
int percentUsedSpace = (sP.Usage*100)/sP.Total;
blen = snprintf(buff, blen, "%d %lld %d %d %lld %d",
1, sP.Free, percentUsedSpace, 0, 0LL, 0);
return XrdOssOK;
}
XrdCephOss::StatVS
virtual int StatVS(XrdOssVSInfo *sP, const char *sname=0, int updt=0)
Definition XrdCephOss.cc:540
XrdOssVSInfo::Usage
long long Usage
Definition XrdOssVS.hh:94
XrdOssVSInfo::Total
long long Total
Definition XrdOssVS.hh:90
XrdOssVSInfo::Free
long long Free
Definition XrdOssVS.hh:91

References XrdOssVSInfo::Free, StatVS(), XrdOssVSInfo::Total, XrdOssVSInfo::Usage, XrdCephEroute, and XrdOssOK.

Here is the call graph for this function:

## StatLS()

int XrdCephOss::StatLS | ( | XrdOucEnv & | env,
|  | const char * | charPath,
|  | char * | buff,
|  | int & | blen )

virtual

Report on disk space use in this pool.

Handle a request for the amount of space used in a Ceph pool

Parameters

  (in) | env not used
  (in) | path name of the pool
  (out) | buff location for string containing OSS key-value pairs for disk space used, free, etc
  (out) | blen set to length of buff

Implementation: Jyothish Thomas STFC RAL, jyoth.nosp@m.ish..nosp@m.thoma.nosp@m.s@st.nosp@m.fc.ac.nosp@m..uk, 2022 Ian Johnson STFC RAL, ian.j.nosp@m.ohns.nosp@m.on@st.nosp@m.fc.a.nosp@m.c.uk, 2022, 2023

Reimplemented from XrdOss.

Definition at line 581 of file XrdCephOss.cc.

{
XrdCephEroute.Say(__FUNCTION__, " incoming path = ", charPath);
std::string path(charPath);
path = extractPool(path);
std::string spath {path};
m_translateFileName(spath,path);
//
// Following test is now redundant as we take the substring up to colonPos
//
if (spath.back() == ':') {
spath.pop_back();
}
if (m_configPoolnames.find(spath) == std::string::npos) {
XrdCephEroute.Say("Can't report on ", spath.c_str());
return -EINVAL;
}
long long usedSpace, totalSpace, freeSpace;
if (ceph_posix_stat_pool(spath.c_str(), &usedSpace) != 0) {
XrdCephEroute.Say("Failed to get used space in pool ", spath.c_str());
return -EINVAL;
}
// Construct the object path
std::string spaceInfoPath = spath + ":" + (const char *)"__spaceinfo__";
totalSpace = getNumericAttr(spaceInfoPath.c_str(), "total_space", 24);
if (totalSpace < 0) {
XrdCephEroute.Say("Could not get 'total_space' attribute from ", spaceInfoPath.c_str());
return -EINVAL;
}
//
// Figure for 'usedSpace' already accounts for Erasure Coding overhead
//
freeSpace = totalSpace - usedSpace;
blen = formatStatLSResponse(buff, blen,
spath.c_str(), /* "oss.cgroup" */
totalSpace, /* "oss.space" */
usedSpace, /* "oss.used" */
freeSpace, /* "oss.free" */
totalSpace, /* "oss.quota" */
freeSpace /* "oss.maxf" */);
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, "space info = \n", buff);
#endif
return XrdOssOK;
}
formatStatLSResponse
int formatStatLSResponse(char *buff, int &blen, const char *cgroup, long long totalSpace, long long usedSpace, long long freeSpace, long long quota, long long maxFreeChunk)
Definition XrdCephOss.cc:556
getNumericAttr
ssize_t getNumericAttr(const char *const path, const char *attrName, const int maxAttrLen)
Retrieve an integer-value extended attribute.
Definition XrdCephOss.cc:104
extractPool
std::string extractPool(std::string possPool)
Extract a pool name (string before the first colon ':') from an object ID.
Definition XrdCephOss.cc:421
ceph_posix_stat_pool
int ceph_posix_stat_pool(char const *poolName, long long *usedSpace)
Return the amount of space used in a pool.
Definition XrdCephPosix.cc:1491

References ceph_posix_stat_pool(), extractPool(), formatStatLSResponse(), getNumericAttr(), m_translateFileName(), XrdCephEroute, and XrdOssOK.

Here is the call graph for this function:

## StatVS()

int XrdCephOss::StatVS | ( | XrdOssVSInfo * | vsP,
|  | const char * | sname = 0,
|  | int | updt = 0 )

virtual

Return space information for a space name.

Parameters

  vsP | - Pointer to the XrdOssVSInfo object to hold results. It should be fully initialized (i.e. a new copy).
  sname | - Pointer to the space name. If the name starts with a plus (e.g. "+public"), partition information is returned, should it exist. If nil, space information for all spaces is returned. See, XrdOssVS.hh for more info.
  updt | - When true, a space update occurrs prior to a query.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 540 of file XrdCephOss.cc.

{
#ifdef STAT_TRACE
XrdCephEroute.Say(__FUNCTION__, " path = ", sname);
#endif
int rc = ceph_posix_statfs(&(sP->Total), &(sP->Free));
if (rc) {
return rc;
}
sP->Large = sP->Total;
sP->LFree = sP->Free;
sP->Usage = sP->Total-sP->Free;
sP->Extents = 1;
return XrdOssOK;
}
ceph_posix_statfs
int ceph_posix_statfs(long long *totalSpace, long long *freeSpace)
Definition XrdCephPosix.cc:1454

References ceph_posix_statfs(), XrdOssVSInfo::Extents, XrdOssVSInfo::Free, XrdOssVSInfo::Large, XrdOssVSInfo::LFree, XrdOssVSInfo::Total, XrdOssVSInfo::Usage, XrdCephEroute, and XrdOssOK.

Referenced by StatFS().

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

## Truncate()

int XrdCephOss::Truncate | ( | const char * | path,
|  | unsigned long long | fsize,
|  | XrdOucEnv * | envP = 0 )

virtual

Truncate a file.

Parameters

  path | - Pointer to the path of the file to be truncated.
  fsize | - The size that the file is to have.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 638 of file XrdCephOss.cc.

{
try {
return ceph_posix_truncate(env, path, size);
} catch (std::exception &e) {
XrdCephEroute.Say("truncate : invalid syntax in file parameters");
return -EINVAL;
}
}
ceph_posix_truncate
int ceph_posix_truncate(XrdOucEnv *env, const char *pathname, unsigned long long size)
Definition XrdCephPosix.cc:1535

References ceph_posix_truncate(), and XrdCephEroute.

Here is the call graph for this function:

## Unlink()

int XrdCephOss::Unlink | ( | const char * | path,
|  | int | Opts = 0,
|  | XrdOucEnv * | envP = 0 )

virtual

Remove a file.

Parameters

  path | - Pointer to the path of the file to be removed.
  Opts | - Options: XRDOSS_isMIG - this is a migratable path. XRDOSS_isPFN - do not apply name2name to path. XRDOSS_Online - remove only the online copy.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 649 of file XrdCephOss.cc.

{
try {
return ceph_posix_unlink(env, path);
} catch (std::exception &e) {
XrdCephEroute.Say("unlink : invalid syntax in file parameters");
return -EINVAL;
}
}
ceph_posix_unlink
int ceph_posix_unlink(XrdOucEnv *env, const char *pathname)
Definition XrdCephPosix.cc:1542

References ceph_posix_unlink(), and XrdCephEroute.

Here is the call graph for this function:

## Member Data Documentation

## m_useDefaultPreadAlg

int XrdCephOss::m_useDefaultPreadAlg = 0

Definition at line 78 of file XrdCephOss.hh.

Referenced by Configure().

## m_useDefaultReadvAlg

int XrdCephOss::m_useDefaultReadvAlg = 0

Definition at line 80 of file XrdCephOss.hh.

Referenced by Configure().

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

- XrdCephOss.hh
- XrdCephOss.cc