Browse Source

AFS: Pass an afs_call* to call->async_workfn() instead of a work_struct*

call->async_workfn() can take an afs_call* arg rather than a work_struct* as
the functions assigned there are now called from afs_async_workfn() which has
to call container_of() anyway.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Nathaniel Wesley Filardo <nwf@cs.jhu.edu>
Reviewed-by: Tejun Heo <tj@kernel.org>
David Howells 11 years ago
parent
commit
656f88ddf1
2 changed files with 5 additions and 11 deletions
  1. 1 1
      fs/afs/internal.h
  2. 4 10
      fs/afs/rxrpc.c

+ 1 - 1
fs/afs/internal.h

@@ -75,7 +75,7 @@ struct afs_call {
 	const struct afs_call_type *type;	/* type of call */
 	const struct afs_call_type *type;	/* type of call */
 	const struct afs_wait_mode *wait_mode;	/* completion wait mode */
 	const struct afs_wait_mode *wait_mode;	/* completion wait mode */
 	wait_queue_head_t	waitq;		/* processes awaiting completion */
 	wait_queue_head_t	waitq;		/* processes awaiting completion */
-	work_func_t		async_workfn;
+	void (*async_workfn)(struct afs_call *call); /* asynchronous work function */
 	struct work_struct	async_work;	/* asynchronous work processor */
 	struct work_struct	async_work;	/* asynchronous work processor */
 	struct work_struct	work;		/* actual work processor */
 	struct work_struct	work;		/* actual work processor */
 	struct sk_buff_head	rx_queue;	/* received packets */
 	struct sk_buff_head	rx_queue;	/* received packets */

+ 4 - 10
fs/afs/rxrpc.c

@@ -25,7 +25,7 @@ static void afs_wake_up_call_waiter(struct afs_call *);
 static int afs_wait_for_call_to_complete(struct afs_call *);
 static int afs_wait_for_call_to_complete(struct afs_call *);
 static void afs_wake_up_async_call(struct afs_call *);
 static void afs_wake_up_async_call(struct afs_call *);
 static int afs_dont_wait_for_call_to_complete(struct afs_call *);
 static int afs_dont_wait_for_call_to_complete(struct afs_call *);
-static void afs_process_async_call(struct work_struct *);
+static void afs_process_async_call(struct afs_call *);
 static void afs_rx_interceptor(struct sock *, unsigned long, struct sk_buff *);
 static void afs_rx_interceptor(struct sock *, unsigned long, struct sk_buff *);
 static int afs_deliver_cm_op_id(struct afs_call *, struct sk_buff *, bool);
 static int afs_deliver_cm_op_id(struct afs_call *, struct sk_buff *, bool);
 
 
@@ -62,7 +62,7 @@ static void afs_async_workfn(struct work_struct *work)
 {
 {
 	struct afs_call *call = container_of(work, struct afs_call, async_work);
 	struct afs_call *call = container_of(work, struct afs_call, async_work);
 
 
-	call->async_workfn(work);
+	call->async_workfn(call);
 }
 }
 
 
 /*
 /*
@@ -623,11 +623,8 @@ static int afs_dont_wait_for_call_to_complete(struct afs_call *call)
 /*
 /*
  * delete an asynchronous call
  * delete an asynchronous call
  */
  */
-static void afs_delete_async_call(struct work_struct *work)
+static void afs_delete_async_call(struct afs_call *call)
 {
 {
-	struct afs_call *call =
-		container_of(work, struct afs_call, async_work);
-
 	_enter("");
 	_enter("");
 
 
 	afs_free_call(call);
 	afs_free_call(call);
@@ -640,11 +637,8 @@ static void afs_delete_async_call(struct work_struct *work)
  * - on a multiple-thread workqueue this work item may try to run on several
  * - on a multiple-thread workqueue this work item may try to run on several
  *   CPUs at the same time
  *   CPUs at the same time
  */
  */
-static void afs_process_async_call(struct work_struct *work)
+static void afs_process_async_call(struct afs_call *call)
 {
 {
-	struct afs_call *call =
-		container_of(work, struct afs_call, async_work);
-
 	_enter("");
 	_enter("");
 
 
 	if (!skb_queue_empty(&call->rx_queue))
 	if (!skb_queue_empty(&call->rx_queue))