Skip to content

Commit

Permalink
dm delay: use msecs_to_jiffies for time conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicholas Mc Guire authored and Mike Snitzer committed Apr 15, 2015
1 parent 18cc980 commit aca607b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit aca607b

Please sign in to comment.