diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-08-31 10:41:52 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-03 11:46:15 -0500 |
commit | 7404ad3b6d04efbd918e9e2e776bf560fbedf47d (patch) | |
tree | d2f85a9230d78272329aa522d71068cefbbef7cb /drivers/scsi/sd.c | |
parent | 3c9f3681d0b4af09c1cbf04f92fdfb72bd81ad7b (diff) | |
download | linux-7404ad3b6d04efbd918e9e2e776bf560fbedf47d.tar.gz linux-7404ad3b6d04efbd918e9e2e776bf560fbedf47d.tar.bz2 linux-7404ad3b6d04efbd918e9e2e776bf560fbedf47d.zip |
[SCSI] sd: use generic helper to print capacities in both binary and SI
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 27 |
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 @@ #include <linux/blkpg.h> #include <linux/delay.h> #include <linux/mutex.h> +#include <linux/string_helpers.h> #include <asm/uaccess.h> #include <scsi/scsi.h> @@ -1429,27 +1430,21 @@ got_data: */ sector_size = 512; } + blk_queue_hardsect_size(sdp->request_queue, sector_size); + { - /* - * The msdos fs needs to know the hardware sector size - * So I have created this table. See ll_rw_blk.c - * Jacques Gelinas (Jacques@solucorp.qc.ca) - */ - int hard_sector = sector_size; - sector_t sz = (sdkp->capacity/2) * (hard_sector/256); - struct request_queue *queue = sdp->request_queue; - sector_t mb = sz; + char cap_str_2[10], cap_str_10[10]; + u64 sz = sdkp->capacity << ffz(~sector_size); - 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); + string_get_size(sz, STRING_UNITS_2, cap_str_2, + sizeof(cap_str_2)); + string_get_size(sz, STRING_UNITS_10, cap_str_10, + sizeof(cap_str_10)); sd_printk(KERN_NOTICE, sdkp, - "%llu %d-byte hardware sectors (%llu MB)\n", + "%llu %d-byte hardware sectors: (%s/%s)\n", (unsigned long long)sdkp->capacity, - hard_sector, (unsigned long long)mb); + sector_size, cap_str_10, cap_str_2); } /* Rescale capacity to 512-byte units */ |