XRootD
Loading...
Searching...
No Matches
XrdPosixFileRH Class Reference

#include <XrdPosixFileRH.hh>

+ Inheritance diagram for XrdPosixFileRH:
+ Collaboration diagram for XrdPosixFileRH:

Public Types

enum  ioType {
  nonIO = 0 ,
  isRead = 1 ,
  isReadV = 2 ,
  isWrite = 3 ,
  isReadP = 4 ,
  isWriteP = 5
}
 

Public Member Functions

void DoIt ()
 
void HandleResponse (XrdCl::XRootDStatus *status, XrdCl::AnyObject *response)
 
void Recycle ()
 
void Sched (int result)
 
void setCSVec (std::vector< uint32_t > *csv, int *csf, bool fcs=false)
 
- Public Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 
virtual void DoIt ()=0
 
- Public Member Functions inherited from XrdCl::ResponseHandler
virtual ~ResponseHandler ()
 
virtual void HandleResponse (XRootDStatus *status, AnyObject *response)
 
virtual void HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)
 

Static Public Member Functions

static XrdPosixFileRHAlloc (XrdOucCacheIOCB *cbp, XrdPosixFile *fp, long long offs, int xResult, ioType typeIO)
 
static void SetMax (int mval)
 
- Static Public Member Functions inherited from XrdCl::ResponseHandler
static ResponseHandlerWrap (std::function< void(XRootDStatus &, AnyObject &)> func)
 
static ResponseHandlerWrap (std::function< void(XRootDStatus *, AnyObject *)> func)
 

Additional Inherited Members

- Public Attributes inherited from XrdJob
const char * Comment
 
XrdJobNextJob
 

Detailed Description

Definition at line 47 of file XrdPosixFileRH.hh.

Member Enumeration Documentation

◆ ioType

Enumerator
nonIO 
isRead 
isReadV 
isWrite 
isReadP 
isWriteP 

Definition at line 52 of file XrdPosixFileRH.hh.

Member Function Documentation

◆ Alloc()

XrdPosixFileRH * XrdPosixFileRH::Alloc ( XrdOucCacheIOCB cbp,
XrdPosixFile fp,
long long  offs,
int  xResult,
ioType  typeIO 
)
static

Definition at line 76 of file XrdPosixFileRH.cc.

81{
82 XrdPosixFileRH *newCB;
83
84// Try to allocate an prexisting object otherwise get a new one
85//
86 myMutex.Lock();
87 if ((newCB = freeRH)) {freeRH = newCB->next; numFree--;}
88 else newCB = new XrdPosixFileRH;
89 myMutex.UnLock();
90
91// Initialize the callback and return it
92//
93 newCB->theCB = cbp;
94 newCB->theFile = fp;
95 newCB->csVec = 0;
96 newCB->csfix = 0;
97 newCB->offset = offs;
98 newCB->result = xResult;
99 newCB->typeIO = typeIO;
100 newCB->csFrc = false;
101 return newCB;
102}

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

Referenced by XrdPosixFile::pgRead(), XrdPosixFile::pgWrite(), XrdPosixFile::Read(), XrdPosixFile::ReadV(), XrdPosixFile::Sync(), and XrdPosixFile::Write().

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

◆ DoIt()

void XrdPosixFileRH::DoIt ( )
inlinevirtual

Implements XrdJob.

Definition at line 58 of file XrdPosixFileRH.hh.

58{theCB->Done(result); Recycle();}

References Recycle().

+ Here is the call graph for this function:

◆ HandleResponse()

void XrdPosixFileRH::HandleResponse ( XrdCl::XRootDStatus status,
XrdCl::AnyObject response 
)
virtual

Called when a response to associated request arrives or an error occurs

Parameters
statusstatus of the request
responsean object associated with the response (request dependent)

Reimplemented from XrdCl::ResponseHandler.

Definition at line 108 of file XrdPosixFileRH.cc.

