2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include "afs/param.h"
13 #include "afs/sysincludes.h" /* Standard vendor system headers */
14 #ifndef AFS_LINUX22_ENV
15 #include "rpc/types.h"
23 #endif /* AFS_ALPHA_ENV */
24 #include "afsincludes.h" /* Afs-based standard headers */
25 #include "afs/afs_stats.h" /* statistics */
26 #include "afs_prototypes.h"
28 extern int cacheDiskType;
30 /* rock and operations for RX_FILESERVER */
32 struct rxfs_storeVariables {
38 struct AFSStoreStatus InStatus;
42 rxfs_storeUfsPrepare(void *r, afs_uint32 size, afs_uint32 *tlen)
44 *tlen = (size > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : size);
49 rxfs_storeMemPrepare(void *r, afs_uint32 size, afs_uint32 *tlen)
52 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *) r;
54 *tlen = (size > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : size);
56 code = rx_WritevAlloc(v->call, v->tiov, &v->tnio, RX_MAXIOVECS, *tlen);
59 code = rx_Error(v->call);
71 rxfs_storeUfsRead(void *r, struct osi_file *tfile, afs_uint32 offset,
72 afs_uint32 tlen, afs_uint32 *bytesread)
75 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)r;
78 code = afs_osi_Read(tfile, -1, v->tbuffer, tlen);
84 #if defined(KERNEL_HAVE_UERROR)
92 rxfs_storeMemRead(void *r, struct osi_file *tfile, afs_uint32 offset,
93 afs_uint32 tlen, afs_uint32 *bytesread)
96 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)r;
97 struct memCacheEntry *mceP = (struct memCacheEntry *)tfile;
100 code = afs_MemReadvBlk(mceP, offset, v->tiov, v->tnio, tlen);
108 rxfs_storeMemWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
111 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)r;
114 code = rx_Writev(v->call, v->tiov, v->tnio, l);
117 code = rx_Error(v->call);
118 return (code ? code : -33);
120 *byteswritten = code;
125 rxfs_storeUfsWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
128 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)r;
131 code = rx_Write(v->call, v->tbuffer, l);
132 /* writing 0 bytes will
133 * push a short packet. Is that really what we want, just because the
134 * data didn't come back from the disk yet? Let's try it and see. */
137 code = rx_Error(v->call);
138 return (code ? code : -33);
140 *byteswritten = code;
145 rxfs_storeStatus(void *rock)
147 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)rock;
149 if (rx_GetRemoteStatus(v->call) & 1)
155 rxfs_storeClose(void *r, struct AFSFetchStatus *OutStatus, int *doProcessFS)
158 struct AFSVolSync tsync;
159 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)r;
162 code = EndRXAFS_StoreData(v->call, OutStatus, &tsync);
165 *doProcessFS = 1; /* Flag to run afs_ProcessFS() later on */
171 rxfs_storeDestroy(void **r, afs_int32 error)
173 afs_int32 code = error;
174 struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)*r;
180 code2 = rx_EndCall(v->call, code);
186 osi_FreeLargeSpace(v->tbuffer);
188 osi_FreeSmallSpace(v->tiov);
189 osi_FreeSmallSpace(v);
194 struct storeOps rxfs_storeUfsOps = {
195 rxfs_storeUfsPrepare,
204 struct storeOps rxfs_storeMemOps = {
205 rxfs_storeMemPrepare,
214 rxfs_storeInit(struct vcache *avc, struct afs_conn *tc, afs_size_t tlen,
215 afs_size_t bytes, afs_size_t base,
216 struct storeOps **ops, void **rock)
219 struct rxfs_storeVariables *v;
220 struct rx_call *tcall;
225 v = (struct rxfs_storeVariables *) osi_AllocSmallSpace(sizeof(struct rxfs_storeVariables));
227 osi_Panic("rxfs_storeInit: osi_AllocSmallSpace returned NULL\n");
228 memset(v, 0, sizeof(struct rxfs_storeVariables));
230 v->InStatus.ClientModTime = avc->f.m.Date;
231 v->InStatus.Mask = AFS_SETMODTIME;
234 tcall = rx_NewCall(tc->id);
235 #ifdef AFS_64BIT_CLIENT
236 if (!afs_serverHasNo64Bit(tc))
237 code = StartRXAFS_StoreData64(tcall, (struct AFSFid *) &avc->f.fid.Fid,
238 &v->InStatus, base, bytes, tlen);
240 if (tlen > 0xFFFFFFFF) {
244 afs_int32 t1, t2, t3;
248 code = StartRXAFS_StoreData(tcall, (struct AFSFid *)&avc->f.fid.Fid,
249 &v->InStatus, t1, t2, t3);
252 #else /* AFS_64BIT_CLIENT */
253 code = StartRXAFS_StoreData(tcall, (struct AFSFid *)&avc->f.fid.Fid,
254 &v->InStatus, base, bytes, tlen);
255 #endif /* AFS_64BIT_CLIENT */
258 if (cacheDiskType == AFS_FCACHE_TYPE_UFS) {
259 v->tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
262 ("rxfs_storeInit: osi_AllocLargeSpace for iovecs returned NULL\n");
263 *ops = (struct storeOps *) &rxfs_storeUfsOps;
265 v->tiov = osi_AllocSmallSpace(sizeof(struct iovec) * RX_MAXIOVECS);
268 ("rxfs_storeInit: osi_AllocSmallSpace for iovecs returned NULL\n");
269 *ops = (struct storeOps *) &rxfs_storeMemOps;
271 /* do this at a higher level now -- it's a parameter */
272 /* for now, only do 'continue from close' code if file fits in one
273 * chunk. Could clearly do better: if only one modified chunk
274 * then can still do this. can do this on *last* modified chunk */
275 tlen = avc->f.m.Length - 1; /* byte position of last byte we'll store */
277 if (AFS_CHUNK(tlen) != 0)
290 extern unsigned int storeallmissing;
294 * \param tc Ptr to the Rx connection structure involved.
295 * \param dclist pointer to the list of dcaches
296 * \param avc Ptr to the vcache entry.
297 * \param bytes per chunk
298 * \param base where to start the store
299 * \param length number of bytes to store
300 * \param anewDV Ptr to the dataversion after store
301 * \param doProcessFS Ptr to the processFS flag
302 * \param OutStatus Ptr to the OutStatus structure
303 * \param nchunks number of chunks to store
304 * \param nomoreP pointer to the "nomore" flag
306 * \note Environment: Nothing interesting.
309 afs_CacheStoreProc(register struct afs_conn *tc,
310 struct dcache **dclist,
317 struct AFSFetchStatus *OutStatus,
323 struct storeOps *ops;
327 int nomore = *nomoreP;
333 struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */
334 osi_timeval_t xferStartTime, /*FS xfer start time */
335 xferStopTime; /*FS xfer stop time */
336 afs_size_t bytesToXfer = 10000; /* # bytes to xfer */
337 afs_size_t bytesXferred = 10000; /* # bytes actually xferred */
338 #endif /* AFS_NOSTATS */
341 code = rxfs_storeInit(avc, tc, length, bytes, base, &ops, &rock);
343 osi_Panic("afs_CacheStoreProc: rxfs_storeInit failed with %d", code);
346 for (i = 0; i < nchunks && !code; i++) {
349 alen = tdc->f.chunkBytes;
351 afs_warn("afs: missing dcache!\n");
353 continue; /* panic? */
355 afs_Trace4(afs_iclSetp, CM_TRACE_STOREALL2, ICL_TYPE_POINTER, avc,
356 ICL_TYPE_INT32, tdc->f.chunk, ICL_TYPE_INT32, tdc->index,
357 ICL_TYPE_INT32, afs_inode2trace(&tdc->f.inode));
360 if (avc->asynchrony == -1) {
361 if (afs_defaultAsynchrony > (bytes - stored))
362 shouldwake = &nomore;
364 else if ((afs_uint32) avc->asynchrony >= (bytes - stored))
365 shouldwake = &nomore;
367 fP = afs_CFileOpen(&tdc->f.inode);
369 afs_Trace4(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc,
370 ICL_TYPE_FID, &(avc->f.fid), ICL_TYPE_OFFSET,
371 ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_INT32, alen);
373 AFS_STATCNT(CacheStoreProc);
375 XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREDATA);
376 avc->f.truncPos = AFS_NOTRUNC;
379 * In this case, alen is *always* the amount of data we'll be trying
385 xferP = &(afs_stats_cmfullperf.rpc.
386 fsXferTimes[AFS_STATS_FS_XFERIDX_STOREDATA]);
387 osi_GetuTime(&xferStartTime);
388 #endif /* AFS_NOSTATS */
391 afs_int32 bytesread, byteswritten;
392 code = (*ops->prepare)(rock, alen, &tlen);
396 code = (*ops->read)(rock, fP, offset, tlen, &bytesread);
401 code = (*ops->write)(rock, tlen, &byteswritten);
405 bytesXferred += byteswritten;
406 #endif /* AFS_NOSTATS */
411 * if file has been locked on server, can allow
414 if (shouldwake && *shouldwake && ((*ops->status)(rock) == 0)) {
415 *shouldwake = 0; /* only do this once */
419 afs_Trace4(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc,
420 ICL_TYPE_FID, &(avc->f.fid), ICL_TYPE_OFFSET,
421 ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_INT32, alen);
424 osi_GetuTime(&xferStopTime);
427 (xferP->numSuccesses)++;
428 afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_STOREDATA] +=
431 (afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_STOREDATA] >> 10);
432 afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_STOREDATA] &= 0x3FF;
433 if (bytesXferred < xferP->minBytes)
434 xferP->minBytes = bytesXferred;
435 if (bytesXferred > xferP->maxBytes)
436 xferP->maxBytes = bytesXferred;
439 * Tally the size of the object. Note: we tally the actual size,
440 * NOT the number of bytes that made it out over the wire.
442 if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET0)
444 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET1)
446 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET2)
448 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET3)
450 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET4)
452 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET5)
454 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET6)
456 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET7)
461 afs_stats_GetDiff(elapsedTime, xferStartTime, xferStopTime);
462 afs_stats_AddTo((xferP->sumTime), elapsedTime);
463 afs_stats_SquareAddTo((xferP->sqrTime), elapsedTime);
464 if (afs_stats_TimeLessThan(elapsedTime, (xferP->minTime))) {
465 afs_stats_TimeAssign((xferP->minTime), elapsedTime);
467 if (afs_stats_TimeGreaterThan(elapsedTime, (xferP->maxTime))) {
468 afs_stats_TimeAssign((xferP->maxTime), elapsedTime);
471 #endif /* AFS_NOSTATS */
474 if ((tdc->f.chunkBytes < afs_OtherCSize)
475 && (i < (nchunks - 1)) && code == 0) {
476 int bsent, tlen, sbytes =
477 afs_OtherCSize - tdc->f.chunkBytes;
479 osi_AllocLargeSpace(AFS_LRALLOCSIZ);
482 tlen = (sbytes > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : sbytes);
483 memset(tbuffer, 0, tlen);
485 bsent = rx_Write(((struct rxfs_storeVariables*)rock)->call,
490 code = -33; /* XXX */
495 osi_FreeLargeSpace(tbuffer);
497 stored += tdc->f.chunkBytes;
499 /* ideally, I'd like to unlock the dcache and turn
500 * off the writing bit here, but that would
501 * require being able to retry StoreAllSegments in
502 * the event of a failure. It only really matters
503 * if user can't read from a 'locked' dcache or
504 * one which has the writing bit turned on. */
507 code = (*ops->close)(rock, OutStatus, doProcessFS);
513 code = (*ops->destroy)(&rock, code);
519 /* rock and operations for RX_FILESERVER */
521 struct rxfs_fetchVariables {
522 struct rx_call *call;
526 afs_int32 hasNo64bit;
532 rxfs_fetchUfsRead(void *r, afs_uint32 size, afs_uint32 *bytesread)
536 struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)r;
539 tlen = (size > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : size);
541 code = rx_Read(v->call, v->tbuffer, tlen);
550 rxfs_fetchMemRead(void *r, afs_uint32 tlen, afs_uint32 *bytesread)
553 struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)r;
557 code = rx_Readv(v->call, v->iov, &v->nio, RX_MAXIOVECS, tlen);
567 rxfs_fetchMemWrite(void *r, struct osi_file *fP,
568 afs_uint32 offset, afs_uint32 tlen,
569 afs_uint32 *byteswritten)
572 struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)r;
573 struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
575 code = afs_MemWritevBlk(mceP, offset, v->iov, v->nio, tlen);
579 *byteswritten = code;
584 rxfs_fetchUfsWrite(void *r, struct osi_file *fP,
585 afs_uint32 offset, afs_uint32 tlen,
586 afs_uint32 *byteswritten)
589 struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)r;
591 code = afs_osi_Write(fP, -1, v->tbuffer, tlen);
595 *byteswritten = code;
601 rxfs_fetchClose(void *r, struct vcache *avc, struct dcache * adc,
602 struct afs_FetchOutput *tsmall)
604 afs_int32 code, code1 = 0;
605 struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)r;
611 code = EndRXAFS_FetchData(v->call, &tsmall->OutStatus,
618 code1 = rx_EndCall(v->call, code);
629 rxfs_fetchDestroy(void **r, afs_int32 error)
631 afs_int32 code = error;
632 struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)*r;
636 osi_FreeLargeSpace(v->tbuffer);
638 osi_FreeSmallSpace(v->iov);
639 osi_FreeSmallSpace(v);
644 rxfs_fetchMore(void *r, afs_uint32 *length, afs_uint32 *moredata)
647 register struct rxfs_fetchVariables *v
648 = (struct rxfs_fetchVariables *)r;
651 code = rx_Read(v->call, (void *)length, sizeof(afs_int32));
652 *length = ntohl(*length);
654 if (code != sizeof(afs_int32)) {
655 code = rx_Error(v->call);
656 return (code ? code : -1); /* try to return code, not -1 */
662 struct fetchOps rxfs_fetchUfsOps = {
671 struct fetchOps rxfs_fetchMemOps = {
680 rxfs_fetchInit(register struct afs_conn *tc, struct vcache *avc,afs_offs_t base,
681 afs_uint32 size, afs_uint32 *out_length, struct dcache *adc,
682 struct osi_file *fP, struct fetchOps **ops, void **rock)
684 struct rxfs_fetchVariables *v;
686 afs_int32 length_hi, length, bytes;
687 #ifdef AFS_64BIT_CLIENT
689 afs_size_t lengthFound; /* as returned from server */
690 #endif /* AFS_64BIT_CLIENT */
692 v = (struct rxfs_fetchVariables *) osi_AllocSmallSpace(sizeof(struct rxfs_fetchVariables));
694 osi_Panic("rxfs_fetchInit: osi_AllocSmallSpace returned NULL\n");
695 memset(v, 0, sizeof(struct rxfs_fetchVariables));
698 v->call = rx_NewCall(tc->id);
701 #ifdef AFS_64BIT_CLIENT
702 length_hi = code = 0;
703 if (!afs_serverHasNo64Bit(tc)) {
706 code = StartRXAFS_FetchData64(v->call, (struct AFSFid *)&avc->f.fid.Fid,
710 afs_Trace2(afs_iclSetp, CM_TRACE_FETCH64CODE,
711 ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code);
713 bytes = rx_Read(v->call, (char *)&length_hi, sizeof(afs_int32));
715 if (bytes == sizeof(afs_int32)) {
716 length_hi = ntohl(length_hi);
719 code = rx_Error(v->call);
721 code1 = rx_EndCall(v->call, code);
727 if (code == RXGEN_OPCODE || afs_serverHasNo64Bit(tc)) {
728 if (base > 0x7FFFFFFF) {
735 v->call = rx_NewCall(tc->id);
737 StartRXAFS_FetchData(v->call, (struct AFSFid *)
738 &avc->f.fid.Fid, pos,
742 afs_serverSetNo64Bit(tc);
746 bytes = rx_Read(v->call, (char *)&length, sizeof(afs_int32));
748 if (bytes == sizeof(afs_int32))
749 length = ntohl(length);
751 code = rx_Error(v->call);
754 FillInt64(lengthFound, length_hi, length);
755 afs_Trace3(afs_iclSetp, CM_TRACE_FETCH64LENG,
756 ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code,
758 ICL_HANDLE_OFFSET(lengthFound));
759 #else /* AFS_64BIT_CLIENT */
761 code = StartRXAFS_FetchData(v->call, (struct AFSFid *)&avc->f.fid.Fid,
766 bytes = rx_Read(v->call, (char *)&length, sizeof(afs_int32));
768 if (bytes == sizeof(afs_int32))
769 length = ntohl(length);
771 code = rx_Error(v->call);
773 #endif /* AFS_64BIT_CLIENT */
775 osi_FreeSmallSpace(v);
779 if ( cacheDiskType == AFS_FCACHE_TYPE_UFS ) {
780 v->tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
782 osi_Panic("rxfs_fetchInit: osi_AllocLargeSpace for iovecs returned NULL\n");
783 osi_Assert(WriteLocked(&adc->lock));
785 *ops = (struct fetchOps *) &rxfs_fetchUfsOps;
788 afs_Trace4(afs_iclSetp, CM_TRACE_MEMFETCH, ICL_TYPE_POINTER, avc,
789 ICL_TYPE_POINTER, fP, ICL_TYPE_OFFSET,
790 ICL_HANDLE_OFFSET(base), ICL_TYPE_INT32, length);
792 * We need to alloc the iovecs on the heap so that they are "pinned"
793 * rather than declare them on the stack - defect 11272
795 v->iov = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec) *
798 osi_Panic("afs_CacheFetchProc: osi_AllocSmallSpace for iovecs returned NULL\n");
799 *ops = (struct fetchOps *) &rxfs_fetchMemOps;
802 *out_length = length;
808 * Routine called on fetch; also tells people waiting for data
809 * that more has arrived.
811 * \param tc Ptr to the Rx connection structure.
812 * \param fP File descriptor for the cache file.
813 * \param abase Base offset to fetch.
814 * \param adc Ptr to the dcache entry for the file, write-locked.
815 * \param avc Ptr to the vcache entry for the file.
816 * \param size Amount of data that should be fetched.
817 * \param tsmall Ptr to the afs_FetchOutput structure.
819 * \note Environment: Nothing interesting.
822 afs_CacheFetchProc(register struct afs_conn *tc,
823 register struct osi_file *fP, afs_size_t abase,
824 struct dcache *adc, struct vcache *avc,
826 struct afs_FetchOutput *tsmall)
828 register afs_int32 code;
830 afs_uint32 bytesread, byteswritten;
831 struct fetchOps *ops = NULL;
834 register int offset = 0;
838 struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */
839 osi_timeval_t xferStartTime, /*FS xfer start time */
840 xferStopTime; /*FS xfer stop time */
841 afs_size_t bytesToXfer = 0, bytesXferred = 0;
844 AFS_STATCNT(CacheFetchProc);
846 XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHDATA);
848 code = rxfs_fetchInit(tc, avc, abase, size, &length, adc, fP, &ops, &rock);
852 &(afs_stats_cmfullperf.rpc.fsXferTimes[AFS_STATS_FS_XFERIDX_FETCHDATA]);
853 osi_GetuTime(&xferStartTime);
854 #endif /* AFS_NOSTATS */
856 adc->validPos = abase;
860 code = (*ops->more)(rock, &length, &moredata);
865 * The fetch protocol is extended for the AFS/DFS translator
866 * to allow multiple blocks of data, each with its own length,
867 * to be returned. As long as the top bit is set, there are more
870 * We do not do this for AFS file servers because they sometimes
871 * return large negative numbers as the transfer size.
873 if (avc->f.states & CForeign) {
874 moredata = length & 0x80000000;
875 length &= ~0x80000000;
880 bytesToXfer += length;
881 #endif /* AFS_NOSTATS */
883 #ifdef RX_KERNEL_TRACE
884 afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING,
887 code = (*ops->read)(rock, length, &bytesread);
888 #ifdef RX_KERNEL_TRACE
889 afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING,
893 bytesXferred += bytesread;
894 #endif /* AFS_NOSTATS */
896 afs_Trace3(afs_iclSetp, CM_TRACE_FETCH64READ,
897 ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code,
898 ICL_TYPE_INT32, length);
902 code = (*ops->write)(rock, fP, offset, bytesread, &byteswritten);
908 adc->validPos = abase;
909 if (afs_osi_Wakeup(&adc->validPos) == 0)
910 afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE, ICL_TYPE_STRING,
911 __FILE__, ICL_TYPE_INT32, __LINE__,
912 ICL_TYPE_POINTER, adc, ICL_TYPE_INT32,
918 code = (*ops->close)(rock, avc, adc, tsmall);
919 (*ops->destroy)(&rock, code);
922 osi_GetuTime(&xferStopTime);
925 (xferP->numSuccesses)++;
926 afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_FETCHDATA] += bytesXferred;
928 (afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_FETCHDATA] >> 10);
929 afs_stats_XferSumBytes[AFS_STATS_FS_XFERIDX_FETCHDATA] &= 0x3FF;
930 if (bytesXferred < xferP->minBytes)
931 xferP->minBytes = bytesXferred;
932 if (bytesXferred > xferP->maxBytes)
933 xferP->maxBytes = bytesXferred;
936 * Tally the size of the object. Note: we tally the actual size,
937 * NOT the number of bytes that made it out over the wire.
939 if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET0)
941 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET1)
943 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET2)
945 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET3)
947 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET4)
949 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET5)
951 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET6)
953 else if (bytesToXfer <= AFS_STATS_MAXBYTES_BUCKET7)
958 afs_stats_GetDiff(elapsedTime, xferStartTime, xferStopTime);
959 afs_stats_AddTo((xferP->sumTime), elapsedTime);
960 afs_stats_SquareAddTo((xferP->sqrTime), elapsedTime);
961 if (afs_stats_TimeLessThan(elapsedTime, (xferP->minTime))) {
962 afs_stats_TimeAssign((xferP->minTime), elapsedTime);
964 if (afs_stats_TimeGreaterThan(elapsedTime, (xferP->maxTime))) {
965 afs_stats_TimeAssign((xferP->maxTime), elapsedTime);