diff options
author | Davide Libenzi <davidel@xmailserver.org> | 2011-03-22 19:34:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:15 -0400 |
commit | 3fb0e584a68cd1c5085e69be441f2ad032aaee72 (patch) | |
tree | 8cf550c8fabf54aeca48d76538357b7211a18c83 /fs | |
parent | d03e1617f089c0bcbc22b9d4739e04a0b43b14fa (diff) |
epoll: move ready event check into proper inline
Move the event readiness check into a proper inline, and use it uniformly
inside ep_poll() code. Events in the ->ovflist are no less ready than the
ones in ->rdllist.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/eventpoll.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index ff12f7ac73ef..57298d092f56 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -316,6 +316,19 @@ static void ep_nested_calls_init(struct nested_calls *ncalls) | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * ep_events_available - Checks if ready events might be available. | ||
320 | * | ||
321 | * @ep: Pointer to the eventpoll context. | ||
322 | * | ||
323 | * Returns: Returns a value different than zero if ready events are available, | ||
324 | * or zero otherwise. | ||
325 | */ | ||
326 | static inline int ep_events_available(struct eventpoll *ep) | ||
327 | { | ||
328 | return !list_empty(&ep->rdllist) || ep->ovflist != EP_UNACTIVE_PTR; | ||
329 | } | ||
330 | |||
331 | /** | ||
319 | * ep_call_nested - Perform a bound (possibly) nested call, by checking | 332 | * ep_call_nested - Perform a bound (possibly) nested call, by checking |
320 | * that the recursion limit is not exceeded, and that | 333 | * that the recursion limit is not exceeded, and that |
321 | * the same nested call (by the meaning of same cookie) is | 334 | * the same nested call (by the meaning of same cookie) is |
@@ -1158,7 +1171,7 @@ retry: | |||
1158 | spin_lock_irqsave(&ep->lock, flags); | 1171 | spin_lock_irqsave(&ep->lock, flags); |
1159 | 1172 | ||
1160 | res = 0; | 1173 | res = 0; |
1161 | if (list_empty(&ep->rdllist)) { | 1174 | if (!ep_events_available(ep)) { |
1162 | /* | 1175 | /* |
1163 | * We don't have any available event to return to the caller. | 1176 | * We don't have any available event to return to the caller. |
1164 | * We need to sleep here, and we will be wake up by | 1177 | * We need to sleep here, and we will be wake up by |
@@ -1174,7 +1187,7 @@ retry: | |||
1174 | * to TASK_INTERRUPTIBLE before doing the checks. | 1187 | * to TASK_INTERRUPTIBLE before doing the checks. |
1175 | */ | 1188 | */ |
1176 | set_current_state(TASK_INTERRUPTIBLE); | 1189 | set_current_state(TASK_INTERRUPTIBLE); |
1177 | if (!list_empty(&ep->rdllist) || timed_out) | 1190 | if (ep_events_available(ep) || timed_out) |
1178 | break; | 1191 | break; |
1179 | if (signal_pending(current)) { | 1192 | if (signal_pending(current)) { |
1180 | res = -EINTR; | 1193 | res = -EINTR; |
@@ -1192,7 +1205,7 @@ retry: | |||
1192 | set_current_state(TASK_RUNNING); | 1205 | set_current_state(TASK_RUNNING); |
1193 | } | 1206 | } |
1194 | /* Is it worth to try to dig for events ? */ | 1207 | /* Is it worth to try to dig for events ? */ |
1195 | eavail = !list_empty(&ep->rdllist) || ep->ovflist != EP_UNACTIVE_PTR; | 1208 | eavail = ep_events_available(ep); |
1196 | 1209 | ||
1197 | spin_unlock_irqrestore(&ep->lock, flags); | 1210 | spin_unlock_irqrestore(&ep->lock, flags); |
1198 | 1211 | ||