aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-08-31 11:41:52 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-10-03 12:46:15 -0400
commit7404ad3b6d04efbd918e9e2e776bf560fbedf47d (patch)
treed2f85a9230d78272329aa522d71068cefbbef7cb
parent3c9f3681d0b4af09c1cbf04f92fdfb72bd81ad7b (diff)
[SCSI] sd: use generic helper to print capacities in both binary and SI
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/sd.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e5e7d7856454..af9e406a3ad8 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -47,6 +47,7 @@
47#include <linux/blkpg.h> 47#include <linux/blkpg.h>
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/mutex.h> 49#include <linux/mutex.h>
50#include <linux/string_helpers.h>
50#include <asm/uaccess.h> 51#include <asm/uaccess.h>
51 52
52#include <scsi/scsi.h> 53#include <scsi/scsi.h>
@@ -1429,27 +1430,21 @@ got_data:
1429 */ 1430 */
1430 sector_size = 512; 1431 sector_size = 512;
1431 } 1432 }
1433 blk_queue_hardsect_size(sdp->request_queue, sector_size);
1434
1432 { 1435 {
1433 /* 1436 char cap_str_2[10], cap_str_10[10];
1434 * The msdos fs needs to know the hardware sector size 1437 u64 sz = sdkp->capacity << ffz(~sector_size);
1435 * So I have created this table. See ll_rw_blk.c
1436 * Jacques Gelinas (Jacques@solucorp.qc.ca)
1437 */
1438 int hard_sector = sector_size;
1439 sector_t sz = (sdkp->capacity/2) * (hard_sector/256);
1440 struct request_queue *queue = sdp->request_queue;
1441 sector_t mb = sz;
1442 1438
1443 blk_queue_hardsect_size(queue, hard_sector); 1439 string_get_size(sz, STRING_UNITS_2, cap_str_2,
1444 /* avoid 64-bit division on 32-bit platforms */ 1440 sizeof(cap_str_2));
1445 sector_div(sz, 625); 1441 string_get_size(sz, STRING_UNITS_10, cap_str_10,
1446 mb -= sz - 974; 1442 sizeof(cap_str_10));
1447 sector_div(mb, 1950);
1448 1443
1449 sd_printk(KERN_NOTICE, sdkp, 1444 sd_printk(KERN_NOTICE, sdkp,
1450 "%llu %d-byte hardware sectors (%llu MB)\n", 1445 "%llu %d-byte hardware sectors: (%s/%s)\n",
1451 (unsigned long long)sdkp->capacity, 1446 (unsigned long long)sdkp->capacity,
1452 hard_sector, (unsigned long long)mb); 1447 sector_size, cap_str_10, cap_str_2);
1453 } 1448 }
1454 1449
1455 /* Rescale capacity to 512-byte units */ 1450 /* Rescale capacity to 512-byte units */