Commit 7404ad3b authored by James Bottomley's avatar James Bottomley

[SCSI] sd: use generic helper to print capacities in both binary and SI

Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 3c9f3681
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <linux/blkpg.h> #include <linux/blkpg.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/string_helpers.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
...@@ -1429,27 +1430,21 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -1429,27 +1430,21 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
*/ */
sector_size = 512; sector_size = 512;
} }
blk_queue_hardsect_size(sdp->request_queue, sector_size);
{ {
/* char cap_str_2[10], cap_str_10[10];
* The msdos fs needs to know the hardware sector size u64 sz = sdkp->capacity << ffz(~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;
blk_queue_hardsect_size(queue, hard_sector); string_get_size(sz, STRING_UNITS_2, cap_str_2,
/* avoid 64-bit division on 32-bit platforms */ sizeof(cap_str_2));
sector_div(sz, 625); string_get_size(sz, STRING_UNITS_10, cap_str_10,
mb -= sz - 974; sizeof(cap_str_10));
sector_div(mb, 1950);
sd_printk(KERN_NOTICE, sdkp, 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, (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 */ /* Rescale capacity to 512-byte units */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment