1 #ifndef NFS_CLUSTER_H
2 #define NFS_CLUSTER_H
3 
4 
5 
6 #ifdef __KERNEL__
7 #include <asm/atomic.h>
8 #include <linux/nfs_fs_sb.h>
9 
10 /*
11  * Counters of total number and pending number of requests.
12  * When the total number of requests exceeds the hard limit, we stall
13  * until it drops again.
14  */
15 #define MAX_REQUEST_HARD        256
16 
17 /*
18  * Maximum number of requests per write cluster.
19  * 32 requests per cluster account for 128K of data on an intel box.
20  * Note: it's a good idea to make this number smaller than MAX_REQUEST_SOFT.
21  *
22  * For 100Mbps Ethernet, 128 pages (i.e. 256K) per cluster gives much
23  * better performance.
24  */
25 #define REQUEST_HASH_SIZE	16
26 #define REQUEST_NR(off)		((off) >> PAGE_CACHE_SHIFT)
27 #define REQUEST_HASH(ino, off)	(((ino) ^ REQUEST_NR(off)) & (REQUEST_HASH_SIZE - 1))
28 
29 
30 /*
31  * Functions
32  */
33 extern int		nfs_reqlist_alloc(struct nfs_server *);
34 extern void		nfs_reqlist_free(struct nfs_server *);
35 extern void		nfs_reqlist_exit(struct nfs_server *);
36 extern void		nfs_wake_flushd(void);
37 
38 /*
39  * This is the per-mount writeback cache.
40  */
41 struct nfs_reqlist {
42 	atomic_t		nr_requests;
43 	unsigned long		runat;
44 	wait_queue_head_t	request_wait;
45 
46 	/* The async RPC task that is responsible for scanning the
47 	 * requests.
48 	 */
49 	struct rpc_task		*task;		/* request flush task */
50 
51 	/* Authentication flavor handle for this NFS client */
52 	struct rpc_auth		*auth;
53 
54 	/* The list of all inodes with pending writebacks.  */
55 	struct inode		*inodes;
56 };
57 
58 #endif
59 
60 #endif
61