All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.5.46: overflow in disk stats
@ 2002-11-06  5:09 Lev Makhlis
  2002-11-06  6:06 ` Andrew Morton
  2002-11-06  7:19 ` Rick Lindsley
  0 siblings, 2 replies; 4+ messages in thread
From: Lev Makhlis @ 2002-11-06  5:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, ricklind

Hi,

I see that the SARD changes have been merged, but MSEC() still has
the overflow problem.  This takes care of it:

--------------------------------------------------------------------------------------------------

diff -urN linux-2.5.46.orig/drivers/block/genhd.c 
linux-2.5.46/drivers/block/genhd.c
--- linux-2.5.46.orig/drivers/block/genhd.c	Tue Nov  5 15:15:07 2002
+++ linux-2.5.46/drivers/block/genhd.c	Tue Nov  5 16:14:35 2002
@@ -326,7 +326,13 @@
 }
 static inline unsigned MSEC(unsigned x)
 {
-	return x * 1000 / HZ;
+#if 1000 % HZ == 0
+	return x * (1000 / HZ);
+#elif HZ % 1000 == 0
+	return x / (HZ / 1000);
+#else
+	return (x / HZ) * 1000 + (x % HZ) * 1000 / HZ;
+#endif
 }
 static ssize_t disk_stat_read(struct gendisk * disk,
 			      char *page, size_t count, loff_t off)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-06  7:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-06  5:09 [PATCH] 2.5.46: overflow in disk stats Lev Makhlis
2002-11-06  6:06 ` Andrew Morton
2002-11-06  6:20   ` Andrew Morton
2002-11-06  7:19 ` Rick Lindsley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.