aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sd.c')
-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 c0cf4acda7de..a7b53be63367 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>
@@ -1433,27 +1434,21 @@ got_data:
1433 */ 1434 */
1434 sector_size = 512; 1435 sector_size = 512;
1435 } 1436 }
1437 blk_queue_hardsect_size(sdp->request_queue, sector_size);
1438
1436 { 1439 {
1437 /* 1440 char cap_str_2[10], cap_str_10[10];
1438 * The msdos fs needs to know the hardware sector size 1441 u64 sz = sdkp->capacity << ffz(~sector_size);
1439 * So I have created this table. See ll_rw_blk.c
1440 * Jacques Gelinas (Jacques@solucorp.qc.ca)
1441 */
1442 int hard_sector = sector_size;
1443 sector_t sz = (sdkp->capacity/2) * (hard_sector/256);
1444 struct request_queue *queue = sdp->request_queue;
1445 sector_t mb = sz;
1446 1442
1447 blk_queue_hardsect_size(queue, hard_sector); 1443 string_get_size(sz, STRING_UNITS_2, cap_str_2,
1448 /* avoid 64-bit division on 32-bit platforms */ 1444 sizeof(cap_str_2));
1449 sector_div(sz, 625); 1445 string_get_size(sz, STRING_UNITS_10, cap_str_10,
1450 mb -= sz - 974; 1446 sizeof(cap_str_10));
1451 sector_div(mb, 1950);
1452 1447
1453 sd_printk(KERN_NOTICE, sdkp, 1448 sd_printk(KERN_NOTICE, sdkp,
1454 "%llu %d-byte hardware sectors (%llu MB)\n", 1449 "%llu %d-byte hardware sectors: (%s/%s)\n",
1455 (unsigned long long)sdkp->capacity, 1450 (unsigned long long)sdkp->capacity,
1456 hard_sector, (unsigned long long)mb); 1451 sector_size, cap_str_10, cap_str_2);
1457 } 1452 }
1458 1453
1459 /* Rescale capacity to 512-byte units */ 1454 /* Rescale capacity to 512-byte units */