aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/sunrpc/svc.h69
1 files changed, 10 insertions, 59 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 4ebcdf91f3b3..3669e91c43b8 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -170,7 +170,6 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
170/* 170/*
171 * The context of a single thread, including the request currently being 171 * The context of a single thread, including the request currently being
172 * processed. 172 * processed.
173 * NOTE: First two items must be prev/next.
174 */ 173 */
175struct svc_rqst { 174struct svc_rqst {
176 struct list_head rq_list; /* idle list */ 175 struct list_head rq_list; /* idle list */
@@ -189,12 +188,9 @@ struct svc_rqst {
189 188
190 struct xdr_buf rq_arg; 189 struct xdr_buf rq_arg;
191 struct xdr_buf rq_res; 190 struct xdr_buf rq_res;
192 struct page * rq_argpages[RPCSVC_MAXPAGES]; 191 struct page * rq_pages[RPCSVC_MAXPAGES];
193 struct page * rq_respages[RPCSVC_MAXPAGES]; 192 struct page * *rq_respages; /* points into rq_pages */
194 int rq_restailpage; 193 int rq_resused; /* number of pages used for result */
195 short rq_argused; /* pages used for argument */
196 short rq_arghi; /* pages available in argument page list */
197 short rq_resused; /* pages used for result */
198 194
199 __be32 rq_xid; /* transmission id */ 195 __be32 rq_xid; /* transmission id */
200 u32 rq_prog; /* program number */ 196 u32 rq_prog; /* program number */
@@ -255,63 +251,18 @@ xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
255 return vec->iov_len <= PAGE_SIZE; 251 return vec->iov_len <= PAGE_SIZE;
256} 252}
257 253
258static inline struct page * 254static inline void svc_free_res_pages(struct svc_rqst *rqstp)
259svc_take_res_page(struct svc_rqst *rqstp)
260{ 255{
261 if (rqstp->rq_arghi <= rqstp->rq_argused) 256 while (rqstp->rq_resused) {
262 return NULL; 257 struct page **pp = (rqstp->rq_respages +
263 rqstp->rq_arghi--; 258 --rqstp->rq_resused);
264 rqstp->rq_respages[rqstp->rq_resused] = 259 if (*pp) {
265 rqstp->rq_argpages[rqstp->rq_arghi]; 260 put_page(*pp);
266 return rqstp->rq_respages[rqstp->rq_resused++]; 261 *pp = NULL;
267}
268
269static inline void svc_take_page(struct svc_rqst *rqstp)
270{
271 if (rqstp->rq_arghi <= rqstp->rq_argused) {
272 WARN_ON(1);
273 return;
274 }
275 rqstp->rq_arghi--;
276 rqstp->rq_respages[rqstp->rq_resused] =
277 rqstp->rq_argpages[rqstp->rq_arghi];
278 rqstp->rq_resused++;
279}
280
281static inline void svc_pushback_allpages(struct svc_rqst *rqstp)
282{
283 while (rqstp->rq_resused) {
284 if (rqstp->rq_respages[--rqstp->rq_resused] == NULL)
285 continue;
286 rqstp->rq_argpages[rqstp->rq_arghi++] =
287 rqstp->rq_respages[rqstp->rq_resused];
288 rqstp->rq_respages[rqstp->rq_resused] = NULL;
289 }
290}
291
292static inline void svc_pushback_unused_pages(struct svc_rqst *rqstp)
293{
294 while (rqstp->rq_resused &&
295 rqstp->rq_res.pages != &rqstp->rq_respages[rqstp->rq_resused]) {
296
297 if (rqstp->rq_respages[--rqstp->rq_resused] != NULL) {
298 rqstp->rq_argpages[rqstp->rq_arghi++] =
299 rqstp->rq_respages[rqstp->rq_resused];
300 rqstp->rq_respages[rqstp->rq_resused] = NULL;
301 } 262 }
302 } 263 }
303} 264}
304 265
305static inline void svc_free_allpages(struct svc_rqst *rqstp)
306{
307 while (rqstp->rq_resused) {
308 if (rqstp->rq_respages[--rqstp->rq_resused] == NULL)
309 continue;
310 put_page(rqstp->rq_respages[rqstp->rq_resused]);
311 rqstp->rq_respages[rqstp->rq_resused] = NULL;
312 }
313}
314
315struct svc_deferred_req { 266struct svc_deferred_req {
316 u32 prot; /* protocol (UDP or TCP) */ 267 u32 prot; /* protocol (UDP or TCP) */
317 struct sockaddr_in addr; 268 struct sockaddr_in addr;