diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-05-07 13:34:17 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-14 15:09:32 -0400 |
commit | 9bc4e3ca46e4eb9cb434de4175c6041d00bbdca3 (patch) | |
tree | a1677884fe5779008243a083f7a8455f43990c0a | |
parent | dfe52c0419b8324bacd69bd28aae77e2d6ee0379 (diff) |
NFS: Calldata for nfs4_renew_done()
I'm about to change task->tk_start from a jiffies value to a ktime_t
value in order to make RPC RTT reporting more precise.
Recently (commit dc96aef9) nfs4_renew_done() started to reference
task->tk_start so that a jiffies value no longer had to be passed
from nfs4_proc_async_renew(). This allowed the calldata to point to
an nfs_client instead.
Changing task->tk_start to a ktime_t value makes it effectively
useless for renew timestamps, so we need to restore the pre-dc96aef9
logic that provided a jiffies "start" timestamp to nfs4_renew_done().
Both an nfs_client pointer and a timestamp need to be passed to
nfs4_renew_done(), so create a new nfs_renewdata structure that
contains both, resembling what is already done for delegreturn,
lock, and unlock.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 04f4b2b2506b..9998c2958103 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3163,23 +3163,31 @@ static void nfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_messa | |||
3163 | msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT]; | 3163 | msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT]; |
3164 | } | 3164 | } |
3165 | 3165 | ||
3166 | struct nfs4_renewdata { | ||
3167 | struct nfs_client *client; | ||
3168 | unsigned long timestamp; | ||
3169 | }; | ||
3170 | |||
3166 | /* | 3171 | /* |
3167 | * nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special | 3172 | * nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special |
3168 | * standalone procedure for queueing an asynchronous RENEW. | 3173 | * standalone procedure for queueing an asynchronous RENEW. |
3169 | */ | 3174 | */ |
3170 | static void nfs4_renew_release(void *data) | 3175 | static void nfs4_renew_release(void *calldata) |
3171 | { | 3176 | { |
3172 | struct nfs_client *clp = data; | 3177 | struct nfs4_renewdata *data = calldata; |
3178 | struct nfs_client *clp = data->client; | ||
3173 | 3179 | ||
3174 | if (atomic_read(&clp->cl_count) > 1) | 3180 | if (atomic_read(&clp->cl_count) > 1) |
3175 | nfs4_schedule_state_renewal(clp); | 3181 | nfs4_schedule_state_renewal(clp); |
3176 | nfs_put_client(clp); | 3182 | nfs_put_client(clp); |
3183 | kfree(data); | ||
3177 | } | 3184 | } |
3178 | 3185 | ||
3179 | static void nfs4_renew_done(struct rpc_task *task, void *data) | 3186 | static void nfs4_renew_done(struct rpc_task *task, void *calldata) |
3180 | { | 3187 | { |
3181 | struct nfs_client *clp = data; | 3188 | struct nfs4_renewdata *data = calldata; |
3182 | unsigned long timestamp = task->tk_start; | 3189 | struct nfs_client *clp = data->client; |
3190 | unsigned long timestamp = data->timestamp; | ||
3183 | 3191 | ||
3184 | if (task->tk_status < 0) { | 3192 | if (task->tk_status < 0) { |
3185 | /* Unless we're shutting down, schedule state recovery! */ | 3193 | /* Unless we're shutting down, schedule state recovery! */ |
@@ -3205,11 +3213,17 @@ int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | |||
3205 | .rpc_argp = clp, | 3213 | .rpc_argp = clp, |
3206 | .rpc_cred = cred, | 3214 | .rpc_cred = cred, |
3207 | }; | 3215 | }; |
3216 | struct nfs4_renewdata *data; | ||
3208 | 3217 | ||
3209 | if (!atomic_inc_not_zero(&clp->cl_count)) | 3218 | if (!atomic_inc_not_zero(&clp->cl_count)) |
3210 | return -EIO; | 3219 | return -EIO; |
3220 | data = kmalloc(sizeof(*data), GFP_KERNEL); | ||
3221 | if (data == NULL) | ||
3222 | return -ENOMEM; | ||
3223 | data->client = clp; | ||
3224 | data->timestamp = jiffies; | ||
3211 | return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, | 3225 | return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, |
3212 | &nfs4_renew_ops, clp); | 3226 | &nfs4_renew_ops, data); |
3213 | } | 3227 | } |
3214 | 3228 | ||
3215 | int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) | 3229 | int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) |