diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-23 21:45:46 +0300 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-01-23 23:20:11 +0300 |
commit | 2a9e5c22605f5db6040535b10dce5fbc3a7db3bd (patch) | |
tree | b1bae68686c49aac26a3b06aed2921f630171566 /fs/orangefs/devorangefs-req.c | |
parent | 4f55e39732ad0bd05d70c88e174e747d55e3685c (diff) | |
download | linux-2a9e5c22605f5db6040535b10dce5fbc3a7db3bd.tar.xz |
orangefs: don't reinvent completion.h...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/devorangefs-req.c')
-rw-r--r-- | fs/orangefs/devorangefs-req.c | 75 |
1 files changed, 21 insertions, 54 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c index 3879f2b7cf29..812844faa7f5 100644 --- a/fs/orangefs/devorangefs-req.c +++ b/fs/orangefs/devorangefs-req.c @@ -398,6 +398,17 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, } wakeup: + /* + * tell the vfs op waiting on a waitqueue + * that this op is done + */ + spin_lock(&op->lock); + if (unlikely(op_state_given_up(op))) { + spin_unlock(&op->lock); + goto out; + } + set_op_state_serviced(op); + spin_unlock(&op->lock); /* * If this operation is an I/O operation we need to wait @@ -411,61 +422,17 @@ wakeup: * the buffers are done being used. */ if (op->downcall.type == ORANGEFS_VFS_OP_FILE_IO) { - DEFINE_WAIT(wait_entry); - - /* - * tell the vfs op waiting on a waitqueue - * that this op is done - */ - spin_lock(&op->lock); - if (unlikely(op_state_given_up(op))) { - spin_unlock(&op->lock); - goto out; - } - set_op_state_serviced(op); - spin_unlock(&op->lock); - - while (1) { - spin_lock(&op->lock); - prepare_to_wait_exclusive( - &op->io_completion_waitq, - &wait_entry, - TASK_INTERRUPTIBLE); - if (op->io_completed) { - spin_unlock(&op->lock); - break; - } - spin_unlock(&op->lock); - if (unlikely(signal_pending(current))) { - gossip_debug(GOSSIP_DEV_DEBUG, - "%s: signal on I/O wait, aborting\n", - __func__); - break; - } - - if (!schedule_timeout(op_timeout_secs * HZ)) { - gossip_debug(GOSSIP_DEV_DEBUG, - "%s: timed out.\n", - __func__); - break; - } + long n = wait_for_completion_interruptible_timeout(&op->done, + op_timeout_secs * HZ); + if (unlikely(n < 0)) { + gossip_debug(GOSSIP_DEV_DEBUG, + "%s: signal on I/O wait, aborting\n", + __func__); + } else if (unlikely(n == 0)) { + gossip_debug(GOSSIP_DEV_DEBUG, + "%s: timed out.\n", + __func__); } - - spin_lock(&op->lock); - finish_wait(&op->io_completion_waitq, &wait_entry); - spin_unlock(&op->lock); - } else { - /* - * tell the vfs op waiting on a waitqueue that - * this op is done - - * for every other operation (i.e. non-I/O), we need to - * wake up the callers for downcall completion - * notification - */ - spin_lock(&op->lock); - if (!op_state_given_up(op)) - set_op_state_serviced(op); - spin_unlock(&op->lock); } out: op_release(op); |