dm delay: use msecs_to_jiffies for time conversion
authorNicholas Mc Guire <hofrat@osadl.org>
Tue, 17 Mar 2015 11:47:58 +0000 (07:47 -0400)
committerMike Snitzer <snitzer@redhat.com>
Wed, 15 Apr 2015 16:10:21 +0000 (12:10 -0400)
Converting milliseconds to jiffies by "val * HZ / 1000" is technically
OK but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-delay.c

index 42c3a27..57b6a19 100644 (file)
@@ -236,7 +236,7 @@ static int delay_bio(struct delay_c *dc, int delay, struct bio *bio)
        delayed = dm_per_bio_data(bio, sizeof(struct dm_delay_info));
 
        delayed->context = dc;
-       delayed->expires = expires = jiffies + (delay * HZ / 1000);
+       delayed->expires = expires = jiffies + msecs_to_jiffies(delay);
 
        mutex_lock(&delayed_bios_lock);