aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/lockd/bind.h19
-rw-r--r--include/linux/nfs_fs.h74
-rw-r--r--include/linux/nfs_fs_sb.h17
-rw-r--r--include/linux/nfs_page.h13
-rw-r--r--include/linux/nfs_xdr.h21
-rw-r--r--include/linux/sunrpc/clnt.h11
-rw-r--r--include/linux/sunrpc/msg_prot.h39
-rw-r--r--include/linux/sunrpc/sched.h57
-rw-r--r--include/linux/sunrpc/xprt.h14
9 files changed, 168 insertions, 97 deletions
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 6f1637c61e10..3d25bcd139d1 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -33,9 +33,26 @@ struct nlmsvc_binding {
33extern struct nlmsvc_binding * nlmsvc_ops; 33extern struct nlmsvc_binding * nlmsvc_ops;
34 34
35/* 35/*
36 * Similar to nfs_client_initdata, but without the NFS-specific
37 * rpc_ops field.
38 */
39struct nlmclnt_initdata {
40 const char *hostname;
41 const struct sockaddr *address;
42 size_t addrlen;
43 unsigned short protocol;
44 u32 nfs_version;
45};
46
47/*
36 * Functions exported by the lockd module 48 * Functions exported by the lockd module
37 */ 49 */
38extern int nlmclnt_proc(struct inode *, int, struct file_lock *); 50
51extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
52extern void nlmclnt_done(struct nlm_host *host);
53
54extern int nlmclnt_proc(struct nlm_host *host, int cmd,
55 struct file_lock *fl);
39extern int lockd_up(int proto); 56extern int lockd_up(int proto);
40extern void lockd_down(void); 57extern void lockd_down(void);
41 58
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2d15d4aac094..099ddb4481c0 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -196,28 +196,67 @@ struct nfs_inode {
196#define NFS_INO_STALE (2) /* possible stale inode */ 196#define NFS_INO_STALE (2) /* possible stale inode */
197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ 197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
198 198
199static inline struct nfs_inode *NFS_I(struct inode *inode) 199static inline struct nfs_inode *NFS_I(const struct inode *inode)
200{ 200{
201 return container_of(inode, struct nfs_inode, vfs_inode); 201 return container_of(inode, struct nfs_inode, vfs_inode);
202} 202}
203#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info))
204 203
205#define NFS_FH(inode) (&NFS_I(inode)->fh) 204static inline struct nfs_server *NFS_SB(const struct super_block *s)
206#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 205{
207#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 206 return (struct nfs_server *)(s->s_fs_info);
208#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) 207}
209#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 208
210#define NFS_MINATTRTIMEO(inode) \ 209static inline struct nfs_fh *NFS_FH(const struct inode *inode)
211 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 210{
212 : NFS_SERVER(inode)->acregmin) 211 return &NFS_I(inode)->fh;
213#define NFS_MAXATTRTIMEO(inode) \ 212}
214 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 213
215 : NFS_SERVER(inode)->acregmax) 214static inline struct nfs_server *NFS_SERVER(const struct inode *inode)
215{
216 return NFS_SB(inode->i_sb);
217}
218
219static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode)
220{
221 return NFS_SERVER(inode)->client;
222}
223
224static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
225{
226 return NFS_SERVER(inode)->nfs_client->rpc_ops;
227}
228
229static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
230{
231 return NFS_I(inode)->cookieverf;
232}
233
234static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
235{
236 struct nfs_server *nfss = NFS_SERVER(inode);
237 return S_ISDIR(inode->i_mode) ? nfss->acdirmin : nfss->acregmin;
238}
216 239
217#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 240static inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode)
218#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) 241{
242 struct nfs_server *nfss = NFS_SERVER(inode);
243 return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax;
244}
219 245
220#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 246static inline int NFS_STALE(const struct inode *inode)
247{
248 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
249}
250
251static inline __u64 NFS_FILEID(const struct inode *inode)
252{
253 return NFS_I(inode)->fileid;
254}
255
256static inline void set_nfs_fileid(struct inode *inode, __u64 fileid)
257{
258 NFS_I(inode)->fileid = fileid;
259}
221 260
222static inline void nfs_mark_for_revalidate(struct inode *inode) 261static inline void nfs_mark_for_revalidate(struct inode *inode)
223{ 262{
@@ -237,7 +276,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
237 276
238static inline int NFS_USE_READDIRPLUS(struct inode *inode) 277static inline int NFS_USE_READDIRPLUS(struct inode *inode)
239{ 278{
240 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); 279 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
241} 280}
242 281
243static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) 282static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
@@ -366,6 +405,7 @@ extern const struct inode_operations nfs3_dir_inode_operations;
366extern const struct file_operations nfs_dir_operations; 405extern const struct file_operations nfs_dir_operations;
367extern struct dentry_operations nfs_dentry_operations; 406extern struct dentry_operations nfs_dentry_operations;
368 407
408extern void nfs_force_lookup_revalidate(struct inode *dir);
369extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 409extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
370extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 410extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
371extern void nfs_access_zap_cache(struct inode *inode); 411extern void nfs_access_zap_cache(struct inode *inode);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 0cac49bc0955..3423c6761bf7 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -3,8 +3,12 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/wait.h>
7
8#include <asm/atomic.h>
6 9
7struct nfs_iostats; 10struct nfs_iostats;
11struct nlm_host;
8 12
9/* 13/*
10 * The nfs_client identifies our client state to the server. 14 * The nfs_client identifies our client state to the server.
@@ -14,20 +18,19 @@ struct nfs_client {
14 int cl_cons_state; /* current construction state (-ve: init error) */ 18 int cl_cons_state; /* current construction state (-ve: init error) */
15#define NFS_CS_READY 0 /* ready to be used */ 19#define NFS_CS_READY 0 /* ready to be used */
16#define NFS_CS_INITING 1 /* busy initialising */ 20#define NFS_CS_INITING 1 /* busy initialising */
17 int cl_nfsversion; /* NFS protocol version */
18 unsigned long cl_res_state; /* NFS resources state */ 21 unsigned long cl_res_state; /* NFS resources state */
19#define NFS_CS_CALLBACK 1 /* - callback started */ 22#define NFS_CS_CALLBACK 1 /* - callback started */
20#define NFS_CS_IDMAP 2 /* - idmap started */ 23#define NFS_CS_IDMAP 2 /* - idmap started */
21#define NFS_CS_RENEWD 3 /* - renewd started */ 24#define NFS_CS_RENEWD 3 /* - renewd started */
22 struct sockaddr_in cl_addr; /* server identifier */ 25 struct sockaddr_storage cl_addr; /* server identifier */
26 size_t cl_addrlen;
23 char * cl_hostname; /* hostname of server */ 27 char * cl_hostname; /* hostname of server */
24 struct list_head cl_share_link; /* link in global client list */ 28 struct list_head cl_share_link; /* link in global client list */
25 struct list_head cl_superblocks; /* List of nfs_server structs */ 29 struct list_head cl_superblocks; /* List of nfs_server structs */
26 30
27 struct rpc_clnt * cl_rpcclient; 31 struct rpc_clnt * cl_rpcclient;
28 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ 32 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
29 unsigned long retrans_timeo; /* retransmit timeout */ 33 int cl_proto; /* Network transport protocol */
30 unsigned int retrans_count; /* number of retransmit tries */
31 34
32#ifdef CONFIG_NFS_V4 35#ifdef CONFIG_NFS_V4
33 u64 cl_clientid; /* constant */ 36 u64 cl_clientid; /* constant */
@@ -62,7 +65,7 @@ struct nfs_client {
62 /* Our own IP address, as a null-terminated string. 65 /* Our own IP address, as a null-terminated string.
63 * This is used to generate the clientid, and the callback address. 66 * This is used to generate the clientid, and the callback address.
64 */ 67 */
65 char cl_ipaddr[16]; 68 char cl_ipaddr[48];
66 unsigned char cl_id_uniquifier; 69 unsigned char cl_id_uniquifier;
67#endif 70#endif
68}; 71};
@@ -78,6 +81,7 @@ struct nfs_server {
78 struct list_head master_link; /* link in master servers list */ 81 struct list_head master_link; /* link in master servers list */
79 struct rpc_clnt * client; /* RPC client handle */ 82 struct rpc_clnt * client; /* RPC client handle */
80 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 83 struct rpc_clnt * client_acl; /* ACL RPC client handle */
84 struct nlm_host *nlm_host; /* NLM client handle */
81 struct nfs_iostats * io_stats; /* I/O statistics */ 85 struct nfs_iostats * io_stats; /* I/O statistics */
82 struct backing_dev_info backing_dev_info; 86 struct backing_dev_info backing_dev_info;
83 atomic_long_t writeback; /* number of writeback pages */ 87 atomic_long_t writeback; /* number of writeback pages */
@@ -110,6 +114,9 @@ struct nfs_server {
110 filesystem */ 114 filesystem */
111#endif 115#endif
112 void (*destroy)(struct nfs_server *); 116 void (*destroy)(struct nfs_server *);
117
118 atomic_t active; /* Keep trace of any activity to this server */
119 wait_queue_head_t active_wq; /* Wait for any activity to stop */
113}; 120};
114 121
115/* Server capabilities */ 122/* Server capabilities */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 30dbcc185e69..a1676e19e491 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -83,6 +83,7 @@ extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
83extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 83extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
84extern int nfs_wait_on_request(struct nfs_page *); 84extern int nfs_wait_on_request(struct nfs_page *);
85extern void nfs_unlock_request(struct nfs_page *req); 85extern void nfs_unlock_request(struct nfs_page *req);
86extern int nfs_set_page_tag_locked(struct nfs_page *req);
86extern void nfs_clear_page_tag_locked(struct nfs_page *req); 87extern void nfs_clear_page_tag_locked(struct nfs_page *req);
87 88
88 89
@@ -95,18 +96,6 @@ nfs_lock_request_dontget(struct nfs_page *req)
95 return !test_and_set_bit(PG_BUSY, &req->wb_flags); 96 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
96} 97}
97 98
98/*
99 * Lock the page of an asynchronous request and take a reference
100 */
101static inline int
102nfs_lock_request(struct nfs_page *req)
103{
104 if (test_and_set_bit(PG_BUSY, &req->wb_flags))
105 return 0;
106 kref_get(&req->wb_kref);
107 return 1;
108}
109
110/** 99/**
111 * nfs_list_add_request - Insert a request into a list 100 * nfs_list_add_request - Insert a request into a list
112 * @req: request 101 * @req: request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index daab252f2e5c..f301d0b8babc 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -666,16 +666,17 @@ struct nfs4_rename_res {
666 struct nfs_fattr * new_fattr; 666 struct nfs_fattr * new_fattr;
667}; 667};
668 668
669#define NFS4_SETCLIENTID_NAMELEN (56)
669struct nfs4_setclientid { 670struct nfs4_setclientid {
670 const nfs4_verifier * sc_verifier; /* request */ 671 const nfs4_verifier * sc_verifier;
671 unsigned int sc_name_len; 672 unsigned int sc_name_len;
672 char sc_name[48]; /* request */ 673 char sc_name[NFS4_SETCLIENTID_NAMELEN];
673 u32 sc_prog; /* request */ 674 u32 sc_prog;
674 unsigned int sc_netid_len; 675 unsigned int sc_netid_len;
675 char sc_netid[4]; /* request */ 676 char sc_netid[RPCBIND_MAXNETIDLEN];
676 unsigned int sc_uaddr_len; 677 unsigned int sc_uaddr_len;
677 char sc_uaddr[24]; /* request */ 678 char sc_uaddr[RPCBIND_MAXUADDRLEN];
678 u32 sc_cb_ident; /* request */ 679 u32 sc_cb_ident;
679}; 680};
680 681
681struct nfs4_statfs_arg { 682struct nfs4_statfs_arg {
@@ -773,7 +774,7 @@ struct nfs_access_entry;
773 * RPC procedure vector for NFSv2/NFSv3 demuxing 774 * RPC procedure vector for NFSv2/NFSv3 demuxing
774 */ 775 */
775struct nfs_rpc_ops { 776struct nfs_rpc_ops {
776 int version; /* Protocol version */ 777 u32 version; /* Protocol version */
777 struct dentry_operations *dentry_ops; 778 struct dentry_operations *dentry_ops;
778 const struct inode_operations *dir_inode_ops; 779 const struct inode_operations *dir_inode_ops;
779 const struct inode_operations *file_inode_ops; 780 const struct inode_operations *file_inode_ops;
@@ -816,11 +817,11 @@ struct nfs_rpc_ops {
816 struct nfs_pathconf *); 817 struct nfs_pathconf *);
817 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 818 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
818 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus); 819 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
819 void (*read_setup) (struct nfs_read_data *); 820 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
820 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 821 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
821 void (*write_setup) (struct nfs_write_data *, int how); 822 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
822 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 823 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
823 void (*commit_setup) (struct nfs_write_data *, int how); 824 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
824 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 825 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
825 int (*file_open) (struct inode *, struct file *); 826 int (*file_open) (struct inode *, struct file *);
826 int (*file_release) (struct inode *, struct file *); 827 int (*file_release) (struct inode *, struct file *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index d9d5c5ad826c..3e9addc741c1 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -46,6 +46,7 @@ struct rpc_clnt {
46 cl_autobind : 1;/* use getport() */ 46 cl_autobind : 1;/* use getport() */
47 47
48 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 48 struct rpc_rtt * cl_rtt; /* RTO estimator data */
49 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
49 50
50 int cl_nodelen; /* nodename length */ 51 int cl_nodelen; /* nodename length */
51 char cl_nodename[UNX_MAXNODENAME]; 52 char cl_nodename[UNX_MAXNODENAME];
@@ -54,6 +55,7 @@ struct rpc_clnt {
54 struct dentry * cl_dentry; /* inode */ 55 struct dentry * cl_dentry; /* inode */
55 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 56 struct rpc_clnt * cl_parent; /* Points to parent of clones */
56 struct rpc_rtt cl_rtt_default; 57 struct rpc_rtt cl_rtt_default;
58 struct rpc_timeout cl_timeout_default;
57 struct rpc_program * cl_program; 59 struct rpc_program * cl_program;
58 char cl_inline_name[32]; 60 char cl_inline_name[32];
59}; 61};
@@ -99,7 +101,7 @@ struct rpc_create_args {
99 struct sockaddr *address; 101 struct sockaddr *address;
100 size_t addrsize; 102 size_t addrsize;
101 struct sockaddr *saddress; 103 struct sockaddr *saddress;
102 struct rpc_timeout *timeout; 104 const struct rpc_timeout *timeout;
103 char *servername; 105 char *servername;
104 struct rpc_program *program; 106 struct rpc_program *program;
105 u32 version; 107 u32 version;
@@ -123,11 +125,10 @@ void rpc_shutdown_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 125void rpc_release_client(struct rpc_clnt *);
124 126
125int rpcb_register(u32, u32, int, unsigned short, int *); 127int rpcb_register(u32, u32, int, unsigned short, int *);
126int rpcb_getport_sync(struct sockaddr_in *, __u32, __u32, int); 128int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
127void rpcb_getport_async(struct rpc_task *); 129void rpcb_getport_async(struct rpc_task *);
128 130
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 131void rpc_call_start(struct rpc_task *);
130
131int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 132int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
132 int flags, const struct rpc_call_ops *tk_ops, 133 int flags, const struct rpc_call_ops *tk_ops,
133 void *calldata); 134 void *calldata);
@@ -142,7 +143,7 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
142size_t rpc_max_payload(struct rpc_clnt *); 143size_t rpc_max_payload(struct rpc_clnt *);
143void rpc_force_rebind(struct rpc_clnt *); 144void rpc_force_rebind(struct rpc_clnt *);
144size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 145size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
145char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 146const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
146 147
147#endif /* __KERNEL__ */ 148#endif /* __KERNEL__ */
148#endif /* _LINUX_SUNRPC_CLNT_H */ 149#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index c4beb5775111..70df4f1d8847 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -152,5 +152,44 @@ typedef __be32 rpc_fraghdr;
152 */ 152 */
153#define RPCBIND_MAXNETIDLEN (4u) 153#define RPCBIND_MAXNETIDLEN (4u)
154 154
155/*
156 * Universal addresses are introduced in RFC 1833 and further spelled
157 * out in RFC 3530. RPCBIND_MAXUADDRLEN defines a maximum byte length
158 * of a universal address for use in allocating buffers and character
159 * arrays.
160 *
161 * Quoting RFC 3530, section 2.2:
162 *
163 * For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the
164 * US-ASCII string:
165 *
166 * h1.h2.h3.h4.p1.p2
167 *
168 * The prefix, "h1.h2.h3.h4", is the standard textual form for
169 * representing an IPv4 address, which is always four octets long.
170 * Assuming big-endian ordering, h1, h2, h3, and h4, are respectively,
171 * the first through fourth octets each converted to ASCII-decimal.
172 * Assuming big-endian ordering, p1 and p2 are, respectively, the first
173 * and second octets each converted to ASCII-decimal. For example, if a
174 * host, in big-endian order, has an address of 0x0A010307 and there is
175 * a service listening on, in big endian order, port 0x020F (decimal
176 * 527), then the complete universal address is "10.1.3.7.2.15".
177 *
178 * ...
179 *
180 * For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the
181 * US-ASCII string:
182 *
183 * x1:x2:x3:x4:x5:x6:x7:x8.p1.p2
184 *
185 * The suffix "p1.p2" is the service port, and is computed the same way
186 * as with universal addresses for TCP and UDP over IPv4. The prefix,
187 * "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for
188 * representing an IPv6 address as defined in Section 2.2 of [RFC2373].
189 * Additionally, the two alternative forms specified in Section 2.2 of
190 * [RFC2373] are also acceptable.
191 */
192#define RPCBIND_MAXUADDRLEN (56u)
193
155#endif /* __KERNEL__ */ 194#endif /* __KERNEL__ */
156#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 195#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8ea077db0099..ce3d1b132729 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -56,8 +56,6 @@ struct rpc_task {
56 __u8 tk_garb_retry; 56 __u8 tk_garb_retry;
57 __u8 tk_cred_retry; 57 __u8 tk_cred_retry;
58 58
59 unsigned long tk_cookie; /* Cookie for batching tasks */
60
61 /* 59 /*
62 * timeout_fn to be executed by timer bottom half 60 * timeout_fn to be executed by timer bottom half
63 * callback to be executed after waking up 61 * callback to be executed after waking up
@@ -78,7 +76,6 @@ struct rpc_task {
78 struct timer_list tk_timer; /* kernel timer */ 76 struct timer_list tk_timer; /* kernel timer */
79 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 77 unsigned long tk_timeout; /* timeout for rpc_sleep() */
80 unsigned short tk_flags; /* misc flags */ 78 unsigned short tk_flags; /* misc flags */
81 unsigned char tk_priority : 2;/* Task priority */
82 unsigned long tk_runstate; /* Task run status */ 79 unsigned long tk_runstate; /* Task run status */
83 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 80 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
84 * be any workqueue 81 * be any workqueue
@@ -94,6 +91,9 @@ struct rpc_task {
94 unsigned long tk_start; /* RPC task init timestamp */ 91 unsigned long tk_start; /* RPC task init timestamp */
95 long tk_rtt; /* round-trip time (jiffies) */ 92 long tk_rtt; /* round-trip time (jiffies) */
96 93
94 pid_t tk_owner; /* Process id for batching tasks */
95 unsigned char tk_priority : 2;/* Task priority */
96
97#ifdef RPC_DEBUG 97#ifdef RPC_DEBUG
98 unsigned short tk_pid; /* debugging aid */ 98 unsigned short tk_pid; /* debugging aid */
99#endif 99#endif
@@ -117,6 +117,15 @@ struct rpc_call_ops {
117 void (*rpc_release)(void *); 117 void (*rpc_release)(void *);
118}; 118};
119 119
120struct rpc_task_setup {
121 struct rpc_task *task;
122 struct rpc_clnt *rpc_client;
123 const struct rpc_message *rpc_message;
124 const struct rpc_call_ops *callback_ops;
125 void *callback_data;
126 unsigned short flags;
127 signed char priority;
128};
120 129
121/* 130/*
122 * RPC task flags 131 * RPC task flags
@@ -180,10 +189,10 @@ struct rpc_call_ops {
180 * Note: if you change these, you must also change 189 * Note: if you change these, you must also change
181 * the task initialization definitions below. 190 * the task initialization definitions below.
182 */ 191 */
183#define RPC_PRIORITY_LOW 0 192#define RPC_PRIORITY_LOW (-1)
184#define RPC_PRIORITY_NORMAL 1 193#define RPC_PRIORITY_NORMAL (0)
185#define RPC_PRIORITY_HIGH 2 194#define RPC_PRIORITY_HIGH (1)
186#define RPC_NR_PRIORITY (RPC_PRIORITY_HIGH+1) 195#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW)
187 196
188/* 197/*
189 * RPC synchronization objects 198 * RPC synchronization objects
@@ -191,7 +200,7 @@ struct rpc_call_ops {
191struct rpc_wait_queue { 200struct rpc_wait_queue {
192 spinlock_t lock; 201 spinlock_t lock;
193 struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */ 202 struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */
194 unsigned long cookie; /* cookie of last task serviced */ 203 pid_t owner; /* process id of last task serviced */
195 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ 204 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
196 unsigned char priority; /* current priority */ 205 unsigned char priority; /* current priority */
197 unsigned char count; /* # task groups remaining serviced so far */ 206 unsigned char count; /* # task groups remaining serviced so far */
@@ -208,41 +217,13 @@ struct rpc_wait_queue {
208 * performance of NFS operations such as read/write. 217 * performance of NFS operations such as read/write.
209 */ 218 */
210#define RPC_BATCH_COUNT 16 219#define RPC_BATCH_COUNT 16
211
212#ifndef RPC_DEBUG
213# define RPC_WAITQ_INIT(var,qname) { \
214 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
215 .tasks = { \
216 [0] = LIST_HEAD_INIT(var.tasks[0]), \
217 [1] = LIST_HEAD_INIT(var.tasks[1]), \
218 [2] = LIST_HEAD_INIT(var.tasks[2]), \
219 }, \
220 }
221#else
222# define RPC_WAITQ_INIT(var,qname) { \
223 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
224 .tasks = { \
225 [0] = LIST_HEAD_INIT(var.tasks[0]), \
226 [1] = LIST_HEAD_INIT(var.tasks[1]), \
227 [2] = LIST_HEAD_INIT(var.tasks[2]), \
228 }, \
229 .name = qname, \
230 }
231#endif
232# define RPC_WAITQ(var,qname) struct rpc_wait_queue var = RPC_WAITQ_INIT(var,qname)
233
234#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) 220#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0)
235 221
236/* 222/*
237 * Function prototypes 223 * Function prototypes
238 */ 224 */
239struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, 225struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
240 const struct rpc_call_ops *ops, void *data); 226struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
241struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
242 const struct rpc_call_ops *ops, void *data);
243void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
244 int flags, const struct rpc_call_ops *ops,
245 void *data);
246void rpc_put_task(struct rpc_task *); 227void rpc_put_task(struct rpc_task *);
247void rpc_exit_task(struct rpc_task *); 228void rpc_exit_task(struct rpc_task *);
248void rpc_release_calldata(const struct rpc_call_ops *, void *); 229void rpc_release_calldata(const struct rpc_call_ops *, void *);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 30b17b3bc1a9..b3ff9a815e6f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -120,7 +120,7 @@ struct rpc_xprt {
120 struct kref kref; /* Reference count */ 120 struct kref kref; /* Reference count */
121 struct rpc_xprt_ops * ops; /* transport methods */ 121 struct rpc_xprt_ops * ops; /* transport methods */
122 122
123 struct rpc_timeout timeout; /* timeout parms */ 123 const struct rpc_timeout *timeout; /* timeout parms */
124 struct sockaddr_storage addr; /* server address */ 124 struct sockaddr_storage addr; /* server address */
125 size_t addrlen; /* size of server address */ 125 size_t addrlen; /* size of server address */
126 int prot; /* IP protocol */ 126 int prot; /* IP protocol */
@@ -183,7 +183,7 @@ struct rpc_xprt {
183 bklog_u; /* backlog queue utilization */ 183 bklog_u; /* backlog queue utilization */
184 } stat; 184 } stat;
185 185
186 char * address_strings[RPC_DISPLAY_MAX]; 186 const char *address_strings[RPC_DISPLAY_MAX];
187}; 187};
188 188
189struct xprt_create { 189struct xprt_create {
@@ -191,7 +191,6 @@ struct xprt_create {
191 struct sockaddr * srcaddr; /* optional local address */ 191 struct sockaddr * srcaddr; /* optional local address */
192 struct sockaddr * dstaddr; /* remote peer address */ 192 struct sockaddr * dstaddr; /* remote peer address */
193 size_t addrlen; 193 size_t addrlen;
194 struct rpc_timeout * timeout; /* optional timeout parameters */
195}; 194};
196 195
197struct xprt_class { 196struct xprt_class {
@@ -203,11 +202,6 @@ struct xprt_class {
203}; 202};
204 203
205/* 204/*
206 * Transport operations used by ULPs
207 */
208void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
209
210/*
211 * Generic internal transport functions 205 * Generic internal transport functions
212 */ 206 */
213struct rpc_xprt *xprt_create_transport(struct xprt_create *args); 207struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
@@ -245,7 +239,8 @@ void xprt_adjust_cwnd(struct rpc_task *task, int result);
245struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 239struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
246void xprt_complete_rqst(struct rpc_task *task, int copied); 240void xprt_complete_rqst(struct rpc_task *task, int copied);
247void xprt_release_rqst_cong(struct rpc_task *task); 241void xprt_release_rqst_cong(struct rpc_task *task);
248void xprt_disconnect(struct rpc_xprt *xprt); 242void xprt_disconnect_done(struct rpc_xprt *xprt);
243void xprt_force_disconnect(struct rpc_xprt *xprt);
249 244
250/* 245/*
251 * Reserved bit positions in xprt->state 246 * Reserved bit positions in xprt->state
@@ -256,6 +251,7 @@ void xprt_disconnect(struct rpc_xprt *xprt);
256#define XPRT_CLOSE_WAIT (3) 251#define XPRT_CLOSE_WAIT (3)
257#define XPRT_BOUND (4) 252#define XPRT_BOUND (4)
258#define XPRT_BINDING (5) 253#define XPRT_BINDING (5)
254#define XPRT_CLOSING (6)
259 255
260static inline void xprt_set_connected(struct rpc_xprt *xprt) 256static inline void xprt_set_connected(struct rpc_xprt *xprt)
261{ 257{