summaryrefslogtreecommitdiff
path: root/fs/orangefs/orangefs-bufmap.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/orangefs-bufmap.c
parent97f100277cfdcd268f0cf3d83bb6e4d1a345bc80 (diff)
downloadlwn-ce6c414e17be602a84b1b34915468f8301ed14a0.tar.gz
lwn-ce6c414e17be602a84b1b34915468f8301ed14a0.zip
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/orangefs-bufmap.c')
-rw-r--r--fs/orangefs/orangefs-bufmap.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index f7cd18a2a73b..863c6fc8e192 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -333,19 +333,17 @@ static int wait_for_a_slot(struct slot_args *slargs, int *buffer_index)
{
int ret = -1;
int i = 0;
- DECLARE_WAITQUEUE(my_wait, current);
-
-
- add_wait_queue_exclusive(slargs->slot_wq, &my_wait);
+ DEFINE_WAIT(wait_entry);
while (1) {
- set_current_state(TASK_INTERRUPTIBLE);
-
/*
* check for available desc, slot_lock is the appropriate
* index_lock
*/
spin_lock(slargs->slot_lock);
+ prepare_to_wait_exclusive(slargs->slot_wq,
+ &wait_entry,
+ TASK_INTERRUPTIBLE);
for (i = 0; i < slargs->slot_count; i++)
if (slargs->slot_array[i] == 0) {
slargs->slot_array[i] = 1;
@@ -383,8 +381,9 @@ static int wait_for_a_slot(struct slot_args *slargs, int *buffer_index)
break;
}
- set_current_state(TASK_RUNNING);
- remove_wait_queue(slargs->slot_wq, &my_wait);
+ spin_lock(slargs->slot_lock);
+ finish_wait(slargs->slot_wq, &wait_entry);
+ spin_unlock(slargs->slot_lock);
return ret;
}