From: Tom Tucker <tom@opengridcomputing.com>
To: Greg Banks <gnb@sgi.com>
Cc: Linux NFS Mailing List <nfs@lists.sourceforge.net>,
"Talpey, Thomas" <Thomas.Talpey@netapp.com>,
Peter Leckie <pleckie@melbourne.sgi.com>
Subject: Re: [RFC,PATCH 3/14] knfsd: prepare reply per transport
Date: Wed, 16 May 2007 16:35:07 -0500 [thread overview]
Message-ID: <C270E33B.3042D%tom@opengridcomputing.com> (raw)
In-Reply-To: <20070516192047.GI9626@sgi.com>
Greg:
I like this patch organization. I'll replicate this in the integrated
tree...
See comment below.
On 5/16/07 2:20 PM, "Greg Banks" <gnb@sgi.com> wrote:
>
> Move the code at the beginning of svc_process() that sets up
> page buffers for the reply, into a new sko_prepape_reply
> method in svc_sock_ops.
>
> Signed-off-by: Greg Banks <gnb@melbourne.sgi.com>
> Signed-off-by: Peter Leckie <pleckie@melbourne.sgi.com>
> ---
>
> include/linux/sunrpc/svcsock.h | 6 +++
> net/sunrpc/svc.c | 22 ++------------
> net/sunrpc/svcsock.c | 46 ++++++++++++++++++++++++++++--
> 3 files changed, 54 insertions(+), 20 deletions(-)
>
> Index: linux/net/sunrpc/svcsock.c
> ===================================================================
> --- linux.orig/net/sunrpc/svcsock.c 2007-05-17 00:16:39.911496313 +1000
> +++ linux/net/sunrpc/svcsock.c 2007-05-17 00:36:20.381217499 +1000
> @@ -880,12 +880,37 @@ svc_udp_sendto(struct svc_rqst *rqstp)
> return error;
> }
>
> +/*
> + * Setup response xdr_buf. Initially it has just one page.
> + */
> +static int
> +svc_tcpip_prepare_reply(struct svc_rqst *rqstp)
> +{
> + struct kvec *resv = &rqstp->rq_res.head[0];
> +
> + rqstp->rq_resused = 1;
> + resv->iov_base = page_address(rqstp->rq_respages[0]);
> + resv->iov_len = 0;
> + rqstp->rq_res.pages = rqstp->rq_respages + 1;
> + rqstp->rq_res.len = 0;
> + rqstp->rq_res.page_base = 0;
> + rqstp->rq_res.page_len = 0;
> + rqstp->rq_res.buflen = PAGE_SIZE;
> + rqstp->rq_res.tail[0].iov_base = NULL;
> + rqstp->rq_res.tail[0].iov_len = 0;
> + /* Will be turned off only in gss privacy case: */
> + rqstp->rq_sendfile_ok = 1;
I think this belongs in the svc_process logic. It doesn't have anything to
do with the buffer, but rather whether or not GSS is turned on.
> +
> + return 0;
> +}
> +
> static const struct svc_sock_ops svc_udp_ops = {
> .sko_name = "udp",
> .sko_recvfrom = svc_udp_recvfrom,
> .sko_sendto = svc_udp_sendto,
> .sko_detach = svc_tcpip_detach,
> - .sko_free = svc_tcpip_free
> + .sko_free = svc_tcpip_free,
> + .sko_prepare_reply = svc_tcpip_prepare_reply
> };
>
> static void
> @@ -1324,12 +1349,29 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
> return sent;
> }
>
> +/*
> + * Setup response xdr_buf. Initially it has just one page.
> + */
> +static int
> +svc_tcp_prepare_reply(struct svc_rqst *rqstp)
> +{
> + struct kvec *resv = &rqstp->rq_res.head[0];
> +
> + svc_tcpip_prepare_reply(rqstp);
> +
> + /* tcp needs a space for the record length... */
> + svc_putnl(resv, 0);
> +
> + return 0;
> +}
> +
> static const struct svc_sock_ops svc_tcp_ops = {
> .sko_name = "tcp",
> .sko_recvfrom = svc_tcp_recvfrom,
> .sko_sendto = svc_tcp_sendto,
> .sko_detach = svc_tcpip_detach,
> - .sko_free = svc_tcpip_free
> + .sko_free = svc_tcpip_free,
> + .sko_prepare_reply = svc_tcp_prepare_reply
> };
>
> static void
> Index: linux/include/linux/sunrpc/svcsock.h
> ===================================================================
> --- linux.orig/include/linux/sunrpc/svcsock.h 2007-05-17 00:12:50.074342601
> +1000
> +++ linux/include/linux/sunrpc/svcsock.h 2007-05-17 00:36:20.553194321 +1000
> @@ -27,6 +27,12 @@ struct svc_sock_ops {
> * destruction of a svc_sock.
> */
> void (*sko_free)(struct svc_sock *);
> + /*
> + * Perform any transport-specific work necessary to setup
> + * the reply buffer before the reply is encoded. May
> + * fail, e.g. due to memory allocation.
> + */
> + int (*sko_prepare_reply)(struct svc_rqst *);
> };
>
> /*
> Index: linux/net/sunrpc/svc.c
> ===================================================================
> --- linux.orig/net/sunrpc/svc.c 2007-04-26 13:08:32.000000000 +1000
> +++ linux/net/sunrpc/svc.c 2007-05-17 00:36:20.557193782 +1000
> @@ -800,24 +800,10 @@ svc_process(struct svc_rqst *rqstp)
> if (argv->iov_len < 6*4)
> goto err_short_len;
>
> - /* setup response xdr_buf.
> - * Initially it has just one page
> - */
> - rqstp->rq_resused = 1;
> - resv->iov_base = page_address(rqstp->rq_respages[0]);
> - resv->iov_len = 0;
> - rqstp->rq_res.pages = rqstp->rq_respages + 1;
> - rqstp->rq_res.len = 0;
> - rqstp->rq_res.page_base = 0;
> - rqstp->rq_res.page_len = 0;
> - rqstp->rq_res.buflen = PAGE_SIZE;
> - rqstp->rq_res.tail[0].iov_base = NULL;
> - rqstp->rq_res.tail[0].iov_len = 0;
> - /* Will be turned off only in gss privacy case: */
> - rqstp->rq_sendfile_ok = 1;
> - /* tcp needs a space for the record length... */
> - if (rqstp->rq_prot == IPPROTO_TCP)
> - svc_putnl(resv, 0);
> + /* setup response xdr_buf. */
> + if (rqstp->rq_sock->sk_ops->sko_prepare_reply &&
> + rqstp->rq_sock->sk_ops->sko_prepare_reply(rqstp))
> + goto dropit;
>
> rqstp->rq_xid = svc_getu32(argv);
> svc_putu32(resv, rqstp->rq_xid);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2007-05-16 21:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-16 19:20 [RFC,PATCH 3/14] knfsd: prepare reply per transport Greg Banks
2007-05-16 20:53 ` J. Bruce Fields
2007-05-17 7:01 ` Greg Banks
2007-05-16 21:35 ` Tom Tucker [this message]
2007-05-17 7:53 ` Greg Banks
2007-05-17 9:16 ` Iyer, Rahul
2007-05-17 15:26 ` Tom Tucker
2007-05-18 3:16 ` Greg Banks
2007-05-18 4:01 ` J. Bruce Fields
2007-05-18 4:08 ` J. Bruce Fields
2007-05-18 14:42 ` Trond Myklebust
2007-05-17 10:48 ` Neil Brown
2007-05-18 6:00 ` Greg Banks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C270E33B.3042D%tom@opengridcomputing.com \
--to=tom@opengridcomputing.com \
--cc=Thomas.Talpey@netapp.com \
--cc=gnb@sgi.com \
--cc=nfs@lists.sourceforge.net \
--cc=pleckie@melbourne.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.