aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2007-07-12 12:26:47 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 18:01:08 -0400
commitac818646d4be79123ad8dc5f1c4da8575d4960f8 (patch)
tree7efa3bb2f34998a0cad96fad1f355bf0c12b474b
parent028867ac28e51afc834a5931e7545c022557eded (diff)
dm delay: cleanup
Use setup_timer(). Replace semaphore with mutex. Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-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;