aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-delay.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index eb218266cbf3..6928c136d3c5 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -20,7 +20,7 @@
20 20
21struct delay_c { 21struct delay_c {
22 struct timer_list delay_timer; 22 struct timer_list delay_timer;
23 struct semaphore timer_lock; 23 struct mutex timer_lock;
24 struct work_struct flush_expired_bios; 24 struct work_struct flush_expired_bios;
25 struct list_head delayed_bios; 25 struct list_head delayed_bios;
26 atomic_t may_delay; 26 atomic_t may_delay;
@@ -58,12 +58,12 @@ static void handle_delayed_timer(unsigned long data)
58 58
59static void queue_timeout(struct delay_c *dc, unsigned long expires) 59static void queue_timeout(struct delay_c *dc, unsigned long expires)
60{ 60{
61 down(&dc->timer_lock); 61 mutex_lock(&dc->timer_lock);
62 62
63 if (!timer_pending(&dc->delay_timer) || expires < dc->delay_timer.expires) 63 if (!timer_pending(&dc->delay_timer) || expires < dc->delay_timer.expires)
64 mod_timer(&dc->delay_timer, expires); 64 mod_timer(&dc->delay_timer, expires);
65 65
66 up(&dc->timer_lock); 66 mutex_unlock(&dc->timer_lock);
67} 67}
68 68
69static void flush_bios(struct bio *bio) 69static void flush_bios(struct bio *bio)
@@ -193,13 +193,11 @@ out:
193 goto bad; 193 goto bad;
194 } 194 }
195 195
196 init_timer(&dc->delay_timer); 196 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc);
197 dc->delay_timer.function = handle_delayed_timer;
198 dc->delay_timer.data = (unsigned long)dc;
199 197
200 INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); 198 INIT_WORK(&dc->flush_expired_bios, flush_expired_bios);
201 INIT_LIST_HEAD(&dc->delayed_bios); 199 INIT_LIST_HEAD(&dc->delayed_bios);
202 init_MUTEX(&dc->timer_lock); 200 mutex_init(&dc->timer_lock);
203 atomic_set(&dc->may_delay, 1); 201 atomic_set(&dc->may_delay, 1);
204 202
205 ti->private = dc; 203 ti->private = dc;