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.9 (Berkeley) 06/28/90 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 NMOD(a) ((a) % nfs_asyncdaemons) 34 35 /* 36 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. 37 * What should be in this set is open to debate, but I believe that since 38 * I/O system calls on ufs are never interrupted by signals the set should 39 * be minimal. My reasoning is that many current programs that use signals 40 * such as SIGALRM will not expect file I/O system calls to be interrupted 41 * by them and break. 42 */ 43 #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ 44 sigmask(SIGHUP)|sigmask(SIGQUIT)) 45 46 /* 47 * Socket errors ignored for connectionless sockets?? 48 * For now, ignore them all 49 */ 50 #define NFSIGNORE_SOERROR(s, e) \ 51 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \ 52 ((s) & PR_CONNREQUIRED) == 0) 53 54 /* 55 * Nfs outstanding request list element 56 */ 57 struct nfsreq { 58 struct nfsreq *r_next; 59 struct nfsreq *r_prev; 60 struct mbuf *r_mreq; 61 struct mbuf *r_mrep; 62 struct nfsmount *r_nmp; 63 struct vnode *r_vp; 64 u_long r_xid; 65 short r_flags; /* flags on request, see below */ 66 short r_retry; /* max retransmission count */ 67 short r_rexmit; /* current retrans count */ 68 short r_timer; /* tick counter on reply */ 69 short r_timerinit; /* reinit tick counter on reply */ 70 struct proc *r_procp; /* Proc that did I/O system call */ 71 }; 72 73 /* Flag values for r_flags */ 74 #define R_TIMING 0x01 /* timing request (in mntp) */ 75 #define R_SENT 0x02 /* request has been sent */ 76 #define R_SOFTTERM 0x04 /* soft mnt, too many retries */ 77 #define R_INTR 0x08 /* intr mnt, signal pending */ 78 #define R_SOCKERR 0x10 /* Fatal error on socket */ 79 #define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ 80 #define R_MUSTRESEND 0x40 /* Must resend request */ 81 82 #ifdef KERNEL 83 /* 84 * Silly rename structure that hangs off the nfsnode until the name 85 * can be removed by nfs_inactive() 86 */ 87 struct sillyrename { 88 int s_flag; 89 nfsv2fh_t s_fh; 90 struct nameidata s_namei; 91 }; 92 93 /* And its flag values */ 94 #define REMOVE 0 95 #define RMDIR 1 96 #endif /* KERNEL */ 97 98 /* 99 * Stats structure 100 */ 101 struct nfsstats { 102 int attrcache_hits; 103 int attrcache_misses; 104 int lookupcache_hits; 105 int lookupcache_misses; 106 int direofcache_hits; 107 int direofcache_misses; 108 int biocache_reads; 109 int read_bios; 110 int read_physios; 111 int biocache_writes; 112 int write_bios; 113 int write_physios; 114 int biocache_readlinks; 115 int readlink_bios; 116 int biocache_readdirs; 117 int readdir_bios; 118 int rpccnt[NFS_NPROCS]; 119 int rpcretries; 120 int srvrpccnt[NFS_NPROCS]; 121 int srvrpc_errs; 122 int srv_errs; 123 int rpcrequests; 124 int rpctimeouts; 125 int rpcunexpected; 126 int rpcinvalid; 127 int srvcache_inproghits; 128 int srvcache_idemdonehits; 129 int srvcache_nonidemdonehits; 130 int srvcache_misses; 131 }; 132 133 #ifdef KERNEL 134 struct nfsstats nfsstats; 135 #endif /* KERNEL */ 136