diff options
author | David Howells <dhowells@redhat.com> | 2019-01-10 10:14:29 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-01-17 10:17:28 -0500 |
commit | 7a75b0079a1d54e342c502c3c8107ba97e05d3d3 (patch) | |
tree | c96c56e1c3dcadd60deaf3e4170c2c4b1ca1a020 /fs/afs | |
parent | 59d49076ae3e6912e6d7df2fd68e2337f3d02036 (diff) |
afs: Provide a function to get a ref on a call
Provide a function to get a reference on an afs_call struct.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs')
-rw-r--r-- | fs/afs/rxrpc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index a7b44863d502..4830e0a6bf1d 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -203,20 +203,26 @@ void afs_put_call(struct afs_call *call) | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | static struct afs_call *afs_get_call(struct afs_call *call, | ||
207 | enum afs_call_trace why) | ||
208 | { | ||
209 | int u = atomic_inc_return(&call->usage); | ||
210 | |||
211 | trace_afs_call(call, why, u, | ||
212 | atomic_read(&call->net->nr_outstanding_calls), | ||
213 | __builtin_return_address(0)); | ||
214 | return call; | ||
215 | } | ||
216 | |||
206 | /* | 217 | /* |
207 | * Queue the call for actual work. | 218 | * Queue the call for actual work. |
208 | */ | 219 | */ |
209 | static void afs_queue_call_work(struct afs_call *call) | 220 | static void afs_queue_call_work(struct afs_call *call) |
210 | { | 221 | { |
211 | if (call->type->work) { | 222 | if (call->type->work) { |
212 | int u = atomic_inc_return(&call->usage); | ||
213 | |||
214 | trace_afs_call(call, afs_call_trace_work, u, | ||
215 | atomic_read(&call->net->nr_outstanding_calls), | ||
216 | __builtin_return_address(0)); | ||
217 | |||
218 | INIT_WORK(&call->work, call->type->work); | 223 | INIT_WORK(&call->work, call->type->work); |
219 | 224 | ||
225 | afs_get_call(call, afs_call_trace_work); | ||
220 | if (!queue_work(afs_wq, &call->work)) | 226 | if (!queue_work(afs_wq, &call->work)) |
221 | afs_put_call(call); | 227 | afs_put_call(call); |
222 | } | 228 | } |