afs: Provide a function to get a ref on a call
authorDavid Howells <dhowells@redhat.com>
Thu, 10 Jan 2019 15:14:29 +0000 (15:14 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 17 Jan 2019 15:17:28 +0000 (15:17 +0000)
Provide a function to get a reference on an afs_call struct.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/rxrpc.c

index a7b44863d502e95cbb28a1f7ed2f2a17d7ba1043..4830e0a6bf1d1ebdf7f036ac13b7de16e96dea43 100644 (file)
@@ -203,20 +203,26 @@ void afs_put_call(struct afs_call *call)
        }
 }
 
+static struct afs_call *afs_get_call(struct afs_call *call,
+                                    enum afs_call_trace why)
+{
+       int u = atomic_inc_return(&call->usage);
+
+       trace_afs_call(call, why, u,
+                      atomic_read(&call->net->nr_outstanding_calls),
+                      __builtin_return_address(0));
+       return call;
+}
+
 /*
  * Queue the call for actual work.
  */
 static void afs_queue_call_work(struct afs_call *call)
 {
        if (call->type->work) {
-               int u = atomic_inc_return(&call->usage);
-
-               trace_afs_call(call, afs_call_trace_work, u,
-                              atomic_read(&call->net->nr_outstanding_calls),
-                              __builtin_return_address(0));
-
                INIT_WORK(&call->work, call->type->work);
 
+               afs_get_call(call, afs_call_trace_work);
                if (!queue_work(afs_wq, &call->work))
                        afs_put_call(call);
        }