public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi/sd: Fix size output in MB
@ 2008-08-30 14:08 Simon Arlott
  2008-08-30 17:24 ` James Bottomley
  0 siblings, 1 reply; 32+ messages in thread
From: Simon Arlott @ 2008-08-30 14:08 UTC (permalink / raw)
  To: Linux Kernel Mailing List, James.Bottomley

The capacity printk'd in bytes is divided by 1000000,
whereas 1048576 would be more consistent with the rest
of the OS and disk-related utilities ('df' etc.).

This change replaces the (sz - (sz/625 - 974))/1950
calculation with a simple right shift by 11 bits
(/2048).

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
---
 drivers/scsi/sd.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e5e7d78..e6fd6fd 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1441,10 +1441,8 @@ got_data:
 		sector_t mb = sz;
 
 		blk_queue_hardsect_size(queue, hard_sector);
-		/* avoid 64-bit division on 32-bit platforms */
-		sector_div(sz, 625);
-		mb -= sz - 974;
-		sector_div(mb, 1950);
+		/* Convert to megabytes (/2048) */
+		mb = sz >> 11;
 
 		sd_printk(KERN_NOTICE, sdkp,
 			  "%llu %d-byte hardware sectors (%llu MB)\n",
-- 
1.5.6.5

-- 
Simon Arlott




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

end of thread, other threads:[~2008-09-06  8:58 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-30 14:08 [PATCH] scsi/sd: Fix size output in MB Simon Arlott
2008-08-30 17:24 ` James Bottomley
2008-08-30 17:45   ` Matthew Wilcox
2008-08-30 20:59     ` Pierre Ossman
2008-08-30 21:45       ` James Bottomley
2008-08-30 22:13         ` Pierre Ossman
2008-08-30 22:24           ` Simon Arlott
2008-08-30 22:36           ` Matthew Wilcox
2008-08-30 21:02     ` Simon Arlott
2008-08-30 21:03       ` [PATCH] scsi/sd: Fix capacity output to show MB/GB/TB/ Simon Arlott
2008-08-31  1:59         ` James Bottomley
2008-08-31  2:54           ` Matthew Wilcox
2008-08-31 14:25             ` Ingo Oeser
2008-08-31 15:04               ` Simon Arlott
2008-08-31 15:08             ` James Bottomley
2008-08-31 15:13               ` [PATCH 1/2] lib: add generic helper to print sizes rounded to the correct SI range James Bottomley
2008-08-31 15:20                 ` Simon Arlott
2008-08-31 15:41                   ` James Bottomley
2008-08-31 15:51                 ` Matthew Wilcox
2008-08-31 18:54                 ` [PATCH] mmc_block: use generic helper to print capacities Pierre Ossman
2008-09-05 20:09                   ` James Bottomley
2008-09-05 20:52                     ` Pierre Ossman
2008-09-05 21:03                       ` James Bottomley
2008-09-06  8:57                         ` Pierre Ossman
2008-09-03  3:39                 ` [PATCH 1/2] lib: add generic helper to print sizes rounded to the correct SI range Andrew Morton
2008-09-03 14:32                   ` James Bottomley
2008-09-03 15:58                     ` Andrew Morton
2008-08-31 15:15               ` [PATCH 2/2] sd: use generic helper to print capacities in both binary and SI James Bottomley
2008-08-31 15:08           ` [PATCH] scsi/sd: Fix capacity output to show MB/GB/TB/ Simon Arlott
2008-08-30 21:57       ` [PATCH] scsi/sd: Fix size output in MB Matthew Wilcox
2008-08-30 22:22         ` Simon Arlott
2008-08-31 12:27         ` James Smart

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