XRootD
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 ()
virtual int Clone (const std::vector< XrdOucCloneSeg > &cVec)
virtual int Clone (XrdOssDF &srcFile)
uint16_t DFType ()
virtual bool getErrMsg (std::string &eText)
virtual ssize_t Read (XrdOucRangeList &rlist)

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_QFinfo = 3
static const int Fctl_setFD = 2
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.

106 :
107 XrdOssDFHandler(parent->newFile(tid)), parentOss_(parent), tident(tid), config_(cf),
108 rdonly_(false), aioCntCond_(0), aioCnt_(0), aioCntWaiters_(0) { }
XrdOssDFHandler(XrdOssDF *successor)
virtual XrdOssDF * newFile(const char *tident)=0

References XrdOssDFHandler::XrdOssDFHandler().

Referenced by XrdOssCsi::newFile().

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

◆ ~XrdOssCsiFile()

XrdOssCsiFile::~XrdOssCsiFile ( )
virtual

Definition at line 177 of file XrdOssCsiFile.cc.

178{
179 if (pmi_)
180 {
181 (void)Close();
182 }
183}
virtual int Close(long long *retsz=0)

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.

121 {
122 XrdSysCondVarHelper lck(&aioCntCond_);
123 if (--aioCnt_ == 0 && aioCntWaiters_>0)
124 aioCntCond_.Broadcast();
125 }

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.

112 {
113 XrdSysCondVarHelper lck(&aioCntCond_);
114 while(aioCntWaiters_>0)
115 {
116 aioCntCond_.Wait();
117 }
118 ++aioCnt_;
119 }

◆ aioWait()

void XrdOssCsiFile::aioWait ( )
inline

Definition at line 126 of file XrdOssCsi.hh.

127 {
128 XrdSysCondVarHelper lck(&aioCntCond_);
129 ++aioCntWaiters_;
130 while(aioCnt_>0)
131 {
132 aioCntCond_.Wait();
133 }
134 --aioCntWaiters_;
135 aioCntCond_.Broadcast();
136 }

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
retszIf 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 185 of file XrdOssCsiFile.cc.

186{
187 if (!pmi_)
188 {
189 return -EBADF;
190 }
191
192 // wait for any ongoing aios to finish
193 aioWait();
194
195 const int cpret = pageMapClose();
196
197 const int csret = successor_->Close(retsz);
198 if (cpret<0) return cpret;
199 return csret;
200}
XrdOssDF * successor_
virtual int Close(long long *retsz=0)=0

References aioWait(), XrdOssDF::Close(), and XrdOssDFHandler::successor_.

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

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 597 of file XrdOssCsiFile.cc.

598{
599 if (!pmi_) return;
600
601 Pages()->Flush();
602 successor_->Flush();
603}
XrdOssCsiPages * Pages()
Definition XrdOssCsi.hh:140
virtual void Flush()
Flush filesystem cached pages for this file (used for checksums).
Definition XrdOss.hh:154

References XrdOssCsiPages::Flush(), XrdOssDF::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 574 of file XrdOssCsiFile.cc.

575{
576 if (!pmi_) return -EBADF;
578 const int tsret = Pages()->TrackedSizesGet(sizes, false);
579 const int fsret = successor_->Fstat(buff);
580 if (fsret<0) return fsret;
581 if (tsret<0) return 0;
582 buff->st_size = std::max(sizes.first, sizes.second);
583 return 0;
584}
std::pair< off_t, off_t > Sizes_t
int TrackedSizesGet(Sizes_t &, bool)
virtual int Fstat(struct stat *buf)
Definition XrdOss.hh:164

References XrdOssDF::Fstat(), 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 541 of file XrdOssCsiFile.cc.

542{
543 if (!pmi_) return -EBADF;
544
545 const int psret = Pages()->Fsync();
546 const int ssret = successor_->Fsync();
547 if (psret<0) return psret;
548 return ssret;
549}
virtual int Fsync()
Definition XrdOss.hh:172