110{
111
112// Determine ending status. Note: error indicated as result set to -errno.
113//
114 if (!(status->IsOK()))
115 result = XrdPosixMap::Result(*status, theFile->ecMsg, false);
116 else if (typeIO == nonIO) result = 0;
117 else if (typeIO == isRead)
118 {XrdCl::ChunkInfo *cInfo = 0;
119 union {uint32_t ubRead; int ibRead;};
120 response->Get(cInfo);
121 ubRead = (cInfo ? cInfo->length : 0);
122 result = ibRead;
123 }
124 else if (typeIO == isReadP)
125 {XrdCl::PageInfo *pInfo = 0;
126 union {uint32_t ubRead; int ibRead;};
127 response->Get(pInfo);
128 if (pInfo)
129 {ubRead = pInfo->GetLength();
130 result = ibRead;
131 if (csVec)
132 {if (!csFrc || pInfo->GetCksums().size() != 0 || result <= 0)
133 *csVec = std::move(pInfo->GetCksums() );
134 else {uint64_t offs = pInfo->GetOffset();
135 void *buff = pInfo->GetBuffer();
136 XrdOucPgrwUtils::csCalc((const char *)buff,
137 (ssize_t)offs, ubRead,
138 *csVec);
139 }
140 csVec = 0;
141 }
142 if (csfix) *csfix = pInfo->GetNbRepair();
143 } else {
144 result = 0;
145 if (csVec) {csVec->clear(); csVec = 0;}
146 }
147 }
148 else if (typeIO == isWrite) theFile->UpdtSize(offset+result);
149
150// Get rid of things we don't need
151//
152 delete status;
153 delete response;
154
155// Now schedule our XrdOucCacheIOCB callback
156//
157 theFile->unRef();
159 else {pthread_t tid;
160 XrdSysThread::Run(&tid, callDoIt, this, 0, "PosixFileRH");
161 }
162}
void Get(Type &object)
Retrieve the object being held.
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)
void UpdtSize(size_t newsz)
static int Result(const XrdCl::XRootDStatus &Status, XrdOucECMsg &ecMsg, bool retneg1=false)
XrdOucECMsg ecMsg
void Schedule(XrdJob *jp)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
XrdScheduler * schedP
Describe a data chunk for vector read.
uint32_t length
offset in the file
size_t GetNbRepair()
Get number of repaired pages.
std::vector< uint32_t > & GetCksums()
Get the checksums.
uint32_t GetLength() const
Get the data length.
uint64_t GetOffset() const
Get the offset.
void * GetBuffer()
Get the buffer.
bool IsOK() const
We're fine.

References XrdOucPgrwUtils::csCalc(), XrdPosixObject::ecMsg, XrdCl::AnyObject::Get(), XrdCl::PageInfo::GetBuffer(), XrdCl::PageInfo::GetCksums(), XrdCl::PageInfo::GetLength(), XrdCl::PageInfo::GetNbRepair(), XrdCl::PageInfo::GetOffset(), XrdCl::Status::IsOK(), isRead, isReadP, isWrite, XrdCl::ChunkInfo::length, nonIO, XrdPosixMap::Result(), XrdSysThread::Run(), XrdPosixGlobals::schedP, XrdScheduler::Schedule(), XrdPosixObject::unRef(), and XrdPosixFile::UpdtSize().

+ Here is the call graph for this function:

◆ Recycle()

void XrdPosixFileRH::Recycle ( )

Definition at line 168 of file XrdPosixFileRH.cc.

169{
170// Perform recycling
171//
172 myMutex.Lock();
173 if (numFree >= maxFree) delete this;
174 else {next = freeRH;
175 freeRH = this;
176 numFree++;
177 }
178 myMutex.UnLock();
179}

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

Referenced by DoIt().

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

◆ Sched()

void XrdPosixFileRH::Sched ( int  result)

Definition at line 185 of file XrdPosixFileRH.cc.

186{
187// Set result
188//
189 result = rval;
190
191// Now schedule this callback
192//
194 else {pthread_t tid;
195 XrdSysThread::Run(&tid, callDoIt, this, 0, "PosixFileRH");
196 }
197}

References XrdSysThread::Run(), XrdPosixGlobals::schedP, and XrdScheduler::Schedule().

Referenced by XrdPosixFile::pgRead(), XrdPosixFile::pgWrite(), XrdPosixFile::Read(), XrdPosixFile::ReadV(), XrdPosixFile::Sync(), and XrdPosixFile::Write().

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

◆ setCSVec()

void XrdPosixFileRH::setCSVec ( std::vector< uint32_t > *  csv,
int *  csf,
bool  fcs = false 
)
inline

Definition at line 65 of file XrdPosixFileRH.hh.

67 {csVec = csv; csfix = csf; csFrc = fcs;}

Referenced by XrdPosixFile::pgRead(), and XrdPosixFile::pgWrite().

+ Here is the caller graph for this function:

◆ SetMax()

static void XrdPosixFileRH::SetMax ( int  mval)
inlinestatic

Definition at line 69 of file XrdPosixFileRH.hh.

69{maxFree = mval;}

Referenced by XrdPosixConfig::SetConfig().

+ Here is the caller graph for this function:

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