1 /* 2 * Copyright (c) 1989 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)nfs.h 7.12 (Berkeley) 12/15/91 11 */ 12 13 /* 14 * Tunable constants for nfs 15 */ 16 17 #define NFS_MAXIOVEC 34 18 #define NFS_HZ 10 /* Ticks per second for NFS timeouts */ 19 #define NFS_TIMEO (1*NFS_HZ) /* Default timeout = 1 second */ 20 #define NFS_MINTIMEO (NFS_HZ) /* Min timeout to use */ 21 #define NFS_MAXTIMEO (60*NFS_HZ) /* Max timeout to backoff to */ 22 #define NFS_MINIDEMTIMEO (2*NFS_HZ) /* Min timeout for non-idempotent ops*/ 23 #define NFS_RELIABLETIMEO (5*NFS_HZ) /* Min timeout on reliable sockets */ 24 #define NFS_MAXREXMIT 100 /* Stop counting after this many */ 25 #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */ 26 #define NFS_RETRANS 10 /* Num of retrans for soft mounts */ 27 #define NFS_FISHY 8 /* Host not responding at this count */ 28 #define NFS_ATTRTIMEO 5 /* Attribute cache timeout in sec */ 29 #define NFS_WSIZE 8192 /* Def. write data size <= 8192 */ 30 #define NFS_RSIZE 8192 /* Def. read data size <= 8192 */ 31 #define NFS_MAXREADDIR NFS_MAXDATA /* Max. size of directory read */ 32 #define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */ 33 #define NFS_DIRBLKSIZ 1024 /* Size of an NFS directory block */ 34 #define NMOD(a) ((a) % nfs_asyncdaemons) 35 36 /* 37 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. 38 * What should be in this set is open to debate, but I believe that since 39 * I/O system calls on ufs are never interrupted by signals the set should 40 * be minimal. My reasoning is that many current programs that use signals 41 * such as SIGALRM will not expect file I/O system calls to be interrupted 42 * by them and break. 43 */ 44 #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ 45 sigmask(SIGHUP)|sigmask(SIGQUIT)) 46 47 /* 48 * Socket errors ignored for connectionless sockets?? 49 * For now, ignore them all 50 */ 51 #define NFSIGNORE_SOERROR(s, e) \ 52 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \ 53 ((s) & PR_CONNREQUIRED) == 0) 54 55 /* 56 * Nfs outstanding request list element 57 */ 58 struct nfsreq { 59 struct nfsreq *r_next; 60 struct nfsreq *r_prev; 61 struct mbuf *r_mreq; 62 struct mbuf *r_mrep; 63 struct nfsmount *r_nmp; 64 struct vnode *r_vp; 65 u_long r_xid; 66 short r_flags; /* flags on request, see below */ 67 short r_retry; /* max retransmission count */ 68 short r_rexmit; /* current retrans count */ 69 short r_timer; /* tick counter on reply */ 70 short r_timerinit; /* reinit tick counter on reply */ 71 struct proc *r_procp; /* Proc that did I/O system call */ 72 }; 73 74 /* Flag values for r_flags */ 75 #define R_TIMING 0x01 /* timing request (in mntp) */ 76 #define R_SENT 0x02 /* request has been sent */ 77 #define R_SOFTTERM 0x04 /* soft mnt, too many retries */ 78 #define R_INTR 0x08 /* intr mnt, signal pending */ 79 #define R_SOCKERR 0x10 /* Fatal error on socket */ 80 #define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ 81 #define R_MUSTRESEND 0x40 /* Must resend request */ 82 83 #ifdef KERNEL 84 /* 85 * Silly rename structure that hangs off the nfsnode until the name 86 * can be removed by nfs_inactive() 87 */ 88 struct sillyrename { 89 nfsv2fh_t s_fh; 90 struct ucred *s_cred; 91 struct vnode *s_dvp; 92 long s_namlen; 93 char s_name[20]; 94 }; 95 96 /* And its flag values */ 97 #define REMOVE 0 98 #define RMDIR 1 99 #endif /* KERNEL */ 100 101 /* 102 * Stats structure 103 */ 104 struct nfsstats { 105 int attrcache_hits; 106 int attrcache_misses; 107 int lookupcache_hits; 108 int lookupcache_misses; 109 int direofcache_hits; 110 int direofcache_misses; 111 int biocache_reads; 112 int read_bios; 113 int read_physios; 114 int biocache_writes; 115 int write_bios; 116 int write_physios; 117 int biocache_readlinks; 118 int readlink_bios; 119 int biocache_readdirs; 120 int readdir_bios; 121 int rpccnt[NFS_NPROCS]; 122 int rpcretries; 123 int srvrpccnt[NFS_NPROCS]; 124 int srvrpc_errs; 125 int srv_errs; 126 int rpcrequests; 127 int rpctimeouts; 128 int rpcunexpected; 129 int rpcinvalid; 130 int srvcache_inproghits; 131 int srvcache_idemdonehits; 132 int srvcache_nonidemdonehits; 133 int srvcache_misses; 134 }; 135 136 #ifdef KERNEL 137 struct nfsstats nfsstats; 138 #endif /* KERNEL */ 139