References XrdOssCsiPages::Fsync(), XrdOssDF::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.

116{
117 aioWait();
118 aiop->Result = this->Fsync();
119 aiop->doneWrite();
120 return 0;
121}
virtual int Fsync()
ssize_t Result
Definition XrdSfsAio.hh:65
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 551 of file XrdOssCsiFile.cc.

552{
553 if (!pmi_) return -EBADF;
554 if (rdonly_) return -EBADF;
555
556 XrdOssCsiRangeGuard rg;
557 Pages()->LockTrackinglen(rg, flen, LLONG_MAX, false);
558 int ret = Pages()->truncate(successor_, flen, rg);
559 if (ret<0)
560 {
561 rg.ReleaseAll();
562 resyncSizes();
563 return ret;
564 }
565 ret = successor_->Ftruncate(flen);
566 if (ret<0)
567 {
568 rg.ReleaseAll();
569 resyncSizes();
570 }
571 return ret;
572}
int truncate(XrdOssDF *, off_t, XrdOssCsiRangeGuard &)
void LockTrackinglen(XrdOssCsiRangeGuard &, off_t, off_t, bool)
virtual int Ftruncate(unsigned long long flen)
Definition XrdOss.hh:192

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

Here is the call graph for this function:

◆ getFD()

virtual int XrdOssCsiFile::getFD ( )
inlinevirtual

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.

83{ return successor_->getFD(); }
virtual int getFD()
Definition XrdOss.hh:486

References XrdOssDF::getFD(), and XrdOssDFHandler::successor_.

Here is the call graph for this function:

◆ getMmap()

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

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.

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

◆ mapRelease()

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

Definition at line 108 of file XrdOssCsiFile.cc.

109{
110 XrdSysMutexHelper lck(pumtx_);
111 pmi->refcount--;
112 auto mapidx = pumap_.find(pmi->tpath);
113 if (pmi->refcount == 0 || pmi->unlinked)
114 {
115 if (mapidx != pumap_.end() && mapidx->second == pmi)
116 {
117 pumap_.erase(mapidx);
118 }
119 }
120 if (plck) plck->UnLock();
121 return (pmi->refcount == 0) ? 1 : 0;
122}
static XrdSysMutex pumtx_
Definition XrdOssCsi.hh:159
static std::unordered_map< std::string, std::shared_ptr< puMapItem_t > > pumap_
Definition XrdOssCsi.hh:160

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 87 of file XrdOssCsiFile.cc.

88{
89 XrdSysMutexHelper lck(pumtx_);
90 auto mapidx = pumap_.find(key);
91 if (mapidx == pumap_.end())
92 {
93 if (!create) return;
94 pmi.reset(new puMapItem_t());
95 pmi->tpath = key;
96 if (!key.empty())
97 {
98 pumap_.insert(std::make_pair(key, pmi));
99 }
100 }
101 else
102 {
103 pmi = mapidx->second;
104 }
105 pmi->refcount++;
106}

References XrdOssCsiFile::puMapItem_t::puMapItem_t(), pumap_, and pumtx_.

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:

◆ 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 285 of file XrdOssCsiFile.cc.

286{
287 char cxid[4];
288
289 if (pmi_)
290 {
291 // already open
292 return -EINVAL;
293 }
294
295 if (!path)
296 {
297 return -EINVAL;
298 }
299 if (config_.tagParam_.isTagFile(path))
300 {
301 if ((Oflag & O_CREAT)) return -EACCES;
302 return -ENOENT;
303 }
304
305 int dflags = Oflag;
306 if ((dflags & O_ACCMODE) == O_WRONLY)
307 {
308 // for non-aligned writes it may be needed to do read-modify-write
309 dflags &= ~O_ACCMODE;
310 dflags |= O_RDWR;
311 }
312
313 rdonly_ = true;
314 if ((dflags & O_ACCMODE) != O_RDONLY)
315 {
316 rdonly_ = false;
317 }
318
319 const int oret = pageAndFileOpen(path, dflags, Oflag, Mode, Env);
320 if (oret<0)
321 {
322 return oret;
323 }
324
325 if (successor_->isCompressed(cxid)>0)
326 {
327 (void)Close();
328 return -ENOTSUP;
329 }
330
331 if (Pages()->IsReadOnly() && !rdonly_)
332 {
333 (void)Close();
334 return -EACCES;
335 }
336 return XrdOssOK;
337}
#define XrdOssOK
Definition XrdOss.hh:54
int Mode
virtual int isCompressed(char *cxidp=0)
Definition XrdOss.hh:215

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

