From a8206e35594c0227acd06bf220b9479b78361c82 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Sun, 30 Dec 2001 18:41:52 +0000 Subject: [PATCH] Add a #define for the size of the nfs_backoff[] array, and use this instead of magic constants in the code. --- sys/nfsclient/nfs_socket.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index 6f1f525e7077..62a7b2378272 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -132,7 +132,8 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0, ""); */ #define NFS_CWNDSCALE 256 #define NFS_MAXCWND (NFS_CWNDSCALE * 32) -static int nfs_backoff[8] = { 2, 4, 8, 16, 32, 64, 128, 256, }; +#define NFS_NBACKOFF 8 +static int nfs_backoff[NFS_NBACKOFF] = { 2, 4, 8, 16, 32, 64, 128, 256, }; struct callout_handle nfs_timer_handle; static int nfs_msg(struct thread *, char *, char *); @@ -1013,7 +1014,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum, (void) tsleep((caddr_t)&lbolt, PSOCK, "nqnfstry", 0); trylater_delay *= nfs_backoff[trylater_cnt]; - if (trylater_cnt < 7) + if (trylater_cnt < NFS_NBACKOFF - 1) trylater_cnt++; goto tryagain; } @@ -1088,7 +1089,7 @@ nfs_timer(void *arg) timeo *= nfs_backoff[nmp->nm_timeouts - 1]; if (rep->r_rtt <= timeo) continue; - if (nmp->nm_timeouts < 8) + if (nmp->nm_timeouts < NFS_NBACKOFF) nmp->nm_timeouts++; } /*