aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 03:54:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 03:54:24 -0500
commit85004cc367abc000aa36c0d0e270ab609a68b0cb (patch)
tree5739aae778d67b6d119fe5c668313fc2823e9836 /include/linux/sunrpc
parent149a051f82d2b3860fe32fa182dbc83a66274894 (diff)
parent3fbd67ad61f6d5a09ea717b56c50bc5c3d8042a8 (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (118 commits) NFSv4: Iterate through all nfs_clients when the server recalls a delegation NFSv4: Deal more correctly with duplicate delegations NFS: Fix a potential race between umount and nfs_access_cache_shrinker() NFS: Add an asynchronous delegreturn operation for use in nfs_clear_inode nfs: convert NFS_*(inode) helpers to static inline nfs: obliterate NFS_FLAGS macro NFS: Address memory leaks in the NFS client mount option parser nfs4: allow nfsv4 acls on non-regular-files NFS: Optimise away the sigmask code in aio/dio reads and writes SUNRPC: Don't bother changing the sigmask for asynchronous RPC calls SUNRPC: rpcb_getport_sync() passes incorrect address size to rpc_create() SUNRPC: Clean up block comment preceding rpcb_getport_sync() SUNRPC: Use appropriate argument types in rpcb client SUNRPC: rpcb_getport_sync() should use built-in hostname generator SUNRPC: Clean up functions that free address_strings array NFS: NFS version number is unsigned NLM: Fix a bogus 'return' in nlmclnt_rpc_release NLM: Introduce an arguments structure for nlmclnt_init() NLM/NFS: Use cached nlm_host when calling nlmclnt_proc() NFS: Invoke nlmclnt_init during NFS mount processing ...
Diffstat (limited to 'include/linux/sunrpc')
-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
4 files changed, 69 insertions, 52 deletions
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{