Skip to content

Commit

Permalink
[PATCH] aio: make wait_queue ->task ->private
Browse files Browse the repository at this point in the history
In the upcoming aio_down patch, it is useful to store a private data
pointer in the kiocb's wait_queue.  Since we provide our own wake up
function and do not require the task_struct pointer, it makes sense to
convert the task pointer into a generic private pointer.

Signed-off-by: Benjamin LaHaise <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
bcrl authored and Linus Torvalds committed Jun 23, 2005
1 parent 63e6880 commit c43dc2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions include/linux/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key
struct __wait_queue {
unsigned int flags;
#define WQ_FLAG_EXCLUSIVE 0x01
struct task_struct * task;
void *private;
wait_queue_func_t func;
struct list_head task_list;
};
Expand All @@ -60,7 +60,7 @@ typedef struct __wait_queue_head wait_queue_head_t;
*/

#define __WAITQUEUE_INITIALIZER(name, tsk) { \
.task = tsk, \
.private = tsk, \
.func = default_wake_function, \
.task_list = { NULL, NULL } }

Expand All @@ -86,15 +86,15 @@ static inline void init_waitqueue_head(wait_queue_head_t *q)
static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
{
q->flags = 0;
q->task = p;
q->private = p;
q->func = default_wake_function;
}

static inline void init_waitqueue_func_entry(wait_queue_t *q,
wait_queue_func_t func)
{
q->flags = 0;
q->task = NULL;
q->private = NULL;
q->func = func;
}

Expand All @@ -110,7 +110,7 @@ static inline int waitqueue_active(wait_queue_head_t *q)
* aio specifies a wait queue entry with an async notification
* callback routine, not associated with any task.
*/
#define is_sync_wait(wait) (!(wait) || ((wait)->task))
#define is_sync_wait(wait) (!(wait) || ((wait)->private))

extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait));
Expand Down Expand Up @@ -384,7 +384,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);

#define DEFINE_WAIT(name) \
wait_queue_t name = { \
.task = current, \
.private = current, \
.func = autoremove_wake_function, \
.task_list = LIST_HEAD_INIT((name).task_list), \
}
Expand All @@ -393,7 +393,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
struct wait_bit_queue name = { \
.key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
.wait = { \
.task = current, \
.private = current, \
.func = wake_bit_function, \
.task_list = \
LIST_HEAD_INIT((name).wait.task_list), \
Expand All @@ -402,7 +402,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);

#define init_wait(wait) \
do { \
(wait)->task = current; \
(wait)->private = current; \
(wait)->func = autoremove_wake_function; \
INIT_LIST_HEAD(&(wait)->task_list); \
} while (0)
Expand Down
2 changes: 1 addition & 1 deletion kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,7 @@ asmlinkage void __sched preempt_schedule_irq(void)

int default_wake_function(wait_queue_t *curr, unsigned mode, int sync, void *key)
{
task_t *p = curr->task;
task_t *p = curr->private;
return try_to_wake_up(p, mode, sync);
}

Expand Down

0 comments on commit c43dc2f

Please sign in to comment.