XRootD
XrdPssAioCB Class Reference

#include <XrdPssAioCB.hh>

+ Inheritance diagram for XrdPssAioCB:
+ Collaboration diagram for XrdPssAioCB:

Public Member Functions

virtual void Complete (ssize_t Result)
 
void Recycle ()
 
- Public Member Functions inherited from XrdPosixCallBackIO
 XrdPosixCallBackIO ()
 
virtual ~XrdPosixCallBackIO ()
 
- Public Member Functions inherited from XrdOucCacheIOCB
 XrdOucCacheIOCB ()
 
virtual ~XrdOucCacheIOCB ()
 

Static Public Member Functions

static XrdPssAioCBAlloc (XrdSfsAio *aiop, bool isWr, bool pgrw=false)
 
static void SetMax (int mval)
 

Public Attributes

std::vector< uint32_t > csVec
 

Detailed Description

Definition at line 41 of file XrdPssAioCB.hh.

Member Function Documentation

◆ Alloc()

XrdPssAioCB * XrdPssAioCB::Alloc ( XrdSfsAio aiop,
bool  isWr,
bool  pgrw = false 
)
static

Definition at line 49 of file XrdPssAioCB.cc.

50 {
51  XrdPssAioCB *newCB;
52 
53 // Try to allocate an prexisting object otherwise get a new one
54 //
55  myMutex.Lock();
56  if ((newCB = freeCB)) {freeCB = newCB->next; numFree--;}
57  else newCB = new XrdPssAioCB;
58  myMutex.UnLock();
59 
60 // Initialize the callback and return it
61 //
62  newCB->theAIOP = aiop;
63  newCB->isWrite = isWr;
64  newCB->isPGrw = pgrw;
65  return newCB;
66 }

References XrdSysMutex::Lock(), and XrdSysMutex::UnLock().

Referenced by XrdPssFile::Fsync(), XrdPssFile::pgRead(), XrdPssFile::pgWrite(), XrdPssFile::Read(), and XrdPssFile::Write().

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

◆ Complete()

void XrdPssAioCB::Complete ( ssize_t  Result)
virtual

Implements XrdPosixCallBackIO.

Definition at line 73 of file XrdPssAioCB.cc.

74 {
75 
76 // Set correct result
77 //
78 // std::cerr <<"AIO fin " <<(isWrite ? " write ":" read ")
79 // <<theAIOP->sfsAio.aio_nbytes <<'@' <<theAIOP->sfsAio.aio_offset
80 // <<" result " <<result <<std::endl;
81  theAIOP->Result = (result < 0 ? -errno : result);
82 
83 // Perform post processing for pgRead or pgWrite if successful
84 //
85  if (isPGrw && result >= 0)
86  {if (isWrite)
87  {
88  } else {
89  if (csVec.size() && theAIOP->cksVec)
90  memcpy(theAIOP->cksVec, csVec.data(), csVec.size()*sizeof(uint32_t));
91  }
92  }
93 
94 // Invoke the callback
95 //
96  if (isWrite) theAIOP->doneWrite();
97  else theAIOP->doneRead();
98 
99 // Now recycle ourselves
100 //
101  Recycle();
102 }
std::vector< uint32_t > csVec
Definition: XrdPssAioCB.hh:53
void Recycle()
Definition: XrdPssAioCB.cc:108

References csVec, and Recycle().

+ Here is the call graph for this function:

◆ Recycle()

void XrdPssAioCB::Recycle ( void  )

Definition at line 108 of file XrdPssAioCB.cc.

109 {
110 // Perform recycling
111 //
112  myMutex.Lock();
113  if (numFree >= maxFree) delete this;
114  else {next = freeCB;
115  freeCB = this;
116  numFree++;
117  csVec.clear();
118  }
119  myMutex.UnLock();
120 }

References csVec, XrdSysMutex::Lock(), and XrdSysMutex::UnLock().

Referenced by Complete().

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

◆ SetMax()

static void XrdPssAioCB::SetMax ( int  mval)
inlinestatic

Definition at line 51 of file XrdPssAioCB.hh.

51 {maxFree = mval;}

Member Data Documentation

◆ csVec

std::vector<uint32_t> XrdPssAioCB::csVec

Definition at line 53 of file XrdPssAioCB.hh.

Referenced by Complete(), XrdPssFile::pgRead(), XrdPssFile::pgWrite(), and Recycle().


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