xref: /csrg-svn/sys/nfs/nfs.h (revision 40116)
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  * Redistribution and use in source and binary forms are permitted
9  * provided that the above copyright notice and this paragraph are
10  * duplicated in all such forms and that any documentation,
11  * advertising materials, and other materials related to such
12  * distribution and use acknowledge that the software was developed
13  * by the University of California, Berkeley.  The name of the
14  * University may not be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  *	@(#)nfs.h	7.5 (Berkeley) 02/16/90
21  */
22 
23 /*
24  * Tunable constants for nfs
25  */
26 
27 #define	MAX_IOVEC	10
28 #define NFS_HZ		10		/* Ticks per second for NFS timeouts */
29 #define	NFS_TIMEO	(1*NFS_HZ)	/* Default timeout = 1 second */
30 #define	NFS_MINTIMEO	(NFS_HZ/2)	/* Min timeout to use */
31 #define	NFS_MAXTIMEO	(60*NFS_HZ)	/* Max timeout to backoff to */
32 #define	NFS_MAXREXMIT	100		/* Stop counting after this many */
33 #define	NFS_MAXWINDOW	1024		/* Max number of outstanding requests */
34 #define	NFS_RETRANS	10		/* Num of retrans for soft mounts */
35 #define NFS_FISHY	6		/* Host not responding at this count */
36 #define	NFS_ATTRTIMEO	5		/* Attribute cache timeout in sec */
37 #define	NFS_WSIZE	8192		/* Max. write data size <= 8192 */
38 #define	NFS_RSIZE	8192		/* Max. read data size <= 8192 */
39 #define	MAX_READDIR	NFS_RSIZE	/* Max. size of directory read */
40 #define	MAX_ASYNCDAEMON	20		/* Max. number async_daemons runnable */
41 #define	NMOD(a)		((a) % nfs_asyncdaemons)
42 
43 
44 /*
45  * Nfs outstanding request list element
46  */
47 struct nfsreq {
48 	struct nfsreq	*r_next;
49 	struct nfsreq	*r_prev;
50 	struct mbuf	*r_mreq;
51 	struct mbuf	*r_mrep;
52 	struct nfsmount *r_mntp;
53 	struct vnode	*r_vp;
54 	int		r_msiz;
55 	u_long		r_xid;
56 	short		r_flags;	/* flags on request, see below */
57 	short		r_retry;	/* max retransmission count */
58 	short		r_rexmit;	/* current retrans count */
59 	short		r_timer;	/* tick counter on reply */
60 	short		r_timerinit;	/* reinit tick counter on reply */
61 };
62 
63 /* Flag values for r_flags */
64 #define R_TIMING	0x01		/* timing request (in mntp) */
65 #define R_SENT		0x02		/* request has been sent */
66 
67 #ifdef	KERNEL
68 /*
69  * Silly rename structure that hangs off the nfsnode until the name
70  * can be removed by nfs_inactive()
71  */
72 struct sillyrename {
73 	int	s_flag;
74 	nfsv2fh_t s_fh;
75 	struct nameidata s_namei;
76 };
77 
78 /* And its flag values */
79 #define REMOVE		0
80 #define	RMDIR		1
81 #endif	/* KERNEL */
82 
83 /*
84  * Stats structure
85  */
86 struct nfsstats {
87 	int	attrcache_hits;
88 	int	attrcache_misses;
89 	int	lookupcache_hits;
90 	int	lookupcache_misses;
91 	int	biocache_reads;
92 	int	read_bios;
93 	int	read_physios;
94 	int	biocache_writes;
95 	int	write_bios;
96 	int	write_physios;
97 	int	rpccnt[NFS_NPROCS];
98 	int	rpcretries;
99 	int	srvrpccnt[NFS_NPROCS];
100 	int	srvrpc_errs;
101 	int	srv_errs;
102 	int	rpcrequests;
103 	int	rpctimeouts;
104 	int	rpcunexpected;
105 	int	rpcinvalid;
106 	int	srvcache_inproghits;
107 	int	srvcache_idemdonehits;
108 	int	srvcache_nonidemdonehits;
109 	int	srvcache_misses;
110 };
111 
112 #ifdef KERNEL
113 struct nfsstats nfsstats;
114 #endif /* KERNEL */
115