Loading...
Searching...
No Matches
XrdOssCsiFile Class Reference

`#include <XrdOssCsi.hh>`

Inheritance diagram for XrdOssCsiFile:
Collaboration diagram for XrdOssCsiFile:

## Classes

struct | puMapItem_t

## Public Member Functions

| XrdOssCsiFile (XrdOss *parent, const char *tid, XrdOssCsiConfig &cf)
virtual | ~XrdOssCsiFile ()
void | aioDec ()
void | aioInc ()
void | aioWait ()
virtual int | Close (long long *retsz=0)
virtual void | Flush ()
| Flush filesystem cached pages for this file (used for checksums).
virtual int | Fstat (struct stat *)
virtual int | Fsync ()
virtual int | Fsync (XrdSfsAio *)
virtual int | Ftruncate (unsigned long long)
virtual int | getFD ()
virtual off_t | getMmap (void **addr)
virtual int | Open (const char *, int, mode_t, XrdOucEnv &)
XrdOssCsiPages * | Pages ()
virtual ssize_t | pgRead (void *, off_t, size_t, uint32_t *, uint64_t)
virtual int | pgRead (XrdSfsAio *, uint64_t)
virtual ssize_t | pgWrite (void *, off_t, size_t, uint32_t *, uint64_t)
virtual int | pgWrite (XrdSfsAio *, uint64_t)
virtual ssize_t | Read (off_t, size_t)
virtual ssize_t | Read (void *, off_t, size_t)
virtual int | Read (XrdSfsAio *)
virtual ssize_t | ReadRaw (void *, off_t, size_t)
virtual ssize_t | ReadV (XrdOucIOVec *readV, int n)
int | VerificationStatus ()
virtual ssize_t | Write (const void *, off_t, size_t)
virtual int | Write (XrdSfsAio *)
virtual ssize_t | WriteV (XrdOucIOVec *writeV, int n)
Public Member Functions inherited from XrdOssDFHandler
| XrdOssDFHandler (XrdOssDF *successor)
virtual | ~XrdOssDFHandler ()
virtual int | Fchmod (mode_t Mode)
virtual int | Fctl (int cmd, int alen, const char *args, char **resp=0)
virtual const char * | getTID ()
virtual int | isCompressed (char *cxidp=0)
virtual int | Opendir (const char *dir_path, XrdOucEnv &Env)
virtual int | Readdir (char *buff, int blen)
virtual int | StatRet (struct stat *buff)
Public Member Functions inherited from XrdOssDF
| XrdOssDF (const char *tid="", uint16_t dftype=0, int fdnum=-1)
virtual | ~XrdOssDF ()
uint16_t | DFType ()

## Static Public Member Functions

static int | mapRelease (std::shared_ptr< puMapItem_t > &, XrdSysMutexHelper *plck=NULL)
static void | mapTake (const std::string &, std::shared_ptr< puMapItem_t > &, bool create=true)

## Static Public Attributes

static std::unordered_map< std::string, std::shared_ptr< puMapItem_t > > | pumap_
static XrdSysMutex | pumtx_
Static Public Attributes inherited from XrdOssDF
static const uint16_t | DF_isDir = 0x0001
| Object is for a directory.
static const uint16_t | DF_isFile = 0x0002
| Object is for a file.
static const uint16_t | DF_isProxy = 0x0010
| Object is a proxy object.
static const uint64_t | doCalc = 0x4000000000000000ULL
| pgw: Calculate checksums
static const int | Fctl_ckpObj = 0
static const int | Fctl_utimes = 1
static const uint64_t | Verify = 0x8000000000000000ULL
| all: Verify checksums

## Friends

class | XrdOssCsiFileAio
class | XrdOssCsiFileAioJob

## Additional Inherited Members

Protected Attributes inherited from XrdOssDFHandler
XrdOssDF * | successor_
Protected Attributes inherited from XrdOssDF
uint16_t | dfType
int | fd
off_t | pgwEOF
short | rsvd
const char * | tident

## Detailed Description

Definition at line 73 of file XrdOssCsi.hh.

## Constructor & Destructor Documentation

## XrdOssCsiFile()

XrdOssCsiFile::XrdOssCsiFile | ( | XrdOss * | parent,
|  | const char * | tid,
|  | XrdOssCsiConfig & | cf )

inline

Definition at line 106 of file XrdOssCsi.hh.

