Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alasdair G Kergon and committed by
Linus Torvalds
ac818646 028867ac

+5 -7
+5 -7
drivers/md/dm-delay.c
··· 20 20 21 21 struct delay_c { 22 22 struct timer_list delay_timer; 23 - struct semaphore timer_lock; 23 + struct mutex timer_lock; 24 24 struct work_struct flush_expired_bios; 25 25 struct list_head delayed_bios; 26 26 atomic_t may_delay; ··· 58 58 59 59 static 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 63 if (!timer_pending(&dc->delay_timer) || expires < dc->delay_timer.expires) 64 64 mod_timer(&dc->delay_timer, expires); 65 65 66 - up(&dc->timer_lock); 66 + mutex_unlock(&dc->timer_lock); 67 67 } 68 68 69 69 static void flush_bios(struct bio *bio) ··· 193 193 goto bad; 194 194 } 195 195 196 - init_timer(&dc->delay_timer); 197 - dc->delay_timer.function = handle_delayed_timer; 198 - dc->delay_timer.data = (unsigned long)dc; 196 + setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); 199 197 200 198 INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); 201 199 INIT_LIST_HEAD(&dc->delayed_bios); 202 - init_MUTEX(&dc->timer_lock); 200 + mutex_init(&dc->timer_lock); 203 201 atomic_set(&dc->may_delay, 1); 204 202 205 203 ti->private = dc;