Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@primarydata.com>
To: bfields@fieldses.org
Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
	Tejun Heo <tj@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
	NeilBrown <neilb@suse.de>
Subject: [PATCH v2 09/16] sunrpc: set up svc_rqst work if it's defined
Date: Wed, 10 Dec 2014 14:07:53 -0500	[thread overview]
Message-ID: <1418238480-18857-10-git-send-email-jlayton@primarydata.com> (raw)
In-Reply-To: <1418238480-18857-1-git-send-email-jlayton@primarydata.com>

We want to queue most of the work in the context of the svc_rqst. Add a
work_struct to the svc_rqst and a new operation for svc_rqst_work. If
that's defined then initialize it when setting up the service.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
 include/linux/sunrpc/svc.h | 4 ++++
 net/sunrpc/svc.c           | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 8bd53f723485..70bee4e86a9f 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -61,6 +61,9 @@ struct svc_serv_ops {
 	/* xprt work function */
 	work_func_t	svo_xprt_work;
 
+	/* rqst work function */
+	work_func_t	svo_rqst_work;
+
 	/* queue up a transport for servicing */
 	void		(*svo_enqueue_xprt)(struct svc_xprt *);
 
@@ -293,6 +296,7 @@ struct svc_rqst {
 	struct svc_cacherep *	rq_cacherep;	/* cache info */
 	struct task_struct	*rq_task;	/* service thread */
 	spinlock_t		rq_lock;	/* per-request lock */
+	struct work_struct	rq_work;	/* per-request work */
 };
 
 #define SVC_NET(svc_rqst)	(svc_rqst->rq_xprt->xpt_net)
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 135ffbe9d983..ed243eb80e5b 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -595,6 +595,8 @@ svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
 	spin_lock_init(&rqstp->rq_lock);
 	rqstp->rq_server = serv;
 	rqstp->rq_pool = pool;
+	if (serv->sv_ops->svo_rqst_work)
+		INIT_WORK(&rqstp->rq_work, serv->sv_ops->svo_rqst_work);
 
 	rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node);
 	if (!rqstp->rq_argp)
-- 
2.1.0


  parent reply	other threads:[~2014-12-10 19:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 19:07 [PATCH v2 00/16] nfsd/sunrpc: add support for a workqueue-based nfsd Jeff Layton
2014-12-10 19:07 ` [PATCH v2 01/16] sunrpc: add a new svc_serv_ops struct and move sv_shutdown into it Jeff Layton
2014-12-10 19:07 ` [PATCH v2 02/16] sunrpc: move sv_function into sv_ops Jeff Layton
2014-12-10 19:07 ` [PATCH v2 03/16] sunrpc: move sv_module parm " Jeff Layton
2014-12-10 19:07 ` [PATCH v2 04/16] sunrpc: turn enqueueing a svc_xprt into a svc_serv operation Jeff Layton
2014-12-10 19:07 ` [PATCH v2 05/16] sunrpc: abstract out svc_set_num_threads to sv_ops Jeff Layton
2014-12-10 19:07 ` [PATCH v2 06/16] sunrpc: move pool_mode definitions into svc.h Jeff Layton
2014-12-10 19:07 ` [PATCH v2 07/16] sunrpc: factor svc_rqst allocation and freeing from sv_nrthreads refcounting Jeff Layton
2014-12-10 19:07 ` [PATCH v2 08/16] sunrpc: set up workqueue function in svc_xprt Jeff Layton
2014-12-10 19:07 ` Jeff Layton [this message]
2014-12-10 19:07 ` [PATCH v2 10/16] sunrpc: add basic support for workqueue-based services Jeff Layton
2014-12-10 19:07 ` [PATCH v2 11/16] nfsd: keep a reference to the fs_struct in svc_rqst Jeff Layton
2014-12-10 19:07 ` [PATCH v2 12/16] nfsd: add support for workqueue based service processing Jeff Layton
2014-12-10 19:07 ` [PATCH v2 13/16] sunrpc: keep a cache of svc_rqsts for each NUMA node Jeff Layton
2014-12-10 19:07 ` [PATCH v2 14/16] sunrpc: add more tracepoints around svc_xprt handling Jeff Layton
2014-12-10 19:07 ` [PATCH v2 15/16] sunrpc: print the svc_rqst pointer value in svc_process tracepoint Jeff Layton
2014-12-10 19:08 ` [PATCH v2 16/16] sunrpc: add tracepoints around svc_sock handling Jeff Layton
2014-12-10 22:31 ` [PATCH v2 00/16] nfsd/sunrpc: add support for a workqueue-based nfsd Chuck Lever
2014-12-10 23:13   ` Jeff Layton
2014-12-12  2:12 ` Al Viro
2014-12-12  2:29   ` Linus Torvalds
2014-12-12  3:02     ` Al Viro
2014-12-12  3:06       ` Al Viro
2014-12-12 11:54       ` Jeff Layton
2014-12-12 16:59         ` Al Viro
2014-12-13 14:06           ` Jeff Layton
2014-12-13 17:29             ` Al Viro
2014-12-12  2:52   ` Al Viro

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=1418238480-18857-10-git-send-email-jlayton@primarydata.com \
    --to=jlayton@primarydata.com \
    --cc=bfields@fieldses.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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