nfsd/sunrpc: turn enqueueing a svc_xprt into a svc_serv operation
authorJeff Layton <jlayton@primarydata.com>
Mon, 8 Jun 2015 19:06:51 +0000 (12:06 -0700)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 10 Aug 2015 20:05:42 +0000 (16:05 -0400)
For now, all services use svc_xprt_do_enqueue, but once we add
workqueue-based service support, we'll need to do something different.

Signed-off-by: Shirley Ma <shirley.ma@oracle.com>
Acked-by: Jeff Layton <jlayton@primarydata.com>
Tested-by: Shirley Ma <shirley.ma@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/lockd/svc.c
fs/nfs/callback.c
fs/nfsd/nfssvc.c
include/linux/sunrpc/svc.h
include/linux/sunrpc/svc_xprt.h
net/sunrpc/svc_xprt.c

index 4182b2f925cdcdd744fc5098cef5bb216713a07a..530914b5c455046dcaaf9712bfa94e5cadfeac0b 100644 (file)
@@ -323,7 +323,8 @@ out_rqst:
 }
 
 static struct svc_serv_ops lockd_sv_ops = {
-       .svo_shutdown   = svc_rpcb_cleanup,
+       .svo_shutdown           = svc_rpcb_cleanup,
+       .svo_enqueue_xprt       = svc_xprt_do_enqueue,
 };
 
 static struct svc_serv *lockd_create_svc(void)
index 182792d115fcaa34e91284eba177ad36de3da7c4..2c4a0b565d28e6eba828668a01123d8dce9f05e1 100644 (file)
@@ -309,6 +309,7 @@ err_bind:
 }
 
 static struct svc_serv_ops nfs_cb_sv_ops = {
+       .svo_enqueue_xprt       = svc_xprt_do_enqueue,
 };
 
 static struct svc_serv *nfs_callback_create_svc(int minorversion)
index 17ceaad5f80ae5a348600a4841bb47e8bc1c3c48..d8b9b4cd37c6f4cd42c34fca1840f63d44ec13b7 100644 (file)
@@ -391,10 +391,11 @@ static int nfsd_get_default_max_blksize(void)
        return ret;
 }
 
-static struct svc_serv_ops nfsd_sv_ops = {
-       .svo_shutdown = nfsd_last_thread,
-       .svo_function = nfsd,
-       .svo_module = THIS_MODULE,
+static struct svc_serv_ops nfsd_thread_sv_ops = {
+       .svo_shutdown           = nfsd_last_thread,
+       .svo_function           = nfsd,
+       .svo_enqueue_xprt       = svc_xprt_do_enqueue,
+       .svo_module             = THIS_MODULE,
 };
 
 int nfsd_create_serv(struct net *net)
@@ -411,7 +412,7 @@ int nfsd_create_serv(struct net *net)
                nfsd_max_blksize = nfsd_get_default_max_blksize();
        nfsd_reset_versions();
        nn->nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
-                                               &nfsd_sv_ops);
+                                               &nfsd_thread_sv_ops);
        if (nn->nfsd_serv == NULL)
                return -ENOMEM;
 
index 0150003d584b3561944e391a20e663ba5731f36b..97609d0f68f6e53db1a67aa60744f02c3b5b9c76 100644 (file)
@@ -58,6 +58,9 @@ struct svc_serv_ops {
        /* function for service threads to run */
        int             (*svo_function)(void *);
 
+       /* queue up a transport for servicing */
+       void            (*svo_enqueue_xprt)(struct svc_xprt *);
+
        /* optional module to count when adding threads (pooled svcs only) */
        struct module   *svo_module;
 };
index 79f6f8f3dc0a2af7c8f51c43f086837144d6c34c..78512cfe1fe687f251e111e7d70be56540249a17 100644 (file)
@@ -116,6 +116,7 @@ void        svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
                      struct svc_serv *);
 int    svc_create_xprt(struct svc_serv *, const char *, struct net *,
                        const int, const unsigned short, int);
+void   svc_xprt_do_enqueue(struct svc_xprt *xprt);
 void   svc_xprt_enqueue(struct svc_xprt *xprt);
 void   svc_xprt_put(struct svc_xprt *xprt);
 void   svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
index 163ac45c36394f0ce144235ad09a5a3227be173a..a6cbb2104667d22e6b64ffa34718f8ed1f50ef0e 100644 (file)
@@ -24,7 +24,6 @@ static int svc_deferred_recv(struct svc_rqst *rqstp);
 static struct cache_deferred_req *svc_defer(struct cache_req *req);
 static void svc_age_temp_xprts(unsigned long closure);
 static void svc_delete_xprt(struct svc_xprt *xprt);
-static void svc_xprt_do_enqueue(struct svc_xprt *xprt);
 
 /* apparently the "standard" is that clients close
  * idle connections after 5 minutes, servers after
@@ -225,12 +224,12 @@ static void svc_xprt_received(struct svc_xprt *xprt)
        }
 
        /* As soon as we clear busy, the xprt could be closed and
-        * 'put', so we need a reference to call svc_xprt_do_enqueue with:
+        * 'put', so we need a reference to call svc_enqueue_xprt with:
         */
        svc_xprt_get(xprt);
        smp_mb__before_atomic();
        clear_bit(XPT_BUSY, &xprt->xpt_flags);
-       svc_xprt_do_enqueue(xprt);
+       xprt->xpt_server->sv_ops->svo_enqueue_xprt(xprt);
        svc_xprt_put(xprt);
 }
 
@@ -320,7 +319,7 @@ static bool svc_xprt_has_something_to_do(struct svc_xprt *xprt)
        return false;
 }
 
-static void svc_xprt_do_enqueue(struct svc_xprt *xprt)
+void svc_xprt_do_enqueue(struct svc_xprt *xprt)
 {
        struct svc_pool *pool;
        struct svc_rqst *rqstp = NULL;
@@ -402,6 +401,7 @@ redo_search:
 out:
        trace_svc_xprt_do_enqueue(xprt, rqstp);
 }
+EXPORT_SYMBOL_GPL(svc_xprt_do_enqueue);
 
 /*
  * Queue up a transport with data pending. If there are idle nfsd
@@ -412,7 +412,7 @@ void svc_xprt_enqueue(struct svc_xprt *xprt)
 {
        if (test_bit(XPT_BUSY, &xprt->xpt_flags))
                return;
-       svc_xprt_do_enqueue(xprt);
+       xprt->xpt_server->sv_ops->svo_enqueue_xprt(xprt);
 }
 EXPORT_SYMBOL_GPL(svc_xprt_enqueue);
 
This page took 0.029266 seconds and 5 git commands to generate.