Referenced by XrdOssCsiFileAioJob.

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

◆ Pages()

XrdOssCsiPages * XrdOssCsiFile::Pages ( )
inline

Definition at line 140 of file XrdOssCsi.hh.

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

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 474 of file XrdOssCsiFile.cc.

475{
476 if (!pmi_) return -EBADF;
477
478 XrdOssCsiRangeGuard rg;
479 Pages()->LockTrackinglen(rg, offset, offset+rdlen, true);
480
481 // if we return a short amount of data the caller will have to deal with
482 // joining csvec values from repeated reads: for simplicity try to read as
483 // such as possible up to the request read length
484 ssize_t toread = rdlen;
485 ssize_t bread = 0;
486 uint8_t *const p = (uint8_t*)buffer;
487 do
488 {
489 ssize_t rret = successor_->Read(&p[bread], offset+bread, toread);
490 if (rret<0) return rret;
491 if (rret==0) break;
492 toread -= rret;
493 bread += rret;
494 } while(toread>0);
495 if (rdlen == 0) return bread;
496
497 ssize_t puret = Pages()->FetchRange(successor_, buffer, offset, bread, csvec, opts, rg);
498 if (puret<0) return puret;
499 return bread;
500}
struct myOpts opts
int FetchRange(XrdOssDF *, const void *, off_t, size_t, uint32_t *, uint64_t, XrdOssCsiRangeGuard &)
virtual ssize_t Read(off_t offset, size_t size)
Definition XrdOss.hh:310

References XrdOssCsiPages::FetchRange(), XrdOssCsiPages::LockTrackinglen(), opts, Pages(), XrdOssDF::Read(), 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.

82{
83 if (!pmi_) return -EBADF;
84
86 nio->Init(aioparm, this, true, opts, true);
87 nio->SchedReadJob();
88 return 0;
89}
static XrdOssCsiFileAio * Alloc(XrdOssCsiFileAioStore *store)
void Init(XrdSfsAio *aiop, XrdOssCsiFile *file, bool isPgOp, uint64_t opts, bool isread)
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 502 of file XrdOssCsiFile.cc.

503{
504 if (!pmi_) return -EBADF;
505 if (rdonly_) return -EBADF;
506 uint64_t pgopts = opts;
507
508 const int prec = XrdOssCsiPages::pgWritePrelockCheck(buffer, offset, wrlen, csvec, opts);
509 if (prec < 0)
510 {
511 return prec;
512 }
513
514 XrdOssCsiRangeGuard rg;
515 Pages()->LockTrackinglen(rg, offset, offset+wrlen, false);
516
517 int puret = Pages()->StoreRange(successor_, buffer, offset, wrlen, csvec, pgopts, rg);
518 if (puret<0) {
519 rg.ReleaseAll();
520 resyncSizes();
521 return (ssize_t)puret;
522 }
523 ssize_t towrite = wrlen;
524 ssize_t bwritten = 0;
525 const uint8_t *p = (uint8_t*)buffer;
526 do
527 {
528 ssize_t wret = successor_->Write(&p[bwritten], offset+bwritten, towrite);
529 if (wret<0)
530 {
531 rg.ReleaseAll();
532 resyncSizes();
533 return wret;
534 }
535 towrite -= wret;
536 bwritten += wret;
537 } while(towrite>0);
538 return bwritten;
539}
static int pgWritePrelockCheck(const void *, off_t, size_t, const uint32_t *, uint64_t)
int StoreRange(XrdOssDF *, const void *, off_t, size_t, uint32_t *, uint64_t, XrdOssCsiRangeGuard &)
virtual ssize_t Write(const void *buffer, off_t offset, size_t size)
Definition XrdOss.hh:385

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

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.

