Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] dm delay: use msecs_to_jiffies for time conversion
@ 2015-03-17 11:47 Nicholas Mc Guire
  0 siblings, 0 replies; only message in thread
From: Nicholas Mc Guire @ 2015-03-17 11:47 UTC (permalink / raw)
  To: Alasdair Kergon
  Cc: Mike Snitzer, dm-devel, Neil Brown, linux-raid, linux-kernel,
	Nicholas Mc Guire

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. This is a minor API consolidation only and
should make things more readable.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Patch was compile tested with x86_64_defconfig + CONFIG_DM_DELAY=m

Patch is against 4.0-rc4 (localversion-next is -next-20150317)

 drivers/md/dm-delay.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 42c3a27..57b6a19 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -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);
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-17 11:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-17 11:47 [PATCH] dm delay: use msecs_to_jiffies for time conversion Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox