summaryrefslogtreecommitdiff
path: root/fs/orangefs/waitqueue.c
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2015-12-14 14:54:46 -0500
committerMike Marshall <hubcap@omnibond.com>2015-12-14 14:54:46 -0500
commitce6c414e17be602a84b1b34915468f8301ed14a0 (patch)
treef2373d995a4e4ad8f88a8a719df5fb6fb421cb83 /fs/orangefs/waitqueue.c
parent97f100277cfdcd268f0cf3d83bb6e4d1a345bc80 (diff)
Orangefs: Don't wait the old-fashioned way.
Get rid of add_wait_queue, set_current_state, etc, and use the wait_event() model. Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/waitqueue.c')
-rw-r--r--fs/orangefs/waitqueue.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index c731cbdd5fbd..856a4b48fe23 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -62,7 +62,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
/* irqflags and wait_entry are only used IF the client-core aborts */
unsigned long irqflags;
- DECLARE_WAITQUEUE(wait_entry, current);
+ DEFINE_WAIT(wait_entry);
op->upcall.tgid = current->tgid;
op->upcall.pid = current->pid;
@@ -204,11 +204,11 @@ retry_servicing:
* memory system can be initialized.
*/
spin_lock_irqsave(&op->lock, irqflags);
- add_wait_queue(&orangefs_bufmap_init_waitq, &wait_entry);
+ prepare_to_wait(&orangefs_bufmap_init_waitq,
+ &wait_entry,
+ TASK_INTERRUPTIBLE);
spin_unlock_irqrestore(&op->lock, irqflags);
- set_current_state(TASK_INTERRUPTIBLE);
-
/*
* Wait for orangefs_bufmap_initialize() to wake me up
* within the allotted time.
@@ -225,8 +225,7 @@ retry_servicing:
get_bufmap_init());
spin_lock_irqsave(&op->lock, irqflags);
- remove_wait_queue(&orangefs_bufmap_init_waitq,
- &wait_entry);
+ finish_wait(&orangefs_bufmap_init_waitq, &wait_entry);
spin_unlock_irqrestore(&op->lock, irqflags);
if (get_bufmap_init() == 0) {
@@ -342,16 +341,11 @@ void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
{
int ret = -EINVAL;
- DECLARE_WAITQUEUE(wait_entry, current);
-
- spin_lock(&op->lock);
- add_wait_queue(&op->waitq, &wait_entry);
- spin_unlock(&op->lock);
+ DEFINE_WAIT(wait_entry);
while (1) {
- set_current_state(TASK_INTERRUPTIBLE);
-
spin_lock(&op->lock);
+ prepare_to_wait(&op->waitq, &wait_entry, TASK_INTERRUPTIBLE);
if (op_state_serviced(op)) {
spin_unlock(&op->lock);
ret = 0;
@@ -434,10 +428,8 @@ int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
break;
}
- set_current_state(TASK_RUNNING);
-
spin_lock(&op->lock);
- remove_wait_queue(&op->waitq, &wait_entry);
+ finish_wait(&op->waitq, &wait_entry);
spin_unlock(&op->lock);
return ret;
@@ -455,16 +447,11 @@ int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op)
{
int ret = -EINVAL;
- DECLARE_WAITQUEUE(wait_entry, current);
-
- spin_lock(&op->lock);
- add_wait_queue(&op->waitq, &wait_entry);
- spin_unlock(&op->lock);
+ DEFINE_WAIT(wait_entry);
while (1) {
- set_current_state(TASK_INTERRUPTIBLE);
-
spin_lock(&op->lock);
+ prepare_to_wait(&op->waitq, &wait_entry, TASK_INTERRUPTIBLE);
if (op_state_serviced(op)) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s:op-state is SERVICED.\n",
@@ -514,10 +501,8 @@ int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op)
break;
}
- set_current_state(TASK_RUNNING);
-
spin_lock(&op->lock);
- remove_wait_queue(&op->waitq, &wait_entry);
+ finish_wait(&op->waitq, &wait_entry);
spin_unlock(&op->lock);
gossip_debug(GOSSIP_WAIT_DEBUG,