Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd/sunrpc: abstract out svc_set_num_threads to sv_ops

Add an operation that will do setup of the service. In the case of a
classic thread-based service that means starting up threads. In the case
of a workqueue-based service, the setup will do something different.

Signed-off-by: Shirley Ma <shirley.ma@oracle.com>
Acked-by: Jeff Layton <jlayton@primarydata.com>
Tested-by: Shirley Ma <shirliey.ma@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Jeff Layton and committed by
J. Bruce Fields
598e2359 b9e13cdf

+8 -3
+5 -3
fs/nfsd/nfssvc.c
··· 395 395 .svo_shutdown = nfsd_last_thread, 396 396 .svo_function = nfsd, 397 397 .svo_enqueue_xprt = svc_xprt_do_enqueue, 398 + .svo_setup = svc_set_num_threads, 398 399 .svo_module = THIS_MODULE, 399 400 }; 400 401 ··· 508 507 /* apply the new numbers */ 509 508 svc_get(nn->nfsd_serv); 510 509 for (i = 0; i < n; i++) { 511 - err = svc_set_num_threads(nn->nfsd_serv, &nn->nfsd_serv->sv_pools[i], 512 - nthreads[i]); 510 + err = nn->nfsd_serv->sv_ops->svo_setup(nn->nfsd_serv, 511 + &nn->nfsd_serv->sv_pools[i], nthreads[i]); 513 512 if (err) 514 513 break; 515 514 } ··· 548 547 error = nfsd_startup_net(nrservs, net); 549 548 if (error) 550 549 goto out_destroy; 551 - error = svc_set_num_threads(nn->nfsd_serv, NULL, nrservs); 550 + error = nn->nfsd_serv->sv_ops->svo_setup(nn->nfsd_serv, 551 + NULL, nrservs); 552 552 if (error) 553 553 goto out_shutdown; 554 554 /* We are holding a reference to nn->nfsd_serv which
+3
include/linux/sunrpc/svc.h
··· 61 61 /* queue up a transport for servicing */ 62 62 void (*svo_enqueue_xprt)(struct svc_xprt *); 63 63 64 + /* set up thread (or whatever) execution context */ 65 + int (*svo_setup)(struct svc_serv *, struct svc_pool *, int); 66 + 64 67 /* optional module to count when adding threads (pooled svcs only) */ 65 68 struct module *svo_module; 66 69 };