ssize_t rdlen;
ssize_t wrlen;
afs_fsize_t size;
+ afs_foff_t done;
size_t length;
char *buff;
int rc; /* return code */
newFdP = IH_OPEN(newH);
assert(newFdP != NULL);
- FDH_SEEK(targFdP, off, SEEK_SET);
- FDH_SEEK(newFdP, off, SEEK_SET);
+ done = off;
while (size > 0) {
if (size > COPYBUFFSIZE) { /* more than a buffer */
length = COPYBUFFSIZE;
length = size;
size = 0;
}
- rdlen = FDH_READ(targFdP, buff, length);
- if (rdlen == length)
- wrlen = FDH_WRITE(newFdP, buff, length);
- else
+ rdlen = FDH_PREAD(targFdP, buff, length, done);
+ if (rdlen == length) {
+ wrlen = FDH_PWRITE(newFdP, buff, length, done);
+ done += rdlen;
+ } else
wrlen = 0;
/* Callers of this function are not prepared to recover
* from error that put the filesystem in an inconsistent
ssize_t rdlen;
ssize_t wrlen;
int rc = 0;
-
- FDH_SEEK(targFdP, off, SEEK_SET);
- FDH_SEEK(newFdP, off, SEEK_SET);
+ afs_foff_t done = off;
if (size > FDH_SIZE(targFdP) - off)
size = FDH_SIZE(targFdP) - off;
length = size;
size = 0;
}
- rdlen = FDH_READ(targFdP, buff, length);
- if (rdlen == length)
- wrlen = FDH_WRITE(newFdP, buff, length);
+ rdlen = FDH_PREAD(targFdP, buff, length, done);
+ if (rdlen == length) {
+ wrlen = FDH_PWRITE(newFdP, buff, length, done);
+ done += rdlen;
+ }
else
wrlen = 0;
DirHandle childdir; /* Handle for dir package I/O */
Error errorCode = 0;
int code;
+ afs_ino_str_t stmp;
/* watch for invalid names */
if (!strcmp(Name, ".") || !strcmp(Name, ".."))
if (errorCode == -1) {
ViceLog(0,
("DT: inode=%s, name=%s, errno=%d\n",
- PrintInode(NULL, VN_GET_INO(*targetptr)), Name,
+ PrintInode(stmp, VN_GET_INO(*targetptr)), Name,
errno));
if (errno != ENOENT)
{
Error temp;
Inode inode = 0;
Inode nearInode; /* hint for inode allocation in solaris */
+ afs_ino_str_t stmp;
if ((errorCode =
AdjustDiskUsage(volptr, BlocksPreallocatedForVnode,
if (IH_DEC(V_linkHandle(volptr), inode, V_parentId(volptr)))
ViceLog(0,
("Alloc_NewVnode: partition %s idec %s failed\n",
- volptr->partition->name, PrintInode(NULL, inode)));
+ volptr->partition->name, PrintInode(stmp, inode)));
IH_RELEASE((*targetptr)->handle);
return errorCode;
if (IH_DEC(V_linkHandle(volptr), inode, V_parentId(volptr)))
ViceLog(0,
("Alloc_NewVnode: partition %s idec %s failed\n",
- volptr->partition->name, PrintInode(NULL, inode)));
+ volptr->partition->name, PrintInode(stmp, inode)));
IH_RELEASE((*targetptr)->handle);
return (errorCode);
}
return code;
}
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
static struct afs_buffer {
struct afs_buffer *next;
} *freeBufferList = 0;
static int afs_buffersAlloced = 0;
-static
+static int
FreeSendBuffer(struct afs_buffer *adata)
{
FS_LOCK;
/* allocate space for sender */
static char *
-AllocSendBuffer()
+AllocSendBuffer(void)
{
struct afs_buffer *tp;
return (char *)tp;
} /*AllocSendBuffer */
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
/*
* This routine returns the status info associated with the targetptr vnode
struct client *t_client; /* tmp ptr to client data */
struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
+ afs_ino_str_t stmp;
FidZero(&olddir);
FidZero(&newdir);
if (errorCode == -1) {
ViceLog(0,
("Del: inode=%s, name=%s, errno=%d\n",
- PrintInode(NULL, VN_GET_INO(newfileptr)),
+ PrintInode(stmp, VN_GET_INO(newfileptr)),
NewName, errno));
if ((errno != ENOENT) && (errno != EIO)
&& (errno != ENXIO))
return EIO;
}
len = strlen((char *) LinkContents);
- code = (len == FDH_WRITE(fdP, (char *) LinkContents, len)) ? 0 : VDISKFULL;
+ code = (len == FDH_PWRITE(fdP, (char *) LinkContents, len, 0)) ? 0 : VDISKFULL;
if (code)
- ViceLog(0, ("SAFSS_Symlink FDH_WRITE failed for len=%d, Fid=%u.%d.%d\n", (int)len, OutFid->Volume, OutFid->Vnode, OutFid->Unique));
+ ViceLog(0, ("SAFSS_Symlink FDH_PWRITE failed for len=%d, Fid=%u.%d.%d\n", (int)len, OutFid->Volume, OutFid->Vnode, OutFid->Unique));
FDH_CLOSE(fdP);
/*
* Set up and return modified status for the parent dir and new symlink
Volume *volptr = 0; /* pointer to the volume header */
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
- Vnode debugvnode1, debugvnode2;
struct client *t_client; /* tmp ptr to client data */
struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
&rights, &anyrights))) {
goto Bad_RemoveDir;
}
- debugvnode1 = *parentptr;
/* set volume synchronization information */
SetVolumeSync(Sync, volptr);
goto Bad_RemoveDir;
}
- debugvnode2 = *parentptr;
/* Do the actual delete of the desired (empty) directory, Name */
if ((errorCode =
DeleteTarget(parentptr, volptr, &targetptr, &dir, &fileFid, Name,
(afs_int32) ((long)sbrk(0) >> 10);
#endif
FS_UNLOCK;
- h_GetWorkStats((int *)&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]),
- (int *)&(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]),
- (int *)0,
- (afs_int32) (FT_ApproxTime()) - (15 * 60));
+ h_GetWorkStats64(&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]),
+ &(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]),
+ 0,
+ (afs_int32) (FT_ApproxTime()) - (15 * 60));
int dir_Buffers; /*# buffers in use by dir package */
int dir_Calls; /*# read calls in dir package */
int dir_IOs; /*# I/O ops in dir package */
+ struct rx_statistics *stats;
/*
* Vnode cache section.
/*
* Rx section.
*/
- a_perfP->rx_packetRequests = (afs_int32) rx_stats.packetRequests;
+ stats = rx_GetStatistics();
+
+ a_perfP->rx_packetRequests = (afs_int32) stats->packetRequests;
a_perfP->rx_noPackets_RcvClass =
- (afs_int32) rx_stats.receivePktAllocFailures;
+ (afs_int32) stats->receivePktAllocFailures;
a_perfP->rx_noPackets_SendClass =
- (afs_int32) rx_stats.sendPktAllocFailures;
+ (afs_int32) stats->sendPktAllocFailures;
a_perfP->rx_noPackets_SpecialClass =
- (afs_int32) rx_stats.specialPktAllocFailures;
- a_perfP->rx_socketGreedy = (afs_int32) rx_stats.socketGreedy;
- a_perfP->rx_bogusPacketOnRead = (afs_int32) rx_stats.bogusPacketOnRead;
- a_perfP->rx_bogusHost = (afs_int32) rx_stats.bogusHost;
- a_perfP->rx_noPacketOnRead = (afs_int32) rx_stats.noPacketOnRead;
+ (afs_int32) stats->specialPktAllocFailures;
+ a_perfP->rx_socketGreedy = (afs_int32) stats->socketGreedy;
+ a_perfP->rx_bogusPacketOnRead = (afs_int32) stats->bogusPacketOnRead;
+ a_perfP->rx_bogusHost = (afs_int32) stats->bogusHost;
+ a_perfP->rx_noPacketOnRead = (afs_int32) stats->noPacketOnRead;
a_perfP->rx_noPacketBuffersOnRead =
- (afs_int32) rx_stats.noPacketBuffersOnRead;
- a_perfP->rx_selects = (afs_int32) rx_stats.selects;
- a_perfP->rx_sendSelects = (afs_int32) rx_stats.sendSelects;
+ (afs_int32) stats->noPacketBuffersOnRead;
+ a_perfP->rx_selects = (afs_int32) stats->selects;
+ a_perfP->rx_sendSelects = (afs_int32) stats->sendSelects;
a_perfP->rx_packetsRead_RcvClass =
- (afs_int32) rx_stats.packetsRead[RX_PACKET_CLASS_RECEIVE];
+ (afs_int32) stats->packetsRead[RX_PACKET_CLASS_RECEIVE];
a_perfP->rx_packetsRead_SendClass =
- (afs_int32) rx_stats.packetsRead[RX_PACKET_CLASS_SEND];
+ (afs_int32) stats->packetsRead[RX_PACKET_CLASS_SEND];
a_perfP->rx_packetsRead_SpecialClass =
- (afs_int32) rx_stats.packetsRead[RX_PACKET_CLASS_SPECIAL];
- a_perfP->rx_dataPacketsRead = (afs_int32) rx_stats.dataPacketsRead;
- a_perfP->rx_ackPacketsRead = (afs_int32) rx_stats.ackPacketsRead;
- a_perfP->rx_dupPacketsRead = (afs_int32) rx_stats.dupPacketsRead;
+ (afs_int32) stats->packetsRead[RX_PACKET_CLASS_SPECIAL];
+ a_perfP->rx_dataPacketsRead = (afs_int32) stats->dataPacketsRead;
+ a_perfP->rx_ackPacketsRead = (afs_int32) stats->ackPacketsRead;
+ a_perfP->rx_dupPacketsRead = (afs_int32) stats->dupPacketsRead;
a_perfP->rx_spuriousPacketsRead =
- (afs_int32) rx_stats.spuriousPacketsRead;
+ (afs_int32) stats->spuriousPacketsRead;
a_perfP->rx_packetsSent_RcvClass =
- (afs_int32) rx_stats.packetsSent[RX_PACKET_CLASS_RECEIVE];
+ (afs_int32) stats->packetsSent[RX_PACKET_CLASS_RECEIVE];
a_perfP->rx_packetsSent_SendClass =
- (afs_int32) rx_stats.packetsSent[RX_PACKET_CLASS_SEND];
+ (afs_int32) stats->packetsSent[RX_PACKET_CLASS_SEND];
a_perfP->rx_packetsSent_SpecialClass =
- (afs_int32) rx_stats.packetsSent[RX_PACKET_CLASS_SPECIAL];
- a_perfP->rx_ackPacketsSent = (afs_int32) rx_stats.ackPacketsSent;
- a_perfP->rx_pingPacketsSent = (afs_int32) rx_stats.pingPacketsSent;
- a_perfP->rx_abortPacketsSent = (afs_int32) rx_stats.abortPacketsSent;
- a_perfP->rx_busyPacketsSent = (afs_int32) rx_stats.busyPacketsSent;
- a_perfP->rx_dataPacketsSent = (afs_int32) rx_stats.dataPacketsSent;
- a_perfP->rx_dataPacketsReSent = (afs_int32) rx_stats.dataPacketsReSent;
- a_perfP->rx_dataPacketsPushed = (afs_int32) rx_stats.dataPacketsPushed;
- a_perfP->rx_ignoreAckedPacket = (afs_int32) rx_stats.ignoreAckedPacket;
- a_perfP->rx_totalRtt_Sec = (afs_int32) rx_stats.totalRtt.sec;
- a_perfP->rx_totalRtt_Usec = (afs_int32) rx_stats.totalRtt.usec;
- a_perfP->rx_minRtt_Sec = (afs_int32) rx_stats.minRtt.sec;
- a_perfP->rx_minRtt_Usec = (afs_int32) rx_stats.minRtt.usec;
- a_perfP->rx_maxRtt_Sec = (afs_int32) rx_stats.maxRtt.sec;
- a_perfP->rx_maxRtt_Usec = (afs_int32) rx_stats.maxRtt.usec;
- a_perfP->rx_nRttSamples = (afs_int32) rx_stats.nRttSamples;
- a_perfP->rx_nServerConns = (afs_int32) rx_stats.nServerConns;
- a_perfP->rx_nClientConns = (afs_int32) rx_stats.nClientConns;
- a_perfP->rx_nPeerStructs = (afs_int32) rx_stats.nPeerStructs;
- a_perfP->rx_nCallStructs = (afs_int32) rx_stats.nCallStructs;
- a_perfP->rx_nFreeCallStructs = (afs_int32) rx_stats.nFreeCallStructs;
+ (afs_int32) stats->packetsSent[RX_PACKET_CLASS_SPECIAL];
+ a_perfP->rx_ackPacketsSent = (afs_int32) stats->ackPacketsSent;
+ a_perfP->rx_pingPacketsSent = (afs_int32) stats->pingPacketsSent;
+ a_perfP->rx_abortPacketsSent = (afs_int32) stats->abortPacketsSent;
+ a_perfP->rx_busyPacketsSent = (afs_int32) stats->busyPacketsSent;
+ a_perfP->rx_dataPacketsSent = (afs_int32) stats->dataPacketsSent;
+ a_perfP->rx_dataPacketsReSent = (afs_int32) stats->dataPacketsReSent;
+ a_perfP->rx_dataPacketsPushed = (afs_int32) stats->dataPacketsPushed;
+ a_perfP->rx_ignoreAckedPacket = (afs_int32) stats->ignoreAckedPacket;
+ a_perfP->rx_totalRtt_Sec = (afs_int32) stats->totalRtt.sec;
+ a_perfP->rx_totalRtt_Usec = (afs_int32) stats->totalRtt.usec;
+ a_perfP->rx_minRtt_Sec = (afs_int32) stats->minRtt.sec;
+ a_perfP->rx_minRtt_Usec = (afs_int32) stats->minRtt.usec;
+ a_perfP->rx_maxRtt_Sec = (afs_int32) stats->maxRtt.sec;
+ a_perfP->rx_maxRtt_Usec = (afs_int32) stats->maxRtt.usec;
+ a_perfP->rx_nRttSamples = (afs_int32) stats->nRttSamples;
+ a_perfP->rx_nServerConns = (afs_int32) stats->nServerConns;
+ a_perfP->rx_nClientConns = (afs_int32) stats->nClientConns;
+ a_perfP->rx_nPeerStructs = (afs_int32) stats->nPeerStructs;
+ a_perfP->rx_nCallStructs = (afs_int32) stats->nCallStructs;
+ a_perfP->rx_nFreeCallStructs = (afs_int32) stats->nFreeCallStructs;
a_perfP->host_NumHostEntries = HTs;
a_perfP->host_HostBlocks = HTBlocks;
a_perfP->host_ClientBlocks = CEBlocks;
a_perfP->sysname_ID = afs_perfstats.sysname_ID;
- a_perfP->rx_nBusies = (afs_int32) rx_stats.nBusies;
+ a_perfP->rx_nBusies = (afs_int32) stats->nBusies;
a_perfP->fs_nBusies = afs_perfstats.fs_nBusies;
+ rx_FreeStatistics(&stats);
} /*FillPerfValues */
struct timeval StartTime, StopTime; /* used to calculate file transfer rates */
IHandle_t *ihP;
FdHandle_t *fdP;
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
char *tbuffer;
-#else /* AFS_NT40_ENV */
+#else /* HAVE_PIOV */
struct iovec tiov[RX_MAXIOVECS];
int tnio;
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
afs_sfsize_t tlen;
afs_int32 optSize;
if (Pos + Len > tlen) /* get length we should send */
Len = ((tlen - Pos) < 0) ? 0 : tlen - Pos;
- (void)FDH_SEEK(fdP, Pos, 0);
{
afs_int32 high, low;
SplitOffsetOrSize(Len, high, low);
#if FS_STATS_DETAILED
(*a_bytesToFetchP) = Len;
#endif /* FS_STATS_DETAILED */
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
tbuffer = AllocSendBuffer();
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
while (Len > 0) {
size_t wlen;
ssize_t nBytes;
wlen = optSize;
else
wlen = Len;
-#ifdef AFS_NT40_ENV
- nBytes = FDH_READ(fdP, tbuffer, wlen);
+#ifndef HAVE_PIOV
+ nBytes = FDH_PREAD(fdP, tbuffer, wlen, Pos);
if (nBytes != wlen) {
FDH_CLOSE(fdP);
FreeSendBuffer((struct afs_buffer *)tbuffer);
return EIO;
}
nBytes = rx_Write(Call, tbuffer, wlen);
-#else /* AFS_NT40_ENV */
+#else /* HAVE_PIOV */
nBytes = rx_WritevAlloc(Call, tiov, &tnio, RX_MAXIOVECS, wlen);
if (nBytes <= 0) {
FDH_CLOSE(fdP);
return EIO;
}
wlen = nBytes;
- nBytes = FDH_READV(fdP, tiov, tnio);
+ nBytes = FDH_PREADV(fdP, tiov, tnio, Pos);
if (nBytes != wlen) {
FDH_CLOSE(fdP);
VTakeOffline(volptr);
return EIO;
}
nBytes = rx_Writev(Call, tiov, tnio, wlen);
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
+ Pos += wlen;
#if FS_STATS_DETAILED
/*
* Bump the number of bytes actually sent by the number from this
#endif /* FS_STATS_DETAILED */
if (nBytes != wlen) {
FDH_CLOSE(fdP);
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
FreeSendBuffer((struct afs_buffer *)tbuffer);
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
return -31;
}
Len -= wlen;
}
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
FreeSendBuffer((struct afs_buffer *)tbuffer);
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
FDH_CLOSE(fdP);
FT_GetTimeOfDay(&StopTime, 0);
afs_sfsize_t bytesTransfered; /* number of bytes actually transfered */
struct timeval StartTime, StopTime; /* Used to measure how long the store takes */
Error errorCode = 0; /* Returned error code to caller */
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
char *tbuffer; /* data copying buffer */
-#else /* AFS_NT40_ENV */
+#else /* HAVE_PIOV */
struct iovec tiov[RX_MAXIOVECS]; /* no data copying with iovec */
int tnio; /* temp for iovec size */
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
afs_sfsize_t tlen; /* temp for xfr length */
Inode tinode; /* inode for I/O */
afs_int32 optSize; /* optimal transfer size */
ssize_t nBytes;
FdHandle_t *fdP, *origfdP = NULL;
struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
+ afs_ino_str_t stmp;
#if FS_STATS_DETAILED
/*
*/
ViceLog(25,
("StoreData_RXStyle : Opening inode %s\n",
- PrintInode(NULL, VN_GET_INO(targetptr))));
+ PrintInode(stmp, VN_GET_INO(targetptr))));
fdP = IH_OPEN(targetptr->handle);
if (fdP == NULL)
return ENOENT;
afs_fsize_t size;
ViceLog(25,
("StoreData_RXStyle : inode %s has more than onelink\n",
- PrintInode(NULL, VN_GET_INO(targetptr))));
+ PrintInode(stmp, VN_GET_INO(targetptr))));
/* other volumes share this data, better copy it first */
/* Adjust the disk block count by the creation of the new inode.
/* truncate the file iff it needs it (ftruncate is slow even when its a noop) */
if (FileLength < DataLength)
FDH_TRUNC(fdP, FileLength);
- if (Pos > 0)
- FDH_SEEK(fdP, Pos, 0);
bytesTransfered = 0;
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
tbuffer = AllocSendBuffer();
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
/* if length == 0, the loop below isn't going to do anything, including
* extend the length of the inode, which it must do, since the file system
* assumes that the inode length == vnode's file length. So, we extend
/* Set the file's length; we've already done an lseek to the right
* spot above.
*/
- nBytes = FDH_WRITE(fdP, &tlen, 1);
+ nBytes = FDH_PWRITE(fdP, &tlen, 1, Pos);
if (nBytes != 1) {
errorCode = -1;
goto done;
rlen = optSize; /* bound by buffer size */
else
rlen = (int)tlen;
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
errorCode = rx_Read(Call, tbuffer, rlen);
-#else /* AFS_NT40_ENV */
+#else /* HAVE_PIOV */
errorCode = rx_Readv(Call, tiov, &tnio, RX_MAXIOVECS, rlen);
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
if (errorCode <= 0) {
errorCode = -32;
break;
(*a_bytesStoredP) += errorCode;
#endif /* FS_STATS_DETAILED */
rlen = errorCode;
-#ifdef AFS_NT40_ENV
- nBytes = FDH_WRITE(fdP, tbuffer, rlen);
-#else /* AFS_NT40_ENV */
- nBytes = FDH_WRITEV(fdP, tiov, tnio);
-#endif /* AFS_NT40_ENV */
+#ifndef HAVE_PIOV
+ nBytes = FDH_PWRITE(fdP, tbuffer, rlen, Pos);
+#else /* HAVE_PIOV */
+ nBytes = FDH_PWRITEV(fdP, tiov, tnio, Pos);
+#endif /* HAVE_PIOV */
if (nBytes != rlen) {
errorCode = VDISKFULL;
break;
}
bytesTransfered += rlen;
+ Pos += rlen;
}
}
done:
-#ifdef AFS_NT40_ENV
+#ifndef HAVE_PIOV
FreeSendBuffer((struct afs_buffer *)tbuffer);
-#endif /* AFS_NT40_ENV */
+#endif /* HAVE_PIOV */
if (sync) {
FDH_SYNC(fdP);
}