summaryrefslogtreecommitdiff
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2016-09-01 01:16:43 +0300
committerMike Snitzer <snitzer@redhat.com>2016-09-14 20:56:38 +0300
commit9f4c3f874a3ab8fb845dd2f04f4396ebc5c1f225 (patch)
tree99da4367ea3d4d4fcacb2a64c8e8256af898d251 /drivers/md/dm.c
parente3fabdfdf70e2b340cff968fd1d13e4c624de926 (diff)
downloadlinux-9f4c3f874a3ab8fb845dd2f04f4396ebc5c1f225.tar.xz
dm: convert wait loops to use autoremove_wake_function()
Use autoremove_wake_function() instead of default_wake_function() to make the dm wait loops more similar to other wait loops in the kernel. This patch does not change any functionality. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6678cb2c2138..be35258324c1 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1944,12 +1944,10 @@ EXPORT_SYMBOL_GPL(dm_put);
static int dm_wait_for_completion(struct mapped_device *md, long task_state)
{
int r = 0;
- DECLARE_WAITQUEUE(wait, current);
-
- add_wait_queue(&md->wait, &wait);
+ DEFINE_WAIT(wait);
while (1) {
- set_current_state(task_state);
+ prepare_to_wait(&md->wait, &wait, task_state);
if (!md_in_flight(md))
break;
@@ -1961,9 +1959,7 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)
io_schedule();
}
- set_current_state(TASK_RUNNING);
-
- remove_wait_queue(&md->wait, &wait);
+ finish_wait(&md->wait, &wait);
return r;
}