diff options
| -rw-r--r-- | fs/eventpoll.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index a415f42d32cf..0d237182d721 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
| @@ -257,25 +257,6 @@ static inline int ep_cmp_ffd(struct epoll_filefd *p1, | |||
| 257 | (p1->file < p2->file ? -1 : p1->fd - p2->fd)); | 257 | (p1->file < p2->file ? -1 : p1->fd - p2->fd)); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | /* Special initialization for the RB tree node to detect linkage */ | ||
| 261 | static inline void ep_rb_initnode(struct rb_node *n) | ||
| 262 | { | ||
| 263 | rb_set_parent(n, n); | ||
| 264 | } | ||
| 265 | |||
| 266 | /* Removes a node from the RB tree and marks it for a fast is-linked check */ | ||
| 267 | static inline void ep_rb_erase(struct rb_node *n, struct rb_root *r) | ||
| 268 | { | ||
| 269 | rb_erase(n, r); | ||
| 270 | rb_set_parent(n, n); | ||
| 271 | } | ||
| 272 | |||
| 273 | /* Fast check to verify that the item is linked to the main RB tree */ | ||
| 274 | static inline int ep_rb_linked(struct rb_node *n) | ||
| 275 | { | ||
| 276 | return rb_parent(n) != n; | ||
| 277 | } | ||
| 278 | |||
| 279 | /* Tells us if the item is currently linked */ | 260 | /* Tells us if the item is currently linked */ |
| 280 | static inline int ep_is_linked(struct list_head *p) | 261 | static inline int ep_is_linked(struct list_head *p) |
| 281 | { | 262 | { |
| @@ -283,13 +264,13 @@ static inline int ep_is_linked(struct list_head *p) | |||
| 283 | } | 264 | } |
| 284 | 265 | ||
| 285 | /* Get the "struct epitem" from a wait queue pointer */ | 266 | /* Get the "struct epitem" from a wait queue pointer */ |
| 286 | static inline struct epitem * ep_item_from_wait(wait_queue_t *p) | 267 | static inline struct epitem *ep_item_from_wait(wait_queue_t *p) |
| 287 | { | 268 | { |
| 288 | return container_of(p, struct eppoll_entry, wait)->base; | 269 | return container_of(p, struct eppoll_entry, wait)->base; |
| 289 | } | 270 | } |
| 290 | 271 | ||
| 291 | /* Get the "struct epitem" from an epoll queue wrapper */ | 272 | /* Get the "struct epitem" from an epoll queue wrapper */ |
| 292 | static inline struct epitem * ep_item_from_epqueue(poll_table *p) | 273 | static inline struct epitem *ep_item_from_epqueue(poll_table *p) |
| 293 | { | 274 | { |
| 294 | return container_of(p, struct ep_pqueue, pt)->epi; | 275 | return container_of(p, struct ep_pqueue, pt)->epi; |
| 295 | } | 276 | } |
| @@ -411,8 +392,7 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi) | |||
| 411 | list_del_init(&epi->fllink); | 392 | list_del_init(&epi->fllink); |
| 412 | spin_unlock(&file->f_ep_lock); | 393 | spin_unlock(&file->f_ep_lock); |
| 413 | 394 | ||
| 414 | if (ep_rb_linked(&epi->rbn)) | 395 | rb_erase(&epi->rbn, &ep->rbr); |
| 415 | ep_rb_erase(&epi->rbn, &ep->rbr); | ||
| 416 | 396 | ||
| 417 | spin_lock_irqsave(&ep->lock, flags); | 397 | spin_lock_irqsave(&ep->lock, flags); |
| 418 | if (ep_is_linked(&epi->rdllink)) | 398 | if (ep_is_linked(&epi->rdllink)) |
| @@ -728,7 +708,6 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, | |||
| 728 | goto error_return; | 708 | goto error_return; |
| 729 | 709 | ||
| 730 | /* Item initialization follow here ... */ | 710 | /* Item initialization follow here ... */ |
| 731 | ep_rb_initnode(&epi->rbn); | ||
| 732 | INIT_LIST_HEAD(&epi->rdllink); | 711 | INIT_LIST_HEAD(&epi->rdllink); |
| 733 | INIT_LIST_HEAD(&epi->fllink); | 712 | INIT_LIST_HEAD(&epi->fllink); |
| 734 | INIT_LIST_HEAD(&epi->pwqlist); | 713 | INIT_LIST_HEAD(&epi->pwqlist); |
