All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lev Makhlis <mlev@despammed.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@digeo.com>, ricklind@us.ibm.com
Subject: [PATCH] 2.5.46: overflow in disk stats
Date: Wed, 6 Nov 2002 00:09:51 -0500	[thread overview]
Message-ID: <200211060009.51684.mlev@despammed.com> (raw)

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)

             reply	other threads:[~2002-11-06  5:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06  5:09 Lev Makhlis [this message]
2002-11-06  6:06 ` [PATCH] 2.5.46: overflow in disk stats Andrew Morton
2002-11-06  6:20   ` Andrew Morton
2002-11-06  7:19 ` Rick Lindsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200211060009.51684.mlev@despammed.com \
    --to=mlev@despammed.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ricklind@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.