Commit 227f98d9 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: preallocate nfs4_rpc_args

Instead of allocating this small structure, just include it in the
delegation.

The nfsd4_callback structure isn't really necessary yet, but we plan to
add to it all the information necessary to perform a callback.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 788e69e5
...@@ -78,11 +78,6 @@ enum nfs_cb_opnum4 { ...@@ -78,11 +78,6 @@ enum nfs_cb_opnum4 {
cb_sequence_dec_sz + \ cb_sequence_dec_sz + \
op_dec_sz) op_dec_sz)
struct nfs4_rpc_args {
void *args_op;
struct nfsd4_cb_sequence args_seq;
};
/* /*
* Generic encode routines from fs/nfs/nfs4xdr.c * Generic encode routines from fs/nfs/nfs4xdr.c
*/ */
...@@ -676,7 +671,7 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) ...@@ -676,7 +671,7 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
break; break;
default: default:
/* success, or error we can't handle */ /* success, or error we can't handle */
goto done; return;
} }
if (dp->dl_retries--) { if (dp->dl_retries--) {
rpc_delay(task, 2*HZ); rpc_delay(task, 2*HZ);
...@@ -687,8 +682,6 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) ...@@ -687,8 +682,6 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
atomic_set(&clp->cl_cb_conn.cb_set, 0); atomic_set(&clp->cl_cb_conn.cb_set, 0);
warn_no_callback_path(clp, task->tk_status); warn_no_callback_path(clp, task->tk_status);
} }
done:
kfree(task->tk_msg.rpc_argp);
} }
static void nfsd4_cb_recall_release(void *calldata) static void nfsd4_cb_recall_release(void *calldata)
...@@ -714,24 +707,19 @@ nfsd4_cb_recall(struct nfs4_delegation *dp) ...@@ -714,24 +707,19 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
{ {
struct nfs4_client *clp = dp->dl_client; struct nfs4_client *clp = dp->dl_client;
struct rpc_clnt *clnt = clp->cl_cb_conn.cb_client; struct rpc_clnt *clnt = clp->cl_cb_conn.cb_client;
struct nfs4_rpc_args *args; struct nfs4_rpc_args *args = &dp->dl_recall.cb_args;
struct rpc_message msg = { struct rpc_message msg = {
.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL],
.rpc_cred = callback_cred .rpc_cred = callback_cred
}; };
int status = -ENOMEM; int status;
args = kzalloc(sizeof(*args), GFP_KERNEL);
if (!args)
goto out;
args->args_op = dp; args->args_op = dp;
msg.rpc_argp = args; msg.rpc_argp = args;
dp->dl_retries = 1; dp->dl_retries = 1;
status = rpc_call_async(clnt, &msg, RPC_TASK_SOFT, status = rpc_call_async(clnt, &msg, RPC_TASK_SOFT,
&nfsd4_cb_recall_ops, dp); &nfsd4_cb_recall_ops, dp);
out:
if (status) { if (status) {
kfree(args);
put_nfs4_client(clp); put_nfs4_client(clp);
nfs4_put_delegation(dp); nfs4_put_delegation(dp);
} }
......
...@@ -70,6 +70,15 @@ struct nfsd4_cb_sequence { ...@@ -70,6 +70,15 @@ struct nfsd4_cb_sequence {
struct nfs4_client *cbs_clp; struct nfs4_client *cbs_clp;
}; };
struct nfs4_rpc_args {
void *args_op;
struct nfsd4_cb_sequence args_seq;
};
struct nfsd4_callback {
struct nfs4_rpc_args cb_args;
};
struct nfs4_delegation { struct nfs4_delegation {
struct list_head dl_perfile; struct list_head dl_perfile;
struct list_head dl_perclnt; struct list_head dl_perclnt;
...@@ -86,6 +95,7 @@ struct nfs4_delegation { ...@@ -86,6 +95,7 @@ struct nfs4_delegation {
stateid_t dl_stateid; stateid_t dl_stateid;
struct knfsd_fh dl_fh; struct knfsd_fh dl_fh;
int dl_retries; int dl_retries;
struct nfsd4_callback dl_recall;
}; };
/* client delegation callback info */ /* client delegation callback info */
......
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