diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2016-08-31 18:16:43 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-09-14 13:56:38 -0400 |
commit | 9f4c3f874a3ab8fb845dd2f04f4396ebc5c1f225 (patch) | |
tree | 99da4367ea3d4d4fcacb2a64c8e8256af898d251 | |
parent | e3fabdfdf70e2b340cff968fd1d13e4c624de926 (diff) |
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>
-rw-r--r-- | drivers/md/dm-mpath.c | 10 | ||||
-rw-r--r-- | drivers/md/dm.c | 10 |
2 files changed, 6 insertions, 14 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 15db5e9c572e..c777d38f4b11 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1193,21 +1193,17 @@ static int multipath_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
1193 | 1193 | ||
1194 | static void multipath_wait_for_pg_init_completion(struct multipath *m) | 1194 | static void multipath_wait_for_pg_init_completion(struct multipath *m) |
1195 | { | 1195 | { |
1196 | DECLARE_WAITQUEUE(wait, current); | 1196 | DEFINE_WAIT(wait); |
1197 | |||
1198 | add_wait_queue(&m->pg_init_wait, &wait); | ||
1199 | 1197 | ||
1200 | while (1) { | 1198 | while (1) { |
1201 | set_current_state(TASK_UNINTERRUPTIBLE); | 1199 | prepare_to_wait(&m->pg_init_wait, &wait, TASK_UNINTERRUPTIBLE); |
1202 | 1200 | ||
1203 | if (!atomic_read(&m->pg_init_in_progress)) | 1201 | if (!atomic_read(&m->pg_init_in_progress)) |
1204 | break; | 1202 | break; |
1205 | 1203 | ||
1206 | io_schedule(); | 1204 | io_schedule(); |
1207 | } | 1205 | } |
1208 | set_current_state(TASK_RUNNING); | 1206 | finish_wait(&m->pg_init_wait, &wait); |
1209 | |||
1210 | remove_wait_queue(&m->pg_init_wait, &wait); | ||
1211 | } | 1207 | } |
1212 | 1208 | ||
1213 | static void flush_multipath_work(struct multipath *m) | 1209 | static void flush_multipath_work(struct multipath *m) |
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); | |||
1944 | static int dm_wait_for_completion(struct mapped_device *md, long task_state) | 1944 | static int dm_wait_for_completion(struct mapped_device *md, long task_state) |
1945 | { | 1945 | { |
1946 | int r = 0; | 1946 | int r = 0; |
1947 | DECLARE_WAITQUEUE(wait, current); | 1947 | DEFINE_WAIT(wait); |
1948 | |||
1949 | add_wait_queue(&md->wait, &wait); | ||
1950 | 1948 | ||
1951 | while (1) { | 1949 | while (1) { |
1952 | set_current_state(task_state); | 1950 | prepare_to_wait(&md->wait, &wait, task_state); |
1953 | 1951 | ||
1954 | if (!md_in_flight(md)) | 1952 | if (!md_in_flight(md)) |
1955 | break; | 1953 | break; |
@@ -1961,9 +1959,7 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state) | |||
1961 | 1959 | ||
1962 | io_schedule(); | 1960 | io_schedule(); |
1963 | } | 1961 | } |
1964 | set_current_state(TASK_RUNNING); | 1962 | finish_wait(&md->wait, &wait); |
1965 | |||
1966 | remove_wait_queue(&md->wait, &wait); | ||
1967 | 1963 | ||
1968 | return r; | 1964 | return r; |
1969 | } | 1965 | } |