XRootD
XrdXrootdPgrwAio Class Reference

#include <XrdXrootdPgrwAio.hh>

+ Inheritance diagram for XrdXrootdPgrwAio:
+ Collaboration diagram for XrdXrootdPgrwAio:

Public Member Functions

void DoIt () override
 
void Read (long long offs, int dlen) override
 
void Recycle (bool release) override
 
int Write (long long offs, int dlen) override
 
- Public Member Functions inherited from XrdXrootdAioTask
void Completed (XrdXrootdAioBuff *aioP)
 
const char * ID ()
 
void Init (XrdXrootdProtocol *protP, XrdXrootdResponse &resp, XrdXrootdFile *fP)
 
XrdXrootdProtocolurProtocol ()
 
- Public Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 

Static Public Member Functions

static XrdXrootdPgrwAioAlloc (XrdXrootdProtocol *protP, XrdXrootdResponse &resp, XrdXrootdFile *fP, XrdXrootdPgwBadCS *bcsP=0)
 

Static Public Attributes

static const int aioSZ = 64*1024
 

Additional Inherited Members

- Public Attributes inherited from XrdJob
const char * Comment
 
XrdJobNextJob
 
- Protected Member Functions inherited from XrdXrootdAioTask
 XrdXrootdAioTask (const char *what="aio request")
 
virtual ~XrdXrootdAioTask ()
 
bool Drain ()
 
int gdDone () override
 
void gdFail () override
 
XrdXrootdAioBuffgetBuff (bool wait)
 
void SendError (int rc, const char *eText)
 
void SendFSError (int rc)
 
bool Validate (XrdXrootdAioBuff *aioP)
 
- Protected Attributes inherited from XrdXrootdAioTask
union {
XrdXrootdNormAionextNorm
 
XrdXrootdPgrwAionextPgrw
 
XrdXrootdAioTasknextTask
 
}; 
 
union {
XrdXrootdAioBufffinalRead
 
XrdXrootdAioBuffpendWrite
 
}; 
 
XrdSysMutex aioMutex
 
XrdSysCondVar2 aioReady
 
char aioState
 
XrdXrootdFiledataFile
 
int dataLen
 
XrdLinkdataLink
 
off_t dataOffset
 
off_t highOffset
 
RAtomic_uchar inFlight
 
RAtomic_bool isDone
 
XrdXrootdAioBuffpendQ
 
XrdXrootdAioBuffpendQEnd
 
XrdXrootdProtocolProtocol
 
XrdXrootdResponse Response
 
char Status
 
- Static Protected Attributes inherited from XrdXrootdAioTask
static const int aioDead = 0x01
 
static const int aioHeld = 0x02
 
static const int aioPage = 0x04
 
static const int aioRead = 0x08
 
static const int aioSchd = 0x10
 
static const int Offline = 0
 
static const int Running = 1
 
static const char * TraceID = "AioTask"
 
static const int Waiting = 2
 

Detailed Description

Definition at line 38 of file XrdXrootdPgrwAio.hh.

Member Function Documentation

◆ Alloc()

XrdXrootdPgrwAio * XrdXrootdPgrwAio::Alloc ( XrdXrootdProtocol protP,
XrdXrootdResponse resp,
XrdXrootdFile fP,
XrdXrootdPgwBadCS bcsP = 0 
)
static

Definition at line 87 of file XrdXrootdPgrwAio.cc.

91 {
92  XrdXrootdPgrwAio *reqP;
93 
94 // Obtain a preallocated aio request object
95 //
96  fqMutex.Lock();
97  if ((reqP = fqFirst))
98  {fqFirst = reqP->nextPgrw;
99  numFree--;
100  }
101  fqMutex.UnLock();
102 
103 // If we have no object, create a new one
104 //
105  if (!reqP) reqP = new XrdXrootdPgrwAio;
106 
107 // Initialize the object and return it
108 //
109  reqP->Init(protP, resp, fP);
110  reqP->nextPgrw = 0;
111  reqP->badCSP = bcsP;
112  return reqP;
113 }
void Init(XrdXrootdProtocol *protP, XrdXrootdResponse &resp, XrdXrootdFile *fP)

References XrdXrootdAioTask::Init().

+ Here is the call graph for this function:

◆ DoIt()

void XrdXrootdPgrwAio::DoIt ( )
overridevirtual

Implements XrdJob.

Definition at line 352 of file XrdXrootdPgrwAio.cc.

353 {
354 // Reads run disconnected as they will never read from the link.
355 //
356  if (aioState & aioRead) CopyF2L();
357 }
static const int aioRead

◆ Read()

void XrdXrootdPgrwAio::Read ( long long  offs,
int  dlen 
)
overridevirtual

Implements XrdXrootdAioTask.

Definition at line 363 of file XrdXrootdPgrwAio.cc.

364 {
365 
366 // Setup the copy from the file to the network
367 //
368  dataOffset = highOffset = offs;
369  dataLen = dlen;
371 
372 // Reads run disconnected and are self-terminating, so we need to inclreas the
373 // refcount for the link we will be using to prevent it from disaapearing.
374 // Recycle will decrement it but does so only for reads. We always up the file
375 // refcount and number of requests.
376 //
377  dataLink->setRef(1);
378  dataFile->Ref(1);
379  Protocol->aioUpdReq(1);
380 
381 // Schedule ourselves to run this asynchronously and return
382 //
383  dataFile->aioFob->Schedule(this);
384 }
void Schedule(XrdXrootdAioTask *aioP)
static const int aioPage
XrdXrootdFile * dataFile
XrdXrootdProtocol * Protocol
void Ref(int num)
XrdXrootdAioFob * aioFob
void aioUpdReq(int val)

◆ Recycle()

void XrdXrootdPgrwAio::Recycle ( bool  release)
overridevirtual

Implements XrdXrootdAioTask.

Definition at line 390 of file XrdXrootdPgrwAio.cc.

391 {
392 // Update request count, file and link reference count
393 //
394  if (!(aioState & aioHeld))
395  {Protocol->aioUpdReq(-1);
396  if (aioState & aioRead)
397  {dataLink->setRef(-1);
398  dataFile->Ref(-1);
399  }
400  aioState |= aioHeld;
401  }
402 
403 // Do some traceing
404 //
405  TRACEP(FSAIO,"pgrw recycle "<<(release ? "" : "hold ")
406  <<(aioState & aioRead ? 'R' : 'W')<<" D-S="
407  <<isDone<<'-'<<int(Status));
408 
409 // Place the object on the free queue if possible
410 //
411  if (release)
412  {fqMutex.Lock();
413  if (numFree >= maxKeep)
414  {fqMutex.UnLock();
415  delete this;
416  } else {
417  nextPgrw = fqFirst;
418  fqFirst = this;
419  numFree++;
420  fqMutex.UnLock();
421  }
422  }
423 }
#define TRACEP(act, x)
static const int aioHeld

References TRACEP.

◆ Write()

int XrdXrootdPgrwAio::Write ( long long  offs,
int  dlen 
)
overridevirtual

Implements XrdXrootdAioTask.

Definition at line 544 of file XrdXrootdPgrwAio.cc.

545 {
546 
547 // Update request count. Note that dataLink and dataFile references are
548 // handled outboard as writes are inextricably tied to the data link.
549 //
550  Protocol->aioUpdReq(1);
551 
552 // Setup the copy from the network to the file
553 //
554  aioState &= ~aioRead;
555  dataOffset = highOffset = offs;
556  dataLen = dlen;
557 
558 // Since this thread can't do anything else since it's blocked by the socket
559 // we simply initiate the write operation via a simulated getData() callback.
560 //
561  return gdDone();
562 }
int gdDone() override

Member Data Documentation

◆ aioSZ

const int XrdXrootdPgrwAio::aioSZ = 64*1024
static

Definition at line 55 of file XrdXrootdPgrwAio.hh.


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