92{
93 if (!pmi_) return -EBADF;
94 if (rdonly_) return -EBADF;
95 uint64_t pgopts = opts;
96
98 (void *)aioparm->sfsAio.aio_buf,
99 (off_t)aioparm->sfsAio.aio_offset,
100 (size_t)aioparm->sfsAio.aio_nbytes,
101 aioparm->cksVec,
102 opts);
103 if (prec < 0)
104 {
105 return prec;
106 }
107
108 XrdOssCsiFileAio *nio = XrdOssCsiFileAio::Alloc(&aiostore_);
109 nio->Init(aioparm, this, true, pgopts, false);
110 // pages will be locked when write is scheduled
111 nio->SchedWriteJob();
112 return 0;
113}
off_t aio_offset
Definition XrdSfsAio.hh:49
size_t aio_nbytes
Definition XrdSfsAio.hh:48
void * aio_buf
Definition XrdSfsAio.hh:47
uint32_t * cksVec
Definition XrdSfsAio.hh:63
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 When 0, the request was ignored; otherwise, it has been accepted.
< 0 Failed with -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDFHandler.

Definition at line 339 of file XrdOssCsiFile.cc.

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

References XrdOssDF::Read(), and XrdOssDFHandler::successor_.

Here is the call graph for this function:

◆ 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 344 of file XrdOssCsiFile.cc.

345{
346 if (!pmi_) return -EBADF;
347
348 XrdOssCsiRangeGuard rg;
349 Pages()->LockTrackinglen(rg, offset, offset+blen, true);
350
351 const ssize_t bread = successor_->Read(buff, offset, blen);
352 if (bread<0 || blen==0) return bread;
353
354 const ssize_t puret = Pages()->VerifyRange(successor_, buff, offset, bread, rg);
355 if (puret<0) return puret;
356 return bread;
357}
int VerifyRange(XrdOssDF *, const void *, off_t, size_t, XrdOssCsiRangeGuard &)

References XrdOssCsiPages::LockTrackinglen(), Pages(), XrdOssDF::Read(), 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.

60{
61 if (!pmi_) return -EBADF;
62
64 nio->Init(aiop, this, false, 0, true);
65 nio->SchedReadJob();
66 return 0;
67}

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 359 of file XrdOssCsiFile.cc.

360{
361 if (!pmi_) return -EBADF;
362
363 XrdOssCsiRangeGuard rg;
364 Pages()->LockTrackinglen(rg, offset, offset+blen, true);
365
366 const ssize_t bread = successor_->ReadRaw(buff, offset, blen);
367 if (bread<0 || blen==0) return bread;
368
369 const ssize_t puret = Pages()->VerifyRange(successor_, buff, offset, bread, rg);
370 if (puret<0) return puret;
371 return bread;
372}
virtual ssize_t ReadRaw(void *buffer, off_t offset, size_t size)
Definition XrdOss.hh:359

References XrdOssCsiPages::LockTrackinglen(), Pages(), XrdOssDF::ReadRaw(), 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
readVpointer to the array of read requests.
rdvcntthe 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 374 of file XrdOssCsiFile.cc.

