From 3b95323f9f5b27857becf17b0684995294241627 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sat, 23 Nov 2002 01:51:43 +0000 Subject: [PATCH] viced-make-send-buffersize-tunable-20021122 idea from chas williams. arguably should be made larger than 16k also. --- src/viced/afsfileprocs.c | 8 +++----- src/viced/callback.c | 2 +- src/viced/viced.c | 15 +++++++++++++++ src/viced/viced_prototypes.h | 1 + 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 37fcde5..7865c96 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1874,8 +1874,6 @@ afs_int32 SRXAFS_ResidencyCmd (struct rx_call *acall, struct AFSFid *Fid, return EINVAL; } -#define AFSV_BUFFERSIZE 16384 - static struct afs_buffer { struct afs_buffer *next; } *freeBufferList = 0; @@ -1901,7 +1899,7 @@ static char *AllocSendBuffer() afs_buffersAlloced++; if (!freeBufferList) { FS_UNLOCK - return malloc(AFSV_BUFFERSIZE); + return malloc(sendBufSize); } tp = freeBufferList; freeBufferList = tp->next; @@ -6521,7 +6519,7 @@ FetchData_RXStyle(Volume *volptr, ihP = targetptr->handle; fdP = IH_OPEN(ihP); if (fdP == NULL) return EIO; - optSize = AFSV_BUFFERSIZE; + optSize = sendBufSize; tlen = FDH_SIZE(fdP); if (tlen < 0) { FDH_CLOSE(fdP); @@ -6799,7 +6797,7 @@ StoreData_RXStyle(Volume *volptr, TM_GetTimeOfDay(&StartTime, 0); - optSize = AFSV_BUFFERSIZE; + optSize = sendBufSize; /* truncate the file iff it needs it (ftruncate is slow even when its a noop) */ if (FileLength < DataLength) FDH_TRUNC(fdP, FileLength); diff --git a/src/viced/callback.c b/src/viced/callback.c index e706825..5ce3816 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -163,7 +163,7 @@ struct CallBack { unsigned short spare; /* make it a multiple of 32 bits. */ } *CB; /* Don't use CB[0] */ -/* status bits for status field of CallBack structure */ +/* status values for status field of CallBack structure */ #define CB_NORMAL 1 /* Normal call back */ #define CB_DELAYED 2 /* Delayed call back due to rpc problems. The call back entry will be added back to the diff --git a/src/viced/viced.c b/src/viced/viced.c index e66c114..d390c4b 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -165,6 +165,7 @@ int buffs = 90; /* 70 */ int novbc = 0; /* Enable Volume Break calls */ int busy_threshold = 600; int udpBufSize = 0; /* UDP buffer size for receive*/ +int sendBufSize = 16384; /* send buffer size */ struct timeval tp; @@ -581,6 +582,7 @@ static void FlagMsg() strcat(buffer, "[-k ] "); strcat(buffer, "[-realm ] "); strcat(buffer, "[-udpsize ] "); + strcat(buffer, "[-sendsize ] "); /* strcat(buffer, "[-enable_peer_stats] "); */ /* strcat(buffer, "[-enable_process_stats] "); */ strcat(buffer, "[-help]\n"); @@ -834,6 +836,19 @@ static int ParseArgs(int argc, char *argv[]) udpBufSize = bufSize; } else + if ( !strcmp(argv[i], "-sendsize")) { + if ( (i+1) >= argc ) { + printf("You have to specify -sendsize \n"); + return -1; + } + bufSize = atoi(argv[++i]); + if ( bufSize < 16384 ) + printf("Warning:sendsize %d is less than minimum %d; ignoring\n", + bufSize, 16384); + else + sendBufSize = bufSize; + } + else if (!strcmp(argv[i], "-enable_peer_stats")) { rx_enablePeerRPCStats(); } diff --git a/src/viced/viced_prototypes.h b/src/viced/viced_prototypes.h index e69de29..c444754 100644 --- a/src/viced/viced_prototypes.h +++ b/src/viced/viced_prototypes.h @@ -0,0 +1 @@ +extern int sendBufSize; -- 1.9.4