Commit 5138fde0 authored by Trond Myklebust's avatar Trond Myklebust

NFS/SUNRPC: Convert all users of rpc_call_setup()

Replace use of rpc_call_setup() with rpc_init_task(), and in cases where we
need to initialise task->tk_action, with rpc_call_start().
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent bdc7f021
This diff is collapsed.
...@@ -70,24 +70,6 @@ static void nfs_dec_sillycount(struct inode *dir) ...@@ -70,24 +70,6 @@ static void nfs_dec_sillycount(struct inode *dir)
wake_up(&nfsi->waitqueue); wake_up(&nfsi->waitqueue);
} }
/**
* nfs_async_unlink_init - Initialize the RPC info
* task: rpc_task of the sillydelete
*/
static void nfs_async_unlink_init(struct rpc_task *task, void *calldata)
{
struct nfs_unlinkdata *data = calldata;
struct inode *dir = data->dir;
struct rpc_message msg = {
.rpc_argp = &data->args,
.rpc_resp = &data->res,
.rpc_cred = data->cred,
};
NFS_PROTO(dir)->unlink_setup(&msg, dir);
rpc_call_setup(task, &msg, 0);
}
/** /**
* nfs_async_unlink_done - Sillydelete post-processing * nfs_async_unlink_done - Sillydelete post-processing
* @task: rpc_task of the sillydelete * @task: rpc_task of the sillydelete
...@@ -120,14 +102,19 @@ static void nfs_async_unlink_release(void *calldata) ...@@ -120,14 +102,19 @@ static void nfs_async_unlink_release(void *calldata)
} }
static const struct rpc_call_ops nfs_unlink_ops = { static const struct rpc_call_ops nfs_unlink_ops = {
.rpc_call_prepare = nfs_async_unlink_init,
.rpc_call_done = nfs_async_unlink_done, .rpc_call_done = nfs_async_unlink_done,
.rpc_release = nfs_async_unlink_release, .rpc_release = nfs_async_unlink_release,
}; };
static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data)
{ {
struct rpc_message msg = {
.rpc_argp = &data->args,
.rpc_resp = &data->res,
.rpc_cred = data->cred,
};
struct rpc_task_setup task_setup_data = { struct rpc_task_setup task_setup_data = {
.rpc_message = &msg,
.callback_ops = &nfs_unlink_ops, .callback_ops = &nfs_unlink_ops,
.callback_data = data, .callback_data = data,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
...@@ -165,8 +152,9 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n ...@@ -165,8 +152,9 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
data->args.fh = NFS_FH(dir); data->args.fh = NFS_FH(dir);
nfs_fattr_init(&data->res.dir_attr); nfs_fattr_init(&data->res.dir_attr);
task_setup_data.rpc_client = NFS_CLIENT(dir); NFS_PROTO(dir)->unlink_setup(&msg, dir);
task_setup_data.rpc_client = NFS_CLIENT(dir);
task = rpc_run_task(&task_setup_data); task = rpc_run_task(&task_setup_data);
if (!IS_ERR(task)) if (!IS_ERR(task))
rpc_put_task(task); rpc_put_task(task);
......
...@@ -128,19 +128,6 @@ struct rpcb_info { ...@@ -128,19 +128,6 @@ struct rpcb_info {
static struct rpcb_info rpcb_next_version[]; static struct rpcb_info rpcb_next_version[];
static struct rpcb_info rpcb_next_version6[]; static struct rpcb_info rpcb_next_version6[];
static void rpcb_getport_prepare(struct rpc_task *task, void *calldata)
{
struct rpcbind_args *map = calldata;
struct rpc_xprt *xprt = map->r_xprt;
struct rpc_message msg = {
.rpc_proc = rpcb_next_version[xprt->bind_index].rpc_proc,
.rpc_argp = map,
.rpc_resp = &map->r_port,
};
rpc_call_setup(task, &msg, 0);
}
static void rpcb_map_release(void *data) static void rpcb_map_release(void *data)
{ {
struct rpcbind_args *map = data; struct rpcbind_args *map = data;
...@@ -150,7 +137,6 @@ static void rpcb_map_release(void *data) ...@@ -150,7 +137,6 @@ static void rpcb_map_release(void *data)
} }
static const struct rpc_call_ops rpcb_getport_ops = { static const struct rpc_call_ops rpcb_getport_ops = {
.rpc_call_prepare = rpcb_getport_prepare,
.rpc_call_done = rpcb_getport_done, .rpc_call_done = rpcb_getport_done,
.rpc_release = rpcb_map_release, .rpc_release = rpcb_map_release,
}; };
...@@ -295,6 +281,24 @@ int rpcb_getport_sync(struct sockaddr_in *sin, __u32 prog, ...@@ -295,6 +281,24 @@ int rpcb_getport_sync(struct sockaddr_in *sin, __u32 prog,
} }
EXPORT_SYMBOL_GPL(rpcb_getport_sync); EXPORT_SYMBOL_GPL(rpcb_getport_sync);
static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, int version)
{
struct rpc_message msg = {
.rpc_proc = rpcb_next_version[version].rpc_proc,
.rpc_argp = map,
.rpc_resp = &map->r_port,
};
struct rpc_task_setup task_setup_data = {
.rpc_client = rpcb_clnt,
.rpc_message = &msg,
.callback_ops = &rpcb_getport_ops,
.callback_data = map,
.flags = RPC_TASK_ASYNC,
};
return rpc_run_task(&task_setup_data);
}
/** /**
* rpcb_getport_async - obtain the port for a given RPC service on a given host * rpcb_getport_async - obtain the port for a given RPC service on a given host
* @task: task that is waiting for portmapper request * @task: task that is waiting for portmapper request
...@@ -310,10 +314,6 @@ void rpcb_getport_async(struct rpc_task *task) ...@@ -310,10 +314,6 @@ void rpcb_getport_async(struct rpc_task *task)
struct rpc_clnt *rpcb_clnt; struct rpc_clnt *rpcb_clnt;
static struct rpcbind_args *map; static struct rpcbind_args *map;
struct rpc_task *child; struct rpc_task *child;
struct rpc_task_setup task_setup_data = {
.callback_ops = &rpcb_getport_ops,
.flags = RPC_TASK_ASYNC,
};
struct sockaddr addr; struct sockaddr addr;
int status; int status;
struct rpcb_info *info; struct rpcb_info *info;
...@@ -399,9 +399,7 @@ void rpcb_getport_async(struct rpc_task *task) ...@@ -399,9 +399,7 @@ void rpcb_getport_async(struct rpc_task *task)
sizeof(map->r_addr)); sizeof(map->r_addr));
map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */
task_setup_data.rpc_client = rpcb_clnt; child = rpcb_call_async(rpcb_clnt, map, xprt->bind_index);
task_setup_data.callback_data = map;
child = rpc_run_task(&task_setup_data);
rpc_release_client(rpcb_clnt); rpc_release_client(rpcb_clnt);
if (IS_ERR(child)) { if (IS_ERR(child)) {
status = -EIO; status = -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment