diff options
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r-- | fs/eventpoll.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 1b4491cdd115..19ffb043abbc 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * fs/eventpoll.c ( Efficent event polling implementation ) | 2 | * fs/eventpoll.c ( Efficent event polling implementation ) |
3 | * Copyright (C) 2001,...,2003 Davide Libenzi | 3 | * Copyright (C) 2001,...,2006 Davide Libenzi |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -120,7 +120,7 @@ struct epoll_filefd { | |||
120 | */ | 120 | */ |
121 | struct wake_task_node { | 121 | struct wake_task_node { |
122 | struct list_head llink; | 122 | struct list_head llink; |
123 | task_t *task; | 123 | struct task_struct *task; |
124 | wait_queue_head_t *wq; | 124 | wait_queue_head_t *wq; |
125 | }; | 125 | }; |
126 | 126 | ||
@@ -268,9 +268,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, | |||
268 | int maxevents, long timeout); | 268 | int maxevents, long timeout); |
269 | static int eventpollfs_delete_dentry(struct dentry *dentry); | 269 | static int eventpollfs_delete_dentry(struct dentry *dentry); |
270 | static struct inode *ep_eventpoll_inode(void); | 270 | static struct inode *ep_eventpoll_inode(void); |
271 | static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type, | 271 | static int eventpollfs_get_sb(struct file_system_type *fs_type, |
272 | int flags, const char *dev_name, | 272 | int flags, const char *dev_name, |
273 | void *data); | 273 | void *data, struct vfsmount *mnt); |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * This semaphore is used to serialize ep_free() and eventpoll_release_file(). | 276 | * This semaphore is used to serialize ep_free() and eventpoll_release_file(). |
@@ -337,20 +337,20 @@ static inline int ep_cmp_ffd(struct epoll_filefd *p1, | |||
337 | /* Special initialization for the rb-tree node to detect linkage */ | 337 | /* Special initialization for the rb-tree node to detect linkage */ |
338 | static inline void ep_rb_initnode(struct rb_node *n) | 338 | static inline void ep_rb_initnode(struct rb_node *n) |
339 | { | 339 | { |
340 | n->rb_parent = n; | 340 | rb_set_parent(n, n); |
341 | } | 341 | } |
342 | 342 | ||
343 | /* Removes a node from the rb-tree and marks it for a fast is-linked check */ | 343 | /* Removes a node from the rb-tree and marks it for a fast is-linked check */ |
344 | static inline void ep_rb_erase(struct rb_node *n, struct rb_root *r) | 344 | static inline void ep_rb_erase(struct rb_node *n, struct rb_root *r) |
345 | { | 345 | { |
346 | rb_erase(n, r); | 346 | rb_erase(n, r); |
347 | n->rb_parent = n; | 347 | rb_set_parent(n, n); |
348 | } | 348 | } |
349 | 349 | ||
350 | /* Fast check to verify that the item is linked to the main rb-tree */ | 350 | /* Fast check to verify that the item is linked to the main rb-tree */ |
351 | static inline int ep_rb_linked(struct rb_node *n) | 351 | static inline int ep_rb_linked(struct rb_node *n) |
352 | { | 352 | { |
353 | return n->rb_parent != n; | 353 | return rb_parent(n) != n; |
354 | } | 354 | } |
355 | 355 | ||
356 | /* | 356 | /* |
@@ -413,7 +413,7 @@ static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq) | |||
413 | { | 413 | { |
414 | int wake_nests = 0; | 414 | int wake_nests = 0; |
415 | unsigned long flags; | 415 | unsigned long flags; |
416 | task_t *this_task = current; | 416 | struct task_struct *this_task = current; |
417 | struct list_head *lsthead = &psw->wake_task_list, *lnk; | 417 | struct list_head *lsthead = &psw->wake_task_list, *lnk; |
418 | struct wake_task_node *tncur; | 418 | struct wake_task_node *tncur; |
419 | struct wake_task_node tnode; | 419 | struct wake_task_node tnode; |
@@ -1004,7 +1004,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, | |||
1004 | 1004 | ||
1005 | /* Notify waiting tasks that events are available */ | 1005 | /* Notify waiting tasks that events are available */ |
1006 | if (waitqueue_active(&ep->wq)) | 1006 | if (waitqueue_active(&ep->wq)) |
1007 | wake_up(&ep->wq); | 1007 | __wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE); |
1008 | if (waitqueue_active(&ep->poll_wait)) | 1008 | if (waitqueue_active(&ep->poll_wait)) |
1009 | pwake++; | 1009 | pwake++; |
1010 | } | 1010 | } |
@@ -1083,7 +1083,8 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | |||
1083 | 1083 | ||
1084 | /* Notify waiting tasks that events are available */ | 1084 | /* Notify waiting tasks that events are available */ |
1085 | if (waitqueue_active(&ep->wq)) | 1085 | if (waitqueue_active(&ep->wq)) |
1086 | wake_up(&ep->wq); | 1086 | __wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE | |
1087 | TASK_INTERRUPTIBLE); | ||
1087 | if (waitqueue_active(&ep->poll_wait)) | 1088 | if (waitqueue_active(&ep->poll_wait)) |
1088 | pwake++; | 1089 | pwake++; |
1089 | } | 1090 | } |
@@ -1260,7 +1261,8 @@ is_linked: | |||
1260 | * wait list. | 1261 | * wait list. |
1261 | */ | 1262 | */ |
1262 | if (waitqueue_active(&ep->wq)) | 1263 | if (waitqueue_active(&ep->wq)) |
1263 | wake_up(&ep->wq); | 1264 | __wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE | |
1265 | TASK_INTERRUPTIBLE); | ||
1264 | if (waitqueue_active(&ep->poll_wait)) | 1266 | if (waitqueue_active(&ep->poll_wait)) |
1265 | pwake++; | 1267 | pwake++; |
1266 | 1268 | ||
@@ -1444,7 +1446,8 @@ static void ep_reinject_items(struct eventpoll *ep, struct list_head *txlist) | |||
1444 | * wait list. | 1446 | * wait list. |
1445 | */ | 1447 | */ |
1446 | if (waitqueue_active(&ep->wq)) | 1448 | if (waitqueue_active(&ep->wq)) |
1447 | wake_up(&ep->wq); | 1449 | __wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE | |
1450 | TASK_INTERRUPTIBLE); | ||
1448 | if (waitqueue_active(&ep->poll_wait)) | 1451 | if (waitqueue_active(&ep->poll_wait)) |
1449 | pwake++; | 1452 | pwake++; |
1450 | } | 1453 | } |
@@ -1516,7 +1519,7 @@ retry: | |||
1516 | * ep_poll_callback() when events will become available. | 1519 | * ep_poll_callback() when events will become available. |
1517 | */ | 1520 | */ |
1518 | init_waitqueue_entry(&wait, current); | 1521 | init_waitqueue_entry(&wait, current); |
1519 | add_wait_queue(&ep->wq, &wait); | 1522 | __add_wait_queue(&ep->wq, &wait); |
1520 | 1523 | ||
1521 | for (;;) { | 1524 | for (;;) { |
1522 | /* | 1525 | /* |
@@ -1536,7 +1539,7 @@ retry: | |||
1536 | jtimeout = schedule_timeout(jtimeout); | 1539 | jtimeout = schedule_timeout(jtimeout); |
1537 | write_lock_irqsave(&ep->lock, flags); | 1540 | write_lock_irqsave(&ep->lock, flags); |
1538 | } | 1541 | } |
1539 | remove_wait_queue(&ep->wq, &wait); | 1542 | __remove_wait_queue(&ep->wq, &wait); |
1540 | 1543 | ||
1541 | set_current_state(TASK_RUNNING); | 1544 | set_current_state(TASK_RUNNING); |
1542 | } | 1545 | } |
@@ -1595,11 +1598,12 @@ eexit_1: | |||
1595 | } | 1598 | } |
1596 | 1599 | ||
1597 | 1600 | ||
1598 | static struct super_block * | 1601 | static int |
1599 | eventpollfs_get_sb(struct file_system_type *fs_type, int flags, | 1602 | eventpollfs_get_sb(struct file_system_type *fs_type, int flags, |
1600 | const char *dev_name, void *data) | 1603 | const char *dev_name, void *data, struct vfsmount *mnt) |
1601 | { | 1604 | { |
1602 | return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC); | 1605 | return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC, |
1606 | mnt); | ||
1603 | } | 1607 | } |
1604 | 1608 | ||
1605 | 1609 | ||