:
XrdOssDFHandler(parent->newFile(tid)), parentOss_(parent), tident(tid), config_(cf),
rdonly_(false), aioCntCond_(0), aioCnt_(0), aioCntWaiters_(0) { }
parent
static void parent()
Definition XrdClDefaultEnv.cc:80
XrdOssDFHandler::XrdOssDFHandler
XrdOssDFHandler(XrdOssDF *successor)
Definition XrdOssHandler.hh:77
XrdOssDF::tident
const char * tident
Definition XrdOss.hh:453

References XrdOssDFHandler::XrdOssDFHandler(), and parent().

Here is the call graph for this function:

## ~XrdOssCsiFile()

XrdOssCsiFile::~XrdOssCsiFile | ( |  | ) |

virtual

Definition at line 178 of file XrdOssCsiFile.cc.

{
if (pmi_)
{
(void)Close();
}
}
XrdOssCsiFile::Close
virtual int Close(long long *retsz=0)
Definition XrdOssCsiFile.cc:186

References Close().

Here is the call graph for this function:

## Member Function Documentation

## aioDec()

void XrdOssCsiFile::aioDec | ( |  | ) |

inline

Definition at line 120 of file XrdOssCsi.hh.

{
XrdSysCondVarHelper lck(&aioCntCond_);
if (--aioCnt_ == 0 && aioCntWaiters_>0)
aioCntCond_.Broadcast();
}

Referenced by XrdOssCsiFileAio::Recycle().

Here is the caller graph for this function:

## aioInc()

void XrdOssCsiFile::aioInc | ( |  | ) |

inline

Definition at line 111 of file XrdOssCsi.hh.

{
XrdSysCondVarHelper lck(&aioCntCond_);
while(aioCntWaiters_>0)
{
aioCntCond_.Wait();
}
++aioCnt_;
}

## aioWait()

void XrdOssCsiFile::aioWait | ( |  | ) |

inline

Definition at line 126 of file XrdOssCsi.hh.

{
XrdSysCondVarHelper lck(&aioCntCond_);
++aioCntWaiters_;
while(aioCnt_>0)
{
aioCntCond_.Wait();
}
--aioCntWaiters_;
aioCntCond_.Broadcast();
}

Referenced by Close(), and Fsync().

Here is the caller graph for this function:

## Close()

int XrdOssCsiFile::Close | ( | long long * | retsz = 0 | ) |

virtual

Close a directory or file.

Parameters

  retsz | If not nil, where the size of the file is to be returned.

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

Reimplemented from XrdOssDFHandler.

Definition at line 186 of file XrdOssCsiFile.cc.

{
if (!pmi_)
{
return -EBADF;
}
// wait for any ongoing aios to finish
aioWait();
const int cpret = pageMapClose();
const int csret = successor_->Close(retsz);
if (cpret<0) return cpret;
return csret;
}
XrdOssCsiFile::aioWait
void aioWait()
Definition XrdOssCsi.hh:126
XrdOssDFHandler::successor_
XrdOssDF * successor_
Definition XrdOssHandler.hh:81

References aioWait(), and XrdOssDFHandler::successor_.

Referenced by ~XrdOssCsiFile(), and Open().

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

## Flush()

void XrdOssCsiFile::Flush | ( |  | ) |

virtual

Flush filesystem cached pages for this file (used for checksums).

Reimplemented from XrdOssDFHandler.

Definition at line 598 of file XrdOssCsiFile.cc.

{
if (!pmi_) return;
Pages()->Flush();
successor_->Flush();
}
XrdOssCsiFile::Pages
XrdOssCsiPages * Pages()
Definition XrdOssCsi.hh:140
XrdOssCsiPages::Flush
void Flush()
Definition XrdOssCsiPages.cc:98

References XrdOssCsiPages::Flush(), Pages(), and XrdOssDFHandler::successor_.

Here is the call graph for this function:

## Fstat()

int XrdOssCsiFile::Fstat | ( | struct stat * | buf | ) |

virtual

Return state information for this file.

Parameters

  buf | - Pointer to the structure where info it to be returned.

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

Reimplemented from XrdOssDFHandler.

Definition at line 575 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
XrdOssCsiPages::Sizes_t sizes;
const int tsret = Pages()->TrackedSizesGet(sizes, false);
const int fsret = successor_->Fstat(buff);
if (fsret<0) return fsret;
if (tsret<0) return 0;
buff->st_size = std::max(sizes.first, sizes.second);
return 0;
}
XrdOssCsiPages::Sizes_t
std::pair< off_t, off_t > Sizes_t
Definition XrdOssCsiPages.hh:49
XrdOssCsiPages::TrackedSizesGet
int TrackedSizesGet(Sizes_t &, bool)
Definition XrdOssCsiPages.cc:109