375{
376 if (!pmi_) return -EBADF;
377 if (n==0) return 0;
378
379 XrdOssCsiRangeGuard rg;
380 off_t start = readV[0].offset;
381 off_t end = start + (off_t)readV[0].size;
382 for(int i=1; i<n; i++)
383 {
384 const off_t p1 = readV[i].offset;
385 const off_t p2 = p1 + (off_t)readV[i].size;
386 if (p1<start) start = p1;
387 if (p2>end) end = p2;
388 }
389 Pages()->LockTrackinglen(rg, start, end, true);
390
391 // standard OSS gives -ESPIPE in case of partial read of an element
392 ssize_t rret = successor_->ReadV(readV, n);
393 if (rret<0) return rret;
394 for (int i=0; i<n; i++)
395 {
396 if (readV[i].size == 0) continue;
397 ssize_t puret = Pages()->VerifyRange(successor_, readV[i].data, readV[i].offset, readV[i].size, rg);
398 if (puret<0) return puret;
399 }
400 return rret;
401}
virtual ssize_t ReadV(XrdOucIOVec *readV, int rdvcnt)
Definition XrdOss.cc:252
long long offset

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

Here is the call graph for this function:

◆ VerificationStatus()

int XrdOssCsiFile::VerificationStatus ( )

Definition at line 605 of file XrdOssCsiFile.cc.

606{
607 if (!pmi_) return 0;
608 return Pages()->VerificationStatus();
609}

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 403 of file XrdOssCsiFile.cc.

404{
405 if (!pmi_) return -EBADF;
406 if (rdonly_) return -EBADF;
407
408 XrdOssCsiRangeGuard rg;
409 Pages()->LockTrackinglen(rg, offset, offset+blen, false);
410
411 int puret = Pages()->UpdateRange(successor_, buff, offset, blen, rg);
412 if (puret<0)
413 {
414 rg.ReleaseAll();
415 resyncSizes();
416 return (ssize_t)puret;
417 }
418 ssize_t towrite = blen;
419 ssize_t bwritten = 0;
420 const uint8_t *p = (uint8_t*)buff;
421 while(towrite>0)
422 {
423 ssize_t wret = successor_->Write(&p[bwritten], offset+bwritten, towrite);
424 if (wret<0)
425 {
426 rg.ReleaseAll();
427 resyncSizes();
428 return wret;
429 }
430 towrite -= wret;
431 bwritten += wret;
432 }
433 return bwritten;
434}
int UpdateRange(XrdOssDF *, const void *, off_t, size_t, XrdOssCsiRangeGuard &)

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

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.

70{
71 if (!pmi_) return -EBADF;
72 if (rdonly_) return -EBADF;
73
75 nio->Init(aiop, this, false, 0, false);
76 // pages will be locked when write is scheduled
77 nio->SchedWriteJob();
78 return 0;
79}

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
writeVpointer to the array of write requests.
wrvcntthe 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 436 of file XrdOssCsiFile.cc.

437{
438 if (!pmi_) return -EBADF;
439 if (rdonly_) return -EBADF;
440 if (n==0) return 0;
441
442 XrdOssCsiRangeGuard rg;
443 off_t start = writeV[0].offset;
444 off_t end = start + (off_t)writeV[0].size;
445 for(int i=1; i<n; i++)
446 {
447 const off_t p1 = writeV[i].offset;
448 const off_t p2 = p1 + (off_t)writeV[i].size;
449 if (p1<start) start = p1;
450 if (p2>end) end = p2;
451 }
452 Pages()->LockTrackinglen(rg, start, end, false);
453
454 for (int i=0; i<n; i++)
455 {
456 int ret = Pages()->UpdateRange(successor_, writeV[i].data, writeV[i].offset, writeV[i].size, rg);
457 if (ret<0)
458 {
459 rg.ReleaseAll();
460 resyncSizes();
461 return ret;
462 }
463 }
464 // standard OSS gives -ESPIPE in case of partial write of an element
465 ssize_t wret = successor_->WriteV(writeV, n);
466 if (wret<0)
467 {
468 rg.ReleaseAll();
469 resyncSizes();
470 }
471 return wret;
472}
virtual ssize_t WriteV(XrdOucIOVec *writeV, int wrvcnt)
Definition XrdOss.cc:273

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

Here is the call graph for this function:

◆ 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 Close(), Open(), and 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: