diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-02-03 14:55:31 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-02-04 19:57:52 +0300 |
commit | 2c561246524c3319473bf47b558354f7ff47f0cf (patch) | |
tree | de8d6589065919ca581aae1c34a54c769592b8e0 /include/linux/wait.h | |
parent | b7f120b211510b80cb72c1d790d9a4531271edfa (diff) | |
download | linux-2c561246524c3319473bf47b558354f7ff47f0cf.tar.xz |
block: Simplify bsg complete all
It took me a few tries to figure out what this code did; lets rewrite
it into a more regular form.
The thing that makes this one 'special' is the BSG_F_BLOCK flag, if
that is not set we're not supposed/allowed to block and should spin
wait for completion.
The (new) io_wait_event() will never see a false condition in case of
the spinning and we will therefore not block.
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r-- | include/linux/wait.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index 2232ed16635a..71fc1d31e48d 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -267,6 +267,21 @@ do { \ __wait_event(wq, condition); \ } while (0) +#define __io_wait_event(wq, condition) \ + (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \ + io_schedule()) + +/* + * io_wait_event() -- like wait_event() but with io_schedule() + */ +#define io_wait_event(wq, condition) \ +do { \ + might_sleep(); \ + if (condition) \ + break; \ + __io_wait_event(wq, condition); \ +} while (0) + #define __wait_event_freezable(wq, condition) \ ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \ schedule(); try_to_freeze()) |