Commit | Line | Data |
---|---|---|
a2907882 KM |
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 | * | |
dbf0c423 | 8 | * %sccs.include.redist.c% |
a2907882 | 9 | * |
a9b4ecb2 | 10 | * @(#)nfs.h 7.11 (Berkeley) %G% |
a2907882 KM |
11 | */ |
12 | ||
13 | /* | |
14 | * Tunable constants for nfs | |
15 | */ | |
b143b1f4 | 16 | |
170bfd05 | 17 | #define NFS_MAXIOVEC 34 |
b143b1f4 KM |
18 | #define NFS_HZ 10 /* Ticks per second for NFS timeouts */ |
19 | #define NFS_TIMEO (1*NFS_HZ) /* Default timeout = 1 second */ | |
170bfd05 | 20 | #define NFS_MINTIMEO (NFS_HZ) /* Min timeout to use */ |
b143b1f4 | 21 | #define NFS_MAXTIMEO (60*NFS_HZ) /* Max timeout to backoff to */ |
f0f1cbaa | 22 | #define NFS_MINIDEMTIMEO (2*NFS_HZ) /* Min timeout for non-idempotent ops*/ |
170bfd05 | 23 | #define NFS_RELIABLETIMEO (5*NFS_HZ) /* Min timeout on reliable sockets */ |
b143b1f4 KM |
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 */ | |
170bfd05 | 27 | #define NFS_FISHY 8 /* Host not responding at this count */ |
b143b1f4 | 28 | #define NFS_ATTRTIMEO 5 /* Attribute cache timeout in sec */ |
170bfd05 KM |
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 */ | |
3b97c194 KM |
32 | #define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */ |
33 | #define NFS_DIRBLKSIZ 1024 /* Size of an NFS directory block */ | |
ffe6f482 | 34 | #define NMOD(a) ((a) % nfs_asyncdaemons) |
a2907882 | 35 | |
f0f1cbaa KM |
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) | |
b143b1f4 | 54 | |
a2907882 KM |
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; | |
f0f1cbaa | 63 | struct nfsmount *r_nmp; |
a2907882 | 64 | struct vnode *r_vp; |
a2907882 | 65 | u_long r_xid; |
b143b1f4 KM |
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 */ | |
f0f1cbaa | 71 | struct proc *r_procp; /* Proc that did I/O system call */ |
a2907882 KM |
72 | }; |
73 | ||
b143b1f4 KM |
74 | /* Flag values for r_flags */ |
75 | #define R_TIMING 0x01 /* timing request (in mntp) */ | |
76 | #define R_SENT 0x02 /* request has been sent */ | |
f0f1cbaa KM |
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 */ | |
b143b1f4 KM |
82 | |
83 | #ifdef KERNEL | |
a2907882 KM |
84 | /* |
85 | * Silly rename structure that hangs off the nfsnode until the name | |
86 | * can be removed by nfs_inactive() | |
87 | */ | |
88 | struct sillyrename { | |
a2907882 | 89 | nfsv2fh_t s_fh; |
a9b4ecb2 KM |
90 | struct ucred *s_cred; |
91 | struct vnode *s_dvp; | |
92 | u_short s_namlen; | |
93 | char s_name[20]; | |
a2907882 KM |
94 | }; |
95 | ||
96 | /* And its flag values */ | |
97 | #define REMOVE 0 | |
98 | #define RMDIR 1 | |
b143b1f4 | 99 | #endif /* KERNEL */ |
a2907882 KM |
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; | |
e49b1a6c KM |
109 | int direofcache_hits; |
110 | int direofcache_misses; | |
66435314 KM |
111 | int biocache_reads; |
112 | int read_bios; | |
113 | int read_physios; | |
114 | int biocache_writes; | |
115 | int write_bios; | |
116 | int write_physios; | |
f0f1cbaa KM |
117 | int biocache_readlinks; |
118 | int readlink_bios; | |
119 | int biocache_readdirs; | |
120 | int readdir_bios; | |
a2907882 KM |
121 | int rpccnt[NFS_NPROCS]; |
122 | int rpcretries; | |
123 | int srvrpccnt[NFS_NPROCS]; | |
124 | int srvrpc_errs; | |
125 | int srv_errs; | |
b143b1f4 KM |
126 | int rpcrequests; |
127 | int rpctimeouts; | |
128 | int rpcunexpected; | |
129 | int rpcinvalid; | |
66435314 KM |
130 | int srvcache_inproghits; |
131 | int srvcache_idemdonehits; | |
132 | int srvcache_nonidemdonehits; | |
133 | int srvcache_misses; | |
a2907882 KM |
134 | }; |
135 | ||
136 | #ifdef KERNEL | |
137 | struct nfsstats nfsstats; | |
b143b1f4 | 138 | #endif /* KERNEL */ |