extern int cacheDiskType;
+
+#ifndef AFS_NOSTATS
+void
+FillStoreStats(int code, int idx, osi_timeval_t *xferStartTime,
+ afs_size_t bytesToXfer, afs_size_t bytesXferred)
+{
+ struct afs_stats_xferData *xferP;
+ osi_timeval_t xferStopTime;
+ XSTATS_DECLS;
+
+ xferP = &(afs_stats_cmfullperf.rpc.fsXferTimes[idx]);
+ osi_GetuTime(&xferStopTime);
+ (xferP->numXfers)++;
+ if (!code) {
+ (xferP->numSuccesses)++;
+ afs_stats_XferSumBytes[idx] += bytesXferred;
+ (xferP->sumBytes) += (afs_stats_XferSumBytes[idx] >> 10);
+ afs_stats_XferSumBytes[idx] &= 0x3FF;
+ if (bytesXferred < xferP->minBytes)
+ xferP->minBytes = bytesXferred;
+ if (bytesXferred > xferP->maxBytes)
+ xferP->maxBytes = bytesXferred;
+
+ /*
+ * Tally the size of the object. Note: we tally the actual size,
+ * NOT the number of bytes that made it out over the wire.
+ */
+ if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET0) (xferP->count[0])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET1) (xferP->count[1])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET2) (xferP->count[2])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET3) (xferP->count[3])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET4) (xferP->count[4])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET5) (xferP->count[5])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET6) (xferP->count[6])++;
+ else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET7) (xferP->count[7])++;
+ else
+ (xferP->count[8])++;
+
+ afs_stats_GetDiff(elapsedTime, (*xferStartTime), xferStopTime);
+ afs_stats_AddTo((xferP->sumTime), elapsedTime);
+ afs_stats_SquareAddTo((xferP->sqrTime), elapsedTime);
+ if (afs_stats_TimeLessThan(elapsedTime, (xferP->minTime))) {
+ afs_stats_TimeAssign((xferP->minTime), elapsedTime);
+ }
+ if (afs_stats_TimeGreaterThan(elapsedTime, (xferP->maxTime))) {
+ afs_stats_TimeAssign((xferP->maxTime), elapsedTime);
+ }
+ }
+}
+#endif /* AFS_NOSTATS */
+
/* rock and operations for RX_FILESERVER */
struct rxfs_storeVariables {
}
afs_int32
+rxfs_storePadd(void *rock, afs_uint32 size)
+{
+ afs_int32 code = 0;
+ int bsent, tlen;
+ struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)rock;
+
+ if ( !v->tbuffer )
+ v->tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
+ memset(v->tbuffer, 0, AFS_LRALLOCSIZ);
+
+ while (size > 0) {
+ tlen = (size > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : size);
+ RX_AFS_GUNLOCK();
+ code = rx_Write(v->call, v->tbuffer, tlen);
+ RX_AFS_GLOCK();
+
+ if (code != tlen)
+ return -33; /* XXX */
+ size -= tlen;
+ }
+ return code;
+}
+
+afs_int32
rxfs_storeStatus(void *rock)
{
struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)rock;
rxfs_storeUfsRead,
rxfs_storeUfsWrite,
rxfs_storeStatus,
+ rxfs_storePadd,
rxfs_storeClose,
rxfs_storeDestroy
};
rxfs_storeMemRead,
rxfs_storeMemWrite,
rxfs_storeStatus,
+ rxfs_storePadd,
rxfs_storeClose,
rxfs_storeDestroy
};
afs_int32 code = 0;
#ifndef AFS_NOSTATS
- struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */
- osi_timeval_t xferStartTime, /*FS xfer start time */
- xferStopTime; /*FS xfer stop time */
+ osi_timeval_t xferStartTime; /*FS xfer start time */
afs_size_t bytesToXfer = 10000; /* # bytes to xfer */
afs_size_t bytesXferred = 10000; /* # bytes actually xferred */
#endif /* AFS_NOSTATS */
bytesToXfer = alen;
bytesXferred = 0;
- xferP = &(afs_stats_cmfullperf.rpc.
- fsXferTimes[AFS_STATS_FS_XFERIDX_STOREDATA]);
osi_GetuTime(&xferStartTime);
#endif /* AFS_NOSTATS */
ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_INT32, alen);
#ifndef AFS_NOSTATS
- osi_GetuTime(&xferStopTime);
- (xferP->numXfers)++;
- if (!code) {
- (xferP->numSuccesses)++;
- afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_STOREDATA] +=
- bytesXferred;
- (xferP->sumBytes) +=
- (afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_STOREDATA] >> 10);
- afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_STOREDATA] &= 0x3FF;
- if (bytesXferred < xferP->minBytes)
- xferP->minBytes = bytesXferred;
- if (bytesXferred > xferP->maxBytes)
- xferP->maxBytes = bytesXferred;
-
- /*
- * Tally the size of the object. Note: we tally the actual size,
- * NOT the number of bytes that made it out over the wire.
- */
- if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET0)
- (xferP->count[0])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET1)
- (xferP->count[1])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET2)
- (xferP->count[2])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET3)
- (xferP->count[3])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET4)
- (xferP->count[4])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET5)
- (xferP->count[5])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET6)
- (xferP->count[6])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET7)
- (xferP->count[7])++;
- else
- (xferP->count[8])++;
-
- afs_stats_GetDiff(elapsedTime, xferStartTime, xferStopTime);
- afs_stats_AddTo((xferP->sumTime), elapsedTime);
- afs_stats_SquareAddTo((xferP->sqrTime), elapsedTime);
- if (afs_stats_TimeLessThan(elapsedTime, (xferP->minTime)))
- afs_stats_TimeAssign((xferP->minTime), elapsedTime);
- if (afs_stats_TimeGreaterThan(elapsedTime, (xferP->maxTime)))
- afs_stats_TimeAssign((xferP->maxTime), elapsedTime);
- }
+ FillStoreStats(code, AFS_STATS_FS_XFERIDX_STOREDATA,
+ &xferStartTime, bytesToXfer, bytesXferred);
#endif /* AFS_NOSTATS */
afs_CFileClose(fP);
* \note Environment: Nothing interesting.
*/
int
-afs_CacheStoreVCache(struct dcache **dcList,
- struct vcache *avc,
- struct vrequest *areq,
- int sync,
- unsigned int minj,
- unsigned int high,
+afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc,
+ struct vrequest *areq, int sync,
+ unsigned int minj, unsigned int high,
unsigned int moredata,
- afs_hyper_t *anewDV,
- afs_size_t *amaxStoredLength)
+ afs_hyper_t *anewDV, afs_size_t *amaxStoredLength)
{
afs_int32 code = 0;
struct storeOps *ops;
#endif
code = rxfs_storeInit(avc, tc, length, bytes, base,
sync, &ops, &rock);
- if ( code ) {
- osi_Panic(
- "afs_CacheStoreProc: rxfs_storeInit failed with %d", code);
- }
-
- code = afs_CacheStoreDCaches(avc, dclist, bytes, anewDV,
- &doProcessFS, &OutStatus, nchunks, nomore, ops, rock);
+ if (!code)
+ code = afs_CacheStoreDCaches(avc, dclist, bytes, anewDV,
+ &doProcessFS, &OutStatus,
+ nchunks, nomore, ops, rock);
#ifdef AFS_64BIT_CLIENT
if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) {
afs_serverSetNo64Bit(tc);
afs_int32
rxfs_fetchInit(register struct afs_conn *tc, struct vcache *avc,afs_offs_t base,
- afs_uint32 size, afs_uint32 *out_length, struct dcache *adc,
+ afs_uint32 size, afs_uint32 *alength, struct dcache *adc,
struct osi_file *fP, struct fetchOps **ops, void **rock)
{
struct rxfs_fetchVariables *v;
if (!v->call)
v->call = rx_NewCall(tc->id);
code =
- StartRXAFS_FetchData(v->call, (struct AFSFid *)
- &avc->f.fid.Fid, pos,
- size);
+ StartRXAFS_FetchData(v->call, (struct AFSFid *)&avc->f.fid.Fid,
+ pos, size);
RX_AFS_GLOCK();
}
afs_serverSetNo64Bit(tc);
return code;
}
- if ( cacheDiskType == AFS_FCACHE_TYPE_UFS ) {
+ if (cacheDiskType == AFS_FCACHE_TYPE_UFS) {
v->tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
if (!v->tbuffer)
osi_Panic("rxfs_fetchInit: osi_AllocLargeSpace for iovecs returned NULL\n");
* We need to alloc the iovecs on the heap so that they are "pinned"
* rather than declare them on the stack - defect 11272
*/
- v->iov = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec) *
- RX_MAXIOVECS);
+ v->iov = osi_AllocSmallSpace(sizeof(struct iovec) * RX_MAXIOVECS);
if (!v->iov)
- osi_Panic("afs_CacheFetchProc: osi_AllocSmallSpace for iovecs returned NULL\n");
+ osi_Panic("rxfs_fetchInit: osi_AllocSmallSpace for iovecs returned NULL\n");
*ops = (struct fetchOps *) &rxfs_fetchMemOps;
}
*rock = (void *)v;
- *out_length = length;
+ *alength = length;
return 0;
}
XSTATS_DECLS;
#ifndef AFS_NOSTATS
- struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */
- osi_timeval_t xferStartTime, /*FS xfer start time */
- xferStopTime; /*FS xfer stop time */
+ osi_timeval_t xferStartTime; /*FS xfer start time */
afs_size_t bytesToXfer = 0, bytesXferred = 0;
#endif
code = rxfs_fetchInit(tc, avc, abase, size, &length, adc, fP, &ops, &rock);
#ifndef AFS_NOSTATS
- xferP =
- &(afs_stats_cmfullperf.rpc.fsXferTimes[AFS_STATS_FS_XFERIDX_FETCHDATA]);
osi_GetuTime(&xferStartTime);
#endif /* AFS_NOSTATS */
(*ops->destroy)(&rock, code);
#ifndef AFS_NOSTATS
- osi_GetuTime(&xferStopTime);
- (xferP->numXfers)++;
- if (!code) {
- (xferP->numSuccesses)++;
- afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_FETCHDATA] += bytesXferred;
- (xferP->sumBytes) +=
- (afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_FETCHDATA] >> 10);
- afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_FETCHDATA] &= 0x3FF;
- if (bytesXferred < xferP->minBytes)
- xferP->minBytes = bytesXferred;
- if (bytesXferred > xferP->maxBytes)
- xferP->maxBytes = bytesXferred;
-
- /*
- * Tally the size of the object. Note: we tally the actual size,
- * NOT the number of bytes that made it out over the wire.
- */
- if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET0)
- (xferP->count[0])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET1)
- (xferP->count[1])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET2)
- (xferP->count[2])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET3)
- (xferP->count[3])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET4)
- (xferP->count[4])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET5)
- (xferP->count[5])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET6)
- (xferP->count[6])++;
- else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET7)
- (xferP->count[7])++;
- else
- (xferP->count[8])++;
-
- afs_stats_GetDiff(elapsedTime, xferStartTime, xferStopTime);
- afs_stats_AddTo((xferP->sumTime), elapsedTime);
- afs_stats_SquareAddTo((xferP->sqrTime), elapsedTime);
- if (afs_stats_TimeLessThan(elapsedTime, (xferP->minTime))) {
- afs_stats_TimeAssign((xferP->minTime), elapsedTime);
- }
- if (afs_stats_TimeGreaterThan(elapsedTime, (xferP->maxTime))) {
- afs_stats_TimeAssign((xferP->maxTime), elapsedTime);
- }
- }
+ FillStoreStats(code, AFS_STATS_FS_XFERIDX_FETCHDATA,&xferStartTime,
+ bytesToXfer, bytesXferred);
#endif
XSTATS_END_TIME;
return code;