References Pages(), stat, XrdOssDFHandler::successor_, and XrdOssCsiPages::TrackedSizesGet().

Here is the call graph for this function:

## Fsync() [1/2]

int XrdOssCsiFile::Fsync | ( | void |  | ) |

virtual

Synchronize associated file with media (synchronous).

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

Reimplemented from XrdOssDFHandler.

Definition at line 542 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
const int psret = Pages()->Fsync();
const int ssret = successor_->Fsync();
if (psret<0) return psret;
return ssret;
}
XrdOssCsiPages::Fsync
int Fsync()
Definition XrdOssCsiPages.cc:103

References XrdOssCsiPages::Fsync(), Pages(), and XrdOssDFHandler::successor_.

Referenced by Fsync().

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

## Fsync() [2/2]

int XrdOssCsiFile::Fsync | ( | XrdSfsAio * | aiop | ) |

virtual

Synchronize associated file with media (asynchronous).

Parameters

  aiop | - Pointer to async I/O request object.

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

Reimplemented from XrdOssDFHandler.

Definition at line 115 of file XrdOssCsiFileAio.cc.

{
aioWait();
aiop->Result = this->Fsync();
aiop->doneWrite();
return 0;
}
XrdOssCsiFile::Fsync
virtual int Fsync()
Definition XrdOssCsiFile.cc:542
XrdSfsAio::Result
ssize_t Result
Definition XrdSfsAio.hh:65
XrdSfsAio::doneWrite
virtual void doneWrite()=0

References aioWait(), XrdSfsAio::doneWrite(), Fsync(), and XrdSfsAio::Result.

Here is the call graph for this function:

## Ftruncate()

int XrdOssCsiFile::Ftruncate | ( | unsigned long long | flen | ) |

virtual

Set the size of the associated file.

Parameters

  flen | - The new size of the file.

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

Reimplemented from XrdOssDFHandler.

Definition at line 552 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
if (rdonly_) return -EBADF;
XrdOssCsiRangeGuard rg;
Pages()->LockTrackinglen(rg, flen, LLONG_MAX, false);
int ret = Pages()->truncate(successor_, flen, rg);
if (ret<0)
{
rg.ReleaseAll();
resyncSizes();
return ret;
}
ret = successor_->Ftruncate(flen);
if (ret<0)
{
rg.ReleaseAll();
resyncSizes();
}
return ret;
}
XrdOssCsiPages::truncate
int truncate(XrdOssDF *, off_t, XrdOssCsiRangeGuard &)
Definition XrdOssCsiPages.cc:543
XrdOssCsiPages::LockTrackinglen
void LockTrackinglen(XrdOssCsiRangeGuard &, off_t, off_t, bool)
Definition XrdOssCsiPages.cc:499
XrdOssCsiRangeGuard::ReleaseAll
void ReleaseAll()
Definition XrdOssCsiRanges.cc:37

References XrdOssCsiPages::LockTrackinglen(), Pages(), XrdOssCsiRangeGuard::ReleaseAll(), XrdOssDFHandler::successor_, and XrdOssCsiPages::truncate().

Here is the call graph for this function:

## getFD()

virtual int XrdOssCsiFile::getFD | ( |  | ) |

inline virtual

Return the underlying file descriptor.

Returns
  -1 if there is no file descriptor or a non-negative FD number.

Reimplemented from XrdOssDFHandler.

Definition at line 83 of file XrdOssCsi.hh.

{ return successor_->getFD(); }

References XrdOssDFHandler::successor_.

## getMmap()

virtual off_t XrdOssCsiFile::getMmap | ( | void ** | addr | ) |

inline virtual

Return the memory mapped characteristics of the file.

Parameters

  addr | - Pointer to where the memory mapped address is to be returned.

Returns
  If mapped, the size of the file is returned and it memory location is placed in addr. Otherwise, addr is set to zero and zero is returned. Note that zero length files cannot be memory mapped.

Reimplemented from XrdOssDFHandler.

Definition at line 82 of file XrdOssCsi.hh.

{ if (addr) *addr = 0; return 0; }

## mapRelease()

int XrdOssCsiFile::mapRelease | ( | std::shared_ptr< puMapItem_t > & | pmi,
|  | XrdSysMutexHelper * | plck = NULL )

static

Definition at line 109 of file XrdOssCsiFile.cc.

