diff options
| author | Neil Brown <neilb@cse.unsw.edu.au> | 2002-11-06 05:00:28 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-11-06 05:00:28 -0800 |
| commit | 032d360766dcaa3efcd537ce956ed425a98e1440 (patch) | |
| tree | b28ea21f0b86e288af060f634d903a1f7e5da427 /include/linux/sunrpc | |
| parent | 571f30787ba5632f42d855a43208a08d0e50d81c (diff) | |
[PATCH] kNFSd: Use ->sendpage to send nfsd (and lockd) replies.
From Hirokazu Takahashi <taka@valinux.co.jp>
As all rpc server replies are now in well defined pages,
we can use ->sendpage to send these replies, and so
make use for zero-copy transmit on network cards that
support it.
Diffstat (limited to 'include/linux/sunrpc')
| -rw-r--r-- | include/linux/sunrpc/svc.h | 24 | ||||
| -rw-r--r-- | include/linux/sunrpc/svcsock.h | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 24464d66411a..2fa53b11e52c 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -15,6 +15,7 @@ #include <linux/sunrpc/xdr.h> #include <linux/sunrpc/svcauth.h> #include <linux/wait.h> +#include <linux/mm.h> /* * RPC service. @@ -171,7 +172,7 @@ xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) return vec->iov_len <= PAGE_SIZE; } -static int inline take_page(struct svc_rqst *rqstp) +static int inline svc_take_page(struct svc_rqst *rqstp) { if (rqstp->rq_arghi <= rqstp->rq_argused) return -ENOMEM; @@ -180,6 +181,27 @@ static int inline take_page(struct svc_rqst *rqstp) return 0; } +static void inline svc_pushback_allpages(struct svc_rqst *rqstp) +{ + while (rqstp->rq_resused) { + if (rqstp->rq_respages[--rqstp->rq_resused] == NULL) + continue; + rqstp->rq_argpages[rqstp->rq_arghi++] = + rqstp->rq_respages[rqstp->rq_resused]; + rqstp->rq_respages[rqstp->rq_resused] = NULL; + } +} + +static void inline svc_free_allpages(struct svc_rqst *rqstp) +{ + while (rqstp->rq_resused) { + if (rqstp->rq_respages[--rqstp->rq_resused] == NULL) + continue; + put_page(rqstp->rq_respages[rqstp->rq_resused]); + rqstp->rq_respages[rqstp->rq_resused] = NULL; + } +} + struct svc_deferred_req { struct svc_serv *serv; u32 prot; /* protocol (UDP or TCP) */ diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 2f90342e4c76..61f37d10b47d 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -37,6 +37,7 @@ struct svc_sock { struct list_head sk_deferred; /* deferred requests that need to * be revisted */ + struct semaphore sk_sem; /* to serialize sending data */ int (*sk_recvfrom)(struct svc_rqst *rqstp); int (*sk_sendto)(struct svc_rqst *rqstp); |
