46#define TRACELINK dataLink
65const char *XrdXrootdNormAio::TraceID =
"NormAio";
77static const int maxKeep = 64;
88 XrdXrootdNormAio *reqP;
94 {fqFirst = reqP->nextNorm;
101 if (!reqP) reqP =
new XrdXrootdNormAio;
105 reqP->
Init(protP, resp, fP);
123 SendError(ENOMEM,
"insufficient memory");
155 XrdXrootdAioBuff *aioP;
164 {
if (
isDone || !CopyF2L_Add2Q())
break;
178 {
if (aioP != finalRead) aioP->
Recycle();
186 {XrdXrootdAioBuff *bP = sendQ, *bPP = 0;
189 bPP = bP; bP = bP->
next;
192 if (bPP) bPP->
next = aioP;
207 XrdXrootdAioBuff *bP = sendQ, *bPP = 0;
208 while(bP->
next) {bPP = bP; bP = bP->
next;}
209 if (bPP) {finalRead = bP; bPP->
next = 0;}
210 else {finalRead = sendQ; sendQ = 0;}
218 else if (!CopyF2L_Add2Q(aioP))
break;
222 while(sendQ && sendQ->sfsAio.aio_offset == sendOffset && aOK)
226 if (!
isDone && Send(aioP) &&
dataLen) aOK = CopyF2L_Add2Q(aioP);
238 snprintf(ebuff,
sizeof(ebuff),
"aio read failed at offset %lld; "
239 "missing data",
static_cast<long long>(sendOffset));
241 }
else Send(finalRead,
true);
246 if (finalRead) finalRead->
Recycle();
247 while((aioP = sendQ)) {sendQ = sendQ->next; aioP->
Recycle();}
269 XrdXrootdAioBuff *aioP;
281 {
SendError(ENOMEM,
"insufficient memory");
318 {
if (rc > 0) pendWrite = aioP;
334 {
if (!
dataLen)
return (Send(0) ? 0 : -1);
335 SendError(EIDRM,
"aioWrite encountered an impossible condition");
336 eLog.
Emsg(
"NormAio",
"write logic error for",
352 int rc =
dataFile->XrdSfsp->write((XrdSfsAio *)aioP);
429 <<(release ?
"" :
" hold")<<
"; reorders="<<reorders
437 if (numFree >= maxKeep)
XrdOucTrace * XrdXrootdTrace
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
virtual void Recycle() override
static XrdXrootdAioBuff * Alloc(XrdXrootdAioTask *arp)
bool Validate(XrdXrootdAioBuff *aioP)
XrdXrootdAioBuff * getBuff(bool wait)
void SendError(int rc, const char *eText)
XrdXrootdResponse Response
void Init(XrdXrootdProtocol *protP, XrdXrootdResponse &resp, XrdXrootdFile *fP)
XrdXrootdProtocol * Protocol
int Write(long long offs, int dlen) override
void Recycle(bool release) override
void Read(long long offs, int dlen) override
static XrdXrootdNormAio * Alloc(XrdXrootdProtocol *protP, XrdXrootdResponse &resp, XrdXrootdFile *fP)