{
XrdSysMutexHelper lck(pumtx_);
pmi->refcount--;
auto mapidx = pumap_.find(pmi->tpath);
if (pmi->refcount == 0 || pmi->unlinked)
{
if (mapidx != pumap_.end() && mapidx->second == pmi)
{
pumap_.erase(mapidx);
}
}
if (plck) plck->UnLock();
return (pmi->refcount == 0) ? 1 : 0;
}
XrdOssCsiFile::pumtx_
static XrdSysMutex pumtx_
Definition XrdOssCsi.hh:159
XrdOssCsiFile::pumap_
static std::unordered_map< std::string, std::shared_ptr< puMapItem_t > > pumap_
Definition XrdOssCsi.hh:160
XrdSysMutexHelper::UnLock
void UnLock()
Definition XrdSysPthread.hh:274

References pumap_, pumtx_, and XrdSysMutexHelper::UnLock().

Referenced by XrdOssCsi::Create(), XrdOssCsi::Rename(), and XrdOssCsi::Unlink().

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

## mapTake()

void XrdOssCsiFile::mapTake | ( | const std::string & | key,
|  | std::shared_ptr< puMapItem_t > & | pmi,
|  | bool | create = true )

static

Definition at line 88 of file XrdOssCsiFile.cc.

{
XrdSysMutexHelper lck(pumtx_);
auto mapidx = pumap_.find(key);
if (mapidx == pumap_.end())
{
if (!create) return;
pmi.reset(new puMapItem_t());
pmi->tpath = key;
if (!key.empty())
{
pumap_.insert(std::make_pair(key, pmi));
}
}
else
{
pmi = mapidx->second;
}
pmi->refcount++;
}
XrdOssCsiFile::puMapItem_t
Definition XrdOssCsi.hh:144

References pumap_, and pumtx_.

Referenced by XrdOssCsi::Create(), XrdOssCsi::Rename(), and XrdOssCsi::Unlink().

Here is the caller graph for this function:

## Open()

int XrdOssCsiFile::Open | ( | const char * | path,
|  | int | Oflag,
|  | mode_t | Mode,
|  | XrdOucEnv & | env )

virtual

Open a file.

Parameters

  path | - Pointer to the path of the file to be opened.
  Oflag | - Standard open flags.
  Mode | - File open mode (ignored unless creating a file).
  env | - Reference to environmental information.

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

Reimplemented from XrdOssDFHandler.

Definition at line 286 of file XrdOssCsiFile.cc.

{
char cxid[4];
if (pmi_)
{
// already open
return -EINVAL;
}
if (!path)
{
return -EINVAL;
}
if (config_.tagParam_.isTagFile(path))
{
if ((Oflag & O_CREAT)) return -EACCES;
return -ENOENT;
}
int dflags = Oflag;
if ((dflags & O_ACCMODE) == O_WRONLY)
{
// for non-aligned writes it may be needed to do read-modify-write
dflags &= ~O_ACCMODE;
dflags |= O_RDWR;
}
rdonly_ = true;
if ((dflags & O_ACCMODE) != O_RDONLY)
{
rdonly_ = false;
}
const int oret = pageAndFileOpen(path, dflags, Oflag, Mode, Env);
if (oret<0)
{
return oret;
}
if (successor_->isCompressed(cxid)>0)
{
(void)Close();
return -ENOTSUP;
}
if (Pages()->IsReadOnly() && !rdonly_)
{
(void)Close();
return -EACCES;
}
return XrdOssOK;
}
XrdOssOK
#define XrdOssOK
Definition XrdOss.hh:50
Mode
int Mode
Definition XrdSecgsiProxy.cc:94

References Close(), Mode, Pages(), XrdOssDFHandler::successor_, and XrdOssOK.

Here is the call graph for this function:

## Pages()

XrdOssCsiPages * XrdOssCsiFile::Pages | ( |  | ) |

inline

Definition at line 140 of file XrdOssCsi.hh.

{
return pmi_->pages.get();
}

Referenced by Flush(), Fstat(), Fsync(), Ftruncate(), Open(), pgRead(), pgWrite(), Read(), ReadRaw(), ReadV(), VerificationStatus(), Write(), and WriteV().

Here is the caller graph for this function:

## pgRead() [1/2]

ssize_t XrdOssCsiFile::pgRead | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | rdlen,
|  | uint32_t * | csvec,
|  | uint64_t | opts )

virtual

Reimplemented from XrdOssDFHandler.

