Linux NFS development
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Subject: Re: [RFC,PATCH 21/38] svc: Change svc_sock_received to svc_xprt_received and export it
Date: Fri, 30 Nov 2007 17:17:14 -0600	[thread overview]
Message-ID: <1196464634.5432.68.camel@trinity.ogc.int> (raw)
In-Reply-To: <7E88BE3B-F35C-44B1-AE84-E5DE62E4EFA5@oracle.com>


On Fri, 2007-11-30 at 16:33 -0500, Chuck Lever wrote:
> On Nov 29, 2007, at 5:40 PM, Tom Tucker wrote:
> > All fields touched by svc_sock_received are now transport independent.
> > Change it to use svc_xprt directly. This function is called from
> > transport dependent code, so export it.
> >
> > Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
> > ---
> >
> >  include/linux/sunrpc/svc_xprt.h |    2 +-
> >  net/sunrpc/svcsock.c            |   37 +++++++++++++++++ 
> > +-------------------
> >  2 files changed, 19 insertions(+), 20 deletions(-)
> >
> > diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/ 
> > svc_xprt.h
> > index d5ef902..c416d05 100644
> > --- a/include/linux/sunrpc/svc_xprt.h
> > +++ b/include/linux/sunrpc/svc_xprt.h
> > @@ -62,8 +62,8 @@ int	svc_unreg_xprt_class(struct svc_xprt_class *);
> >  void	svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
> >  		      struct svc_serv *);
> >  int	svc_create_xprt(struct svc_serv *, char *, unsigned short, int);
> > +void	svc_xprt_received(struct svc_xprt *);
> >  void	svc_xprt_put(struct svc_xprt *xprt);
> > -
> >  static inline void svc_xprt_get(struct svc_xprt *xprt)
> >  {
> >  	kref_get(&xprt->xpt_ref);
> > diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> > index 5666541..0015839 100644
> > --- a/net/sunrpc/svcsock.c
> > +++ b/net/sunrpc/svcsock.c
> > @@ -347,14 +347,14 @@ svc_sock_dequeue(struct svc_pool *pool)
> >   * Note: XPT_DATA only gets cleared when a read-attempt finds
> >   * no (or insufficient) data.
> >   */
> > -static inline void
> > -svc_sock_received(struct svc_sock *svsk)
> > +void
> > +svc_xprt_received(struct svc_xprt *xprt)
> 
> Style police again.  I notice several of these patches add new  
> functions with the return value split onto a separate line.

The policy I used was if I didn't change the function signature, I left
it like it was. If I copied it to svc_xprt, I fixed the formatting of
the signature to conform. I didn't do that for this one. I'll check for
others.

> 
> >  {
> > -	svsk->sk_xprt.xpt_pool = NULL;
> > -	clear_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags);
> > -	svc_xprt_enqueue(&svsk->sk_xprt);
> > +	xprt->xpt_pool = NULL;
> > +	clear_bit(XPT_BUSY, &xprt->xpt_flags);
> > +	svc_xprt_enqueue(xprt);
> >  }
> > -
> > +EXPORT_SYMBOL_GPL(svc_xprt_received);
> 
> When I submitted the RPC client-side transport switch, Trond  
> suggested we add the EXPORTs later when it was clear why they are  
> needed.  This may be a personal preference of the server maintainer,  
> but I just thought I'd mention the possibility; it seems to make  
> sense here too.

Sure, but we already have a server side provider that helps accelerate
the proving process. The svcrdma module won't build without this being
exported.

> 
> >  /**
> >   * svc_reserve - change the space reserved for the reply to a  
> > request.
> > @@ -783,7 +783,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
> >  				(serv->sv_nrthreads+3) * serv->sv_max_mesg);
> >
> >  	if ((rqstp->rq_deferred = svc_deferred_dequeue(svsk))) {
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  		return svc_deferred_recv(rqstp);
> >  	}
> >
> > @@ -800,7 +800,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
> >  			dprintk("svc: recvfrom returned error %d\n", -err);
> >  			set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
> >  		}
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  		return -EAGAIN;
> >  	}
> >  	rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
> > @@ -815,7 +815,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
> >  	/*
> >  	 * Maybe more packets - kick another thread ASAP.
> >  	 */
> > -	svc_sock_received(svsk);
> > +	svc_xprt_received(&svsk->sk_xprt);
> >
> >  	len  = skb->len - sizeof(struct udphdr);
> >  	rqstp->rq_arg.len = len;
> > @@ -1123,8 +1123,6 @@ static struct svc_xprt *svc_tcp_accept(struct  
> > svc_xprt *xprt)
> >  	}
> >  	memcpy(&newsvsk->sk_local, sin, slen);
> >
> > -	svc_sock_received(newsvsk);
> > -
> 
> I assume it's OK to remove svc_sock_received() here (rather than  
> replacing it with svc_xprt_received()) because you are adding a call  
> to xvs_xprt_received() below in svc_recv().
> 
> I think this is a non-trivial change amongst a whole bunch of trivial  
> ones in this patch.  Thus it would be nicer if we did this in a  
> separate patch so you can document your rationale for this change.   
> (Yeah, I think we went over this in e-mail some time ago, but still...)
> 

Yeah, this is probably a good idea. I toyed with removing
svc_xprt_received from the provider all-together and putting it in the
common logic which would remove 10s of calls to svc_xprt_received and
avoid potential races caused by calling it without the BUSY bit held.
The reason I didn't do it was because it means that the xpo_receive
function must complete before queuing the transport back for more I/O,
and this is suboptimal from an MP perspective since some transports can
release the transport early (e.g. RDMA) while it parses the transport
header and does other business.

> >  	if (serv->sv_stats)
> >  		serv->sv_stats->nettcpconn++;
> >
> > @@ -1153,7 +1151,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
> >  		test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags));
> >
> >  	if ((rqstp->rq_deferred = svc_deferred_dequeue(svsk))) {
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  		return svc_deferred_recv(rqstp);
> >  	}
> >
> > @@ -1193,7 +1191,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
> >  		if (len < want) {
> >  			dprintk("svc: short recvfrom while reading record length (%d of  
> > %lu)\n",
> >  				len, want);
> > -			svc_sock_received(svsk);
> > +			svc_xprt_received(&svsk->sk_xprt);
> >  			return -EAGAIN; /* record header not complete */
> >  		}
> >
> > @@ -1229,7 +1227,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
> >  	if (len < svsk->sk_reclen) {
> >  		dprintk("svc: incomplete TCP record (%d of %d)\n",
> >  			len, svsk->sk_reclen);
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  		return -EAGAIN;	/* record not complete */
> >  	}
> >  	len = svsk->sk_reclen;
> > @@ -1269,7 +1267,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
> >  	svsk->sk_reclen = 0;
> >  	svsk->sk_tcplen = 0;
> >
> > -	svc_sock_received(svsk);
> > +	svc_xprt_received(&svsk->sk_xprt);
> >  	if (serv->sv_stats)
> >  		serv->sv_stats->nettcpcnt++;
> >
> > @@ -1282,7 +1280,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
> >   error:
> >  	if (len == -EAGAIN) {
> >  		dprintk("RPC: TCP recvfrom got EAGAIN\n");
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  	} else {
> >  		printk(KERN_NOTICE "%s: recvfrom returned errno %d\n",
> >  		       svsk->sk_xprt.xpt_server->sv_name, -len);
> > @@ -1607,8 +1605,9 @@ svc_recv(struct svc_rqst *rqstp, long timeout)
> >  			 */
> >  			__module_get(newxpt->xpt_class->xcl_owner);
> >  			svc_check_conn_limits(svsk->sk_xprt.xpt_server);
> > +			svc_xprt_received(newxpt);
> >  		}
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  	} else {
> >  		dprintk("svc: server %p, pool %u, socket %p, inuse=%d\n",
> >  			rqstp, pool->sp_id, svsk,
> > @@ -1827,7 +1826,7 @@ int svc_addsock(struct svc_serv *serv,
> >  	else {
> >  		svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS);
> >  		if (svsk) {
> > -			svc_sock_received(svsk);
> > +			svc_xprt_received(&svsk->sk_xprt);
> >  			err = 0;
> >  		}
> >  	}
> > @@ -1882,7 +1881,7 @@ svc_create_socket(struct svc_serv *serv, int  
> > protocol,
> >  	}
> >
> >  	if ((svsk = svc_setup_socket(serv, sock, &error, flags)) != NULL) {
> > -		svc_sock_received(svsk);
> > +		svc_xprt_received(&svsk->sk_xprt);
> >  		return (struct svc_xprt *)svsk;
> >  	}
> >
> 
> --
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
> -
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2007-11-30 23:13 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 22:39 [RFC,PATCH 00/38] SVC Transport Switch Tom Tucker
     [not found] ` <20071129223917.14563.77633.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-29 22:39   ` [RFC,PATCH 01/38] svc: Add an svc transport class Tom Tucker
2007-11-29 22:39   ` [RFC,PATCH 02/38] svc: Make svc_sock the tcp/udp transport Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 03/38] svc: Change the svc_sock in the rqstp structure to a transport Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 04/38] svc: Add a max payload value to the transport Tom Tucker
     [not found]     ` <20071129224002.14563.96227.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-30 20:22       ` Chuck Lever
2007-11-30 20:51         ` Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 05/38] svc: Move sk_sendto and sk_recvfrom to svc_xprt_class Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 06/38] svc: Add transport specific xpo_release function Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 07/38] svc: Add per-transport delete functions Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 08/38] svc: Add xpo_prep_reply_hdr Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 09/38] svc: Add a transport function that checks for write space Tom Tucker
     [not found]     ` <20071129224012.14563.23130.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-30 20:46       ` Chuck Lever
2007-11-30 21:39         ` Tom Tucker
     [not found]           ` <1196458764.5432.52.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-11-30 22:43             ` Chuck Lever
2007-12-10 20:43               ` Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 10/38] svc: Move close processing to a single place Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 11/38] svc: Add xpo_accept transport function Tom Tucker
     [not found]     ` <20071129224016.14563.67547.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-30 21:01       ` Chuck Lever
2007-11-30 21:47         ` Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 12/38] svc: Add a generic transport svc_create_xprt function Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 13/38] svc: Change services to use new svc_create_xprt service Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 14/38] svc: Change sk_inuse to a kref Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 15/38] svc: Move sk_flags to the svc_xprt structure Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 16/38] svc: Move sk_server and sk_pool to svc_xprt Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 17/38] svc: Make close transport independent Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 18/38] svc: Move sk_reserved to svc_xprt Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 19/38] svc: Make the enqueue service transport neutral and export it Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 20/38] svc: Make svc_send transport neutral Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 21/38] svc: Change svc_sock_received to svc_xprt_received and export it Tom Tucker
     [not found]     ` <20071129224037.14563.69171.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-30 21:33       ` Chuck Lever
2007-11-30 23:17         ` Tom Tucker [this message]
     [not found]           ` <1196464634.5432.68.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-11-30 23:23             ` Chuck Lever
2007-11-29 22:40   ` [RFC,PATCH 22/38] svc: Remove sk_lastrecv Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 24/38] svc: Make deferral processing xprt independent Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 25/38] svc: Move the sockaddr information to svc_xprt Tom Tucker
     [not found]     ` <20071129224046.14563.59353.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-30 23:20       ` Chuck Lever
2007-11-29 22:40   ` [RFC,PATCH 26/38] svc: Make svc_sock_release svc_xprt_release Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 27/38] svc: Make svc_recv transport neutral Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 28/38] svc: Make svc_age_temp_sockets svc_age_temp_transports Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 29/38] svc: Move common create logic to common code Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 30/38] svc: Removing remaining references to rq_sock in rqstp Tom Tucker
2007-11-29 22:40   ` [RFC,PATCH 31/38] svc: Make svc_check_conn_limits xprt independent Tom Tucker
2007-11-29 22:41   ` [RFC,PATCH 32/38] svc: Move the xprt independent code to the svc_xprt.c file Tom Tucker
2007-11-29 22:41   ` [RFC,PATCH 33/38] svc: Add transport hdr size for defer/revisit Tom Tucker
     [not found]     ` <20071129224103.14563.72780.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-30 23:51       ` Chuck Lever
2007-11-29 22:41   ` [RFC,PATCH 34/38] svc: Add /proc/sys/sunrpc/transport files Tom Tucker
     [not found]     ` <20071129224105.14563.48684.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-03 16:44       ` Chuck Lever
2007-12-03 16:58         ` J. Bruce Fields
2007-12-03 18:30           ` Chuck Lever
2007-12-03 19:10             ` Tom Tucker
     [not found]               ` <1196709058.5811.21.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-12-03 20:36                 ` Chuck Lever
2007-12-04  0:45                   ` Tom Tucker
2007-12-05  8:44           ` Greg Banks
2007-11-29 22:41   ` [RFC,PATCH 35/38] knfsd: Support adding transports by writing portlist file Tom Tucker
2007-11-29 22:41   ` [RFC,PATCH 36/38] svc: Add svc API that queries for a transport instance Tom Tucker
     [not found]     ` <20071129224109.14563.34563.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-01  0:00       ` Chuck Lever
2007-11-29 22:41   ` [RFC,PATCH 37/38] knfsd: Modify write_ports to use svc_find_xprt service Tom Tucker
2007-11-29 22:41   ` [RFC,PATCH 38/38] svc: Add svc_xprt_names service to replace svc_sock_names Tom Tucker
2007-11-29 23:18   ` [RFC,PATCH 00/38] SVC Transport Switch Tom Tucker
  -- strict thread matches above, loose matches on Subject: below --
2007-11-29 22:51 Tom Tucker
     [not found] ` <20071129225142.15107.46200.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-29 22:54   ` [RFC,PATCH 21/38] svc: Change svc_sock_received to svc_xprt_received and export it Tom Tucker
2007-11-29 22:55 [RFC,PATCH 00/38] RPC Transport Switch Tom Tucker
     [not found] ` <20071129225510.15275.82660.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-29 22:56   ` [RFC,PATCH 21/38] svc: Change svc_sock_received to svc_xprt_received and export it Tom Tucker

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=1196464634.5432.68.camel@trinity.ogc.int \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox