Skip to content

Commit

Permalink
nfsd/sunrpc: move sv_function into sv_ops
Browse files Browse the repository at this point in the history
Since we now have a container for holding svc_serv operations, move the
sv_function into it as well.

Signed-off-by: Shirley Ma <[email protected]>
Acked-by: Jeff Layton <[email protected]>
Tested-by: Shirley Ma <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
  • Loading branch information
Jeff Layton authored and J. Bruce Fields committed Aug 10, 2015
1 parent ea126e7 commit c369014
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
3 changes: 2 additions & 1 deletion fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ static int nfsd_get_default_max_blksize(void)

static struct svc_serv_ops nfsd_sv_ops = {
.svo_shutdown = nfsd_last_thread,
.svo_function = nfsd,
};

int nfsd_create_serv(struct net *net)
Expand All @@ -409,7 +410,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, THIS_MODULE);
&nfsd_sv_ops, THIS_MODULE);
if (nn->nfsd_serv == NULL)
return -ENOMEM;

Expand Down
11 changes: 3 additions & 8 deletions include/linux/sunrpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
#include <linux/wait.h>
#include <linux/mm.h>

/*
* This is the RPC server thread function prototype
*/
typedef int (*svc_thread_fn)(void *);

/* statistics for svc_pool structures */
struct svc_pool_stats {
atomic_long_t packets;
Expand Down Expand Up @@ -58,7 +53,8 @@ struct svc_serv;

struct svc_serv_ops {
/* Callback to use when last thread exits. */
void (*svo_shutdown)(struct svc_serv *serv, struct net *net);
void (*svo_shutdown)(struct svc_serv *, struct net *);
int (*svo_function)(void *);
};

/*
Expand Down Expand Up @@ -95,7 +91,6 @@ struct svc_serv {
struct svc_serv_ops *sv_ops; /* server operations */
struct module * sv_module; /* optional module to count when
* adding threads */
svc_thread_fn sv_function; /* main function for threads */
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
struct list_head sv_cb_list; /* queue for callback requests
* that arrive over the same
Expand Down Expand Up @@ -435,7 +430,7 @@ struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
struct svc_pool *pool, int node);
void svc_exit_thread(struct svc_rqst *);
struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
struct svc_serv_ops *, svc_thread_fn, struct module *);
struct svc_serv_ops *, struct module *);
int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
void svc_destroy(struct svc_serv *);
Expand Down
8 changes: 3 additions & 5 deletions net/sunrpc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

static void svc_unregister(const struct svc_serv *serv, struct net *net);

#define svc_serv_is_pooled(serv) ((serv)->sv_function)
#define svc_serv_is_pooled(serv) ((serv)->sv_ops->svo_function)

/*
* Mode for mapping cpus to pools.
Expand Down Expand Up @@ -494,8 +494,7 @@ EXPORT_SYMBOL_GPL(svc_create);

struct svc_serv *
svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
struct svc_serv_ops *ops, svc_thread_fn func,
struct module *mod)
struct svc_serv_ops *ops, struct module *mod)
{
struct svc_serv *serv;
unsigned int npools = svc_pool_map_get();
Expand All @@ -504,7 +503,6 @@ svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
if (!serv)
goto out_err;

serv->sv_function = func;
serv->sv_module = mod;
return serv;
out_err:
Expand Down Expand Up @@ -740,7 +738,7 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
}

__module_get(serv->sv_module);
task = kthread_create_on_node(serv->sv_function, rqstp,
task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp,
node, "%s", serv->sv_name);
if (IS_ERR(task)) {
error = PTR_ERR(task);
Expand Down

0 comments on commit c369014

Please sign in to comment.