Definition at line 475 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
XrdOssCsiRangeGuard rg;
Pages()->LockTrackinglen(rg, offset, offset+rdlen, true);
// if we return a short amount of data the caller will have to deal with
// joining csvec values from repeated reads: for simplicity try to read as
// such as possible up to the request read length
ssize_t toread = rdlen;
ssize_t bread = 0;
uint8_t *const p = (uint8_t*)buffer;
do
{
ssize_t rret = successor_->Read(&p[bread], offset+bread, toread);
if (rret<0) return rret;
if (rret==0) break;
toread -= rret;
bread += rret;
} while(toread>0);
if (rdlen == 0) return bread;
ssize_t puret = Pages()->FetchRange(successor_, buffer, offset, bread, csvec, opts, rg);
if (puret<0) return puret;
return bread;
}
opts
struct myOpts opts
XrdOssCsiPages::FetchRange
int FetchRange(XrdOssDF *, const void *, off_t, size_t, uint32_t *, uint64_t, XrdOssCsiRangeGuard &)
Definition XrdOssCsiPages.cc:627

References XrdOssCsiPages::FetchRange(), XrdOssCsiPages::LockTrackinglen(), opts, Pages(), and XrdOssDFHandler::successor_.

Here is the call graph for this function:

## pgRead() [2/2]

int XrdOssCsiFile::pgRead | ( | XrdSfsAio * | aioparm,
|  | uint64_t | opts )

virtual

Read file pages and checksums using asynchronous I/O.

Parameters

  aioparm | - Pointer to async I/O object controlling the I/O.
  opts | - Processing options (see above).

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

Reimplemented from XrdOssDFHandler.

Definition at line 81 of file XrdOssCsiFileAio.cc.

{
if (!pmi_) return -EBADF;
XrdOssCsiFileAio *nio = XrdOssCsiFileAio::Alloc(&aiostore_);
nio->Init(aioparm, this, true, opts, true);
nio->SchedReadJob();
return 0;
}
XrdOssCsiFileAio::SchedReadJob
void SchedReadJob()
Definition XrdOssCsiFileAio.hh:200
XrdOssCsiFileAio::Alloc
static XrdOssCsiFileAio * Alloc(XrdOssCsiFileAioStore *store)
Definition XrdOssCsiFileAio.hh:171
XrdOssCsiFileAio::Init
void Init(XrdSfsAio *aiop, XrdOssCsiFile *file, bool isPgOp, uint64_t opts, bool isread)
Definition XrdOssCsiFileAio.hh:153
XrdOssCsiFile::XrdOssCsiFileAio
friend class XrdOssCsiFileAio
Definition XrdOssCsi.hh:75

References XrdOssCsiFileAio::Alloc(), XrdOssCsiFileAio::Init(), opts, XrdOssCsiFileAio::SchedReadJob(), and XrdOssCsiFileAio.

Here is the call graph for this function:

## pgWrite() [1/2]

ssize_t XrdOssCsiFile::pgWrite | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | wrlen,
|  | uint32_t * | csvec,
|  | uint64_t | opts )

virtual

Write file pages into a file with corresponding checksums.

Parameters

  buffer | - pointer to buffer containing the bytes to write.
  offset | - The offset where the write is to start.
  wrlen | - The number of bytes to write.
  csvec | - A vector which contains the corresponding CRC32 checksum for each page. See XrdOucPgrwUtils::csNum() for sizing.
  opts | - Processing options (see above).

Returns
  >= 0 The number of bytes written upon success. or -errno or -osserr upon failure. (see XrdOssError.hh).
  < 0 -errno or -osserr upon failure. (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 503 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
if (rdonly_) return -EBADF;
uint64_t pgopts = opts;
const int prec = XrdOssCsiPages::pgWritePrelockCheck(buffer, offset, wrlen, csvec, opts);
if (prec < 0)
{
return prec;
}
XrdOssCsiRangeGuard rg;
Pages()->LockTrackinglen(rg, offset, offset+wrlen, false);
int puret = Pages()->StoreRange(successor_, buffer, offset, wrlen, csvec, pgopts, rg);
if (puret<0) {
rg.ReleaseAll();
resyncSizes();
return (ssize_t)puret;
}
ssize_t towrite = wrlen;
ssize_t bwritten = 0;
const uint8_t *p = (uint8_t*)buffer;
do
{
ssize_t wret = successor_->Write(&p[bwritten], offset+bwritten, towrite);
if (wret<0)
{
rg.ReleaseAll();
resyncSizes();
return wret;
}
towrite -= wret;
bwritten += wret;
} while(towrite>0);
return bwritten;
}
XrdOssCsiPages::pgWritePrelockCheck
static int pgWritePrelockCheck(const void *, off_t, size_t, const uint32_t *, uint64_t)
Definition XrdOssCsiPages.cc:788
XrdOssCsiPages::StoreRange
int StoreRange(XrdOssDF *, const void *, off_t, size_t, uint32_t *, uint64_t, XrdOssCsiRangeGuard &)
Definition XrdOssCsiPages.cc:691

References XrdOssCsiPages::LockTrackinglen(), opts, Pages(), XrdOssCsiPages::pgWritePrelockCheck(), XrdOssCsiRangeGuard::ReleaseAll(), XrdOssCsiPages::StoreRange(), and XrdOssDFHandler::successor_.

Here is the call graph for this function:

## pgWrite() [2/2]

int XrdOssCsiFile::pgWrite | ( | XrdSfsAio * | aioparm,
|  | uint64_t | opts )

virtual

Write file pages and checksums using asynchronous I/O.

Parameters

  aioparm | - Pointer to async I/O object controlling the I/O.
  opts | - Processing options (see above).

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

Reimplemented from XrdOssDFHandler.

Definition at line 91 of file XrdOssCsiFileAio.cc.

{
if (!pmi_) return -EBADF;
if (rdonly_) return -EBADF;
uint64_t pgopts = opts;
const int prec = XrdOssCsiPages::pgWritePrelockCheck(
(void *)aioparm->sfsAio.aio_buf,
(off_t)aioparm->sfsAio.aio_offset,
(size_t)aioparm->sfsAio.aio_nbytes,
aioparm->cksVec,
opts);
if (prec < 0)
{
return prec;
}
XrdOssCsiFileAio *nio = XrdOssCsiFileAio::Alloc(&aiostore_);
nio->Init(aioparm, this, true, pgopts, false);
// pages will be locked when write is scheduled
nio->SchedWriteJob();
return 0;
}
aiocb::aio_offset
off_t aio_offset
Definition XrdSfsAio.hh:49
aiocb::aio_nbytes
size_t aio_nbytes
Definition XrdSfsAio.hh:48
aiocb::aio_buf
void * aio_buf
Definition XrdSfsAio.hh:47
XrdOssCsiFileAio::SchedWriteJob
void SchedWriteJob()
Definition XrdOssCsiFileAio.hh:189
XrdSfsAio::cksVec
uint32_t * cksVec
Definition XrdSfsAio.hh:63
XrdSfsAio::sfsAio
struct aiocb sfsAio
Definition XrdSfsAio.hh:62

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdOssCsiFileAio::Alloc(), XrdSfsAio::cksVec, XrdOssCsiFileAio::Init(), opts, XrdOssCsiPages::pgWritePrelockCheck(), XrdOssCsiFileAio::SchedWriteJob(), XrdSfsAio::sfsAio, and XrdOssCsiFileAio.

Here is the call graph for this function:

## Read() [1/3]

ssize_t XrdOssCsiFile::Read | ( | off_t | offset,
|  | size_t | size )

virtual

Preread file blocks into the file system cache.

Parameters

  offset | - The offset where the read is to start.
  size | - The number of bytes to pre-read.

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

Reimplemented from XrdOssDFHandler.

Definition at line 340 of file XrdOssCsiFile.cc.

{
return successor_->Read(offset, blen);
}

References XrdOssDFHandler::successor_.

## Read() [2/3]

ssize_t XrdOssCsiFile::Read | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | size )

virtual

Read file bytes into a buffer.

Parameters

  buffer | - pointer to buffer where the bytes are to be placed.
  offset | - The offset where the read is to start.
  size | - The number of bytes to read.

Returns
  >= 0 The number of bytes that placed in buffer.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 345 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
XrdOssCsiRangeGuard rg;
Pages()->LockTrackinglen(rg, offset, offset+blen, true);
const ssize_t bread = successor_->Read(buff, offset, blen);
if (bread<0 || blen==0) return bread;
const ssize_t puret = Pages()->VerifyRange(successor_, buff, offset, bread, rg);
if (puret<0) return puret;
return bread;
}
XrdOssCsiPages::VerifyRange
int VerifyRange(XrdOssDF *, const void *, off_t, size_t, XrdOssCsiRangeGuard &)
Definition XrdOssCsiPages.cc:220

References XrdOssCsiPages::LockTrackinglen(), Pages(), XrdOssDFHandler::successor_, and XrdOssCsiPages::VerifyRange().

Here is the call graph for this function:

## Read() [3/3]

int XrdOssCsiFile::Read | ( | XrdSfsAio * | aiop | ) |

virtual

Read file bytes using asynchronous I/O.

Parameters

  aiop | - Pointer to async I/O object controlling the I/O.

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

Reimplemented from XrdOssDFHandler.

Definition at line 59 of file XrdOssCsiFileAio.cc.

{
if (!pmi_) return -EBADF;
XrdOssCsiFileAio *nio = XrdOssCsiFileAio::Alloc(&aiostore_);
nio->Init(aiop, this, false, 0, true);
nio->SchedReadJob();
return 0;
}

References XrdOssCsiFileAio::Alloc(), XrdOssCsiFileAio::Init(), XrdOssCsiFileAio::SchedReadJob(), and XrdOssCsiFileAio.

Here is the call graph for this function:

## ReadRaw()

ssize_t XrdOssCsiFile::ReadRaw | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | size )

virtual

Read uncompressed file bytes into a buffer.

Parameters

  buffer | - pointer to buffer where the bytes are to be placed.
  offset | - The offset where the read is to start.
  size | - The number of bytes to read.

Returns
  >= 0 The number of bytes that placed in buffer.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 360 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
XrdOssCsiRangeGuard rg;
Pages()->LockTrackinglen(rg, offset, offset+blen, true);
const ssize_t bread = successor_->ReadRaw(buff, offset, blen);
if (bread<0 || blen==0) return bread;
const ssize_t puret = Pages()->VerifyRange(successor_, buff, offset, bread, rg);
if (puret<0) return puret;
return bread;
}

References XrdOssCsiPages::LockTrackinglen(), Pages(), XrdOssDFHandler::successor_, and XrdOssCsiPages::VerifyRange().

Here is the call graph for this function:

## ReadV()

ssize_t XrdOssCsiFile::ReadV | ( | XrdOucIOVec * | readV,
|  | int | rdvcnt )

virtual

Read file bytes as directed by the read vector.

Parameters

  readV | pointer to the array of read requests.
  rdvcnt | the number of elements in readV.

Returns
  >=0 The numbe of bytes read.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 375 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
if (n==0) return 0;
XrdOssCsiRangeGuard rg;
off_t start = readV[0].offset;
off_t end = start + (off_t)readV[0].size;
for(int i=1; i<n; i++)
{
const off_t p1 = readV[i].offset;
const off_t p2 = p1 + (off_t)readV[i].size;
if (p1<start) start = p1;
if (p2>end) end = p2;
}
Pages()->LockTrackinglen(rg, start, end, true);
// standard OSS gives -ESPIPE in case of partial read of an element
ssize_t rret = successor_->ReadV(readV, n);
if (rret<0) return rret;
for (int i=0; i<n; i++)
{
if (readV[i].size == 0) continue;
ssize_t puret = Pages()->VerifyRange(successor_, readV[i].data, readV[i].offset, readV[i].size, rg);
if (puret<0) return puret;
}
return rret;
}
XrdOucIOVec::offset
long long offset
Definition XrdOucIOVec.hh:42

References XrdOssCsiPages::LockTrackinglen(), XrdOucIOVec::offset, Pages(), XrdOssDFHandler::successor_, and XrdOssCsiPages::VerifyRange().

Here is the call graph for this function:

## VerificationStatus()

int XrdOssCsiFile::VerificationStatus | ( |  | ) |

Definition at line 606 of file XrdOssCsiFile.cc.

{
if (!pmi_) return 0;
return Pages()->VerificationStatus();
}
XrdOssCsiPages::VerificationStatus
int VerificationStatus()
Definition XrdOssCsiPages.cc:759

References Pages(), and XrdOssCsiPages::VerificationStatus().

Here is the call graph for this function:

## Write() [1/2]

ssize_t XrdOssCsiFile::Write | ( | const void * | buffer,
|  | off_t | offset,
|  | size_t | size )

virtual

Write file bytes from a buffer.

Parameters

  buffer | - pointer to buffer where the bytes reside.
  offset | - The offset where the write is to start.
  size | - The number of bytes to write.

Returns
  >= 0 The number of bytes that were written.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 404 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
if (rdonly_) return -EBADF;
XrdOssCsiRangeGuard rg;
Pages()->LockTrackinglen(rg, offset, offset+blen, false);
int puret = Pages()->UpdateRange(successor_, buff, offset, blen, rg);
if (puret<0)
{
rg.ReleaseAll();
resyncSizes();
return (ssize_t)puret;
}
ssize_t towrite = blen;
ssize_t bwritten = 0;
const uint8_t *p = (uint8_t*)buff;
while(towrite>0)
{
ssize_t wret = successor_->Write(&p[bwritten], offset+bwritten, towrite);
if (wret<0)
{
rg.ReleaseAll();
resyncSizes();
return wret;
}
towrite -= wret;
bwritten += wret;
}
return bwritten;
}
XrdOssCsiPages::UpdateRange
int UpdateRange(XrdOssDF *, const void *, off_t, size_t, XrdOssCsiRangeGuard &)
Definition XrdOssCsiPages.cc:169

References XrdOssCsiPages::LockTrackinglen(), Pages(), XrdOssCsiRangeGuard::ReleaseAll(), XrdOssDFHandler::successor_, and XrdOssCsiPages::UpdateRange().

Here is the call graph for this function:

## Write() [2/2]

int XrdOssCsiFile::Write | ( | XrdSfsAio * | aiop | ) |

virtual

Write file bytes using asynchronous I/O.

Parameters

  aiop | - Pointer to async I/O object controlling the I/O.

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

Reimplemented from XrdOssDFHandler.

Definition at line 69 of file XrdOssCsiFileAio.cc.

{
if (!pmi_) return -EBADF;
if (rdonly_) return -EBADF;
XrdOssCsiFileAio *nio = XrdOssCsiFileAio::Alloc(&aiostore_);
nio->Init(aiop, this, false, 0, false);
// pages will be locked when write is scheduled
nio->SchedWriteJob();
return 0;
}

References XrdOssCsiFileAio::Alloc(), XrdOssCsiFileAio::Init(), XrdOssCsiFileAio::SchedWriteJob(), and XrdOssCsiFileAio.

Here is the call graph for this function:

## WriteV()

ssize_t XrdOssCsiFile::WriteV | ( | XrdOucIOVec * | writeV,
|  | int | wrvcnt )

virtual

Write file bytes as directed by the write vector.

Parameters

  writeV | pointer to the array of write requests.
  wrvcnt | the number of elements in writeV.

Returns
  >=0 The numbe of bytes read.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 437 of file XrdOssCsiFile.cc.

{
if (!pmi_) return -EBADF;
if (rdonly_) return -EBADF;
if (n==0) return 0;
XrdOssCsiRangeGuard rg;
off_t start = writeV[0].offset;
off_t end = start + (off_t)writeV[0].size;
for(int i=1; i<n; i++)
{
const off_t p1 = writeV[i].offset;
const off_t p2 = p1 + (off_t)writeV[i].size;
if (p1<start) start = p1;
if (p2>end) end = p2;
}
Pages()->LockTrackinglen(rg, start, end, false);
for (int i=0; i<n; i++)
{
int ret = Pages()->UpdateRange(successor_, writeV[i].data, writeV[i].offset, writeV[i].size, rg);
if (ret<0)
{
rg.ReleaseAll();
resyncSizes();
return ret;
}
}
// standard OSS gives -ESPIPE in case of partial write of an element
ssize_t wret = successor_->WriteV(writeV, n);
if (wret<0)
{
rg.ReleaseAll();
resyncSizes();
}
return wret;
}

References XrdOssCsiPages::LockTrackinglen(), XrdOucIOVec::offset, Pages(), XrdOssCsiRangeGuard::ReleaseAll(), XrdOssDFHandler::successor_, and XrdOssCsiPages::UpdateRange().

Here is the call graph for this function:

## Friends And Related Symbol Documentation

## XrdOssCsiFileAio

friend class XrdOssCsiFileAio

friend

Definition at line 75 of file XrdOssCsi.hh.

References XrdOssCsiFileAio.

Referenced by pgRead(), pgWrite(), Read(), Write(), and XrdOssCsiFileAio.

## XrdOssCsiFileAioJob

friend class XrdOssCsiFileAioJob

friend

Definition at line 76 of file XrdOssCsi.hh.

References XrdOssCsiFileAioJob.

Referenced by XrdOssCsiFileAioJob.

## Member Data Documentation

## pumap_

std::unordered_map< std::string, std::shared_ptr< XrdOssCsiFile::puMapItem_t > > XrdOssCsiFile::pumap_

static

Definition at line 160 of file XrdOssCsi.hh.

Referenced by mapRelease(), mapTake(), and XrdOssCsi::Rename().

## pumtx_

XrdSysMutex XrdOssCsiFile::pumtx_

static

Definition at line 159 of file XrdOssCsi.hh.

Referenced by mapRelease(), mapTake(), and XrdOssCsi::Rename().

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

- XrdOssCsi.hh
- XrdOssCsiFile.cc
- XrdOssCsiFileAio.cc