diff options
author | Mark Hounschell <dmarkh@cfl.rr.com> | 2015-05-13 04:49:09 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-05-18 14:26:37 -0400 |
commit | 74856fbf441929918c49ff262ace9835048e4e6a (patch) | |
tree | 62b0ebca32bc9030628293348aa9e977d9b351c7 | |
parent | 8b2564ec7410928639db5c09a34d7d8330f1d759 (diff) |
sd: Disable support for 256 byte/sector disks
256 bytes per sector support has been broken since 2.6.X,
and no-one stepped up to fix this.
So disable support for it.
Signed-off-by: Mark Hounschell <dmarkh@cfl.rr.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | drivers/scsi/sd.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 79beebf53302..7f9d65fe4fd9 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1600,6 +1600,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | |||
1600 | { | 1600 | { |
1601 | u64 start_lba = blk_rq_pos(scmd->request); | 1601 | u64 start_lba = blk_rq_pos(scmd->request); |
1602 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); | 1602 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); |
1603 | u64 factor = scmd->device->sector_size / 512; | ||
1603 | u64 bad_lba; | 1604 | u64 bad_lba; |
1604 | int info_valid; | 1605 | int info_valid; |
1605 | /* | 1606 | /* |
@@ -1621,16 +1622,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | |||
1621 | if (scsi_bufflen(scmd) <= scmd->device->sector_size) | 1622 | if (scsi_bufflen(scmd) <= scmd->device->sector_size) |
1622 | return 0; | 1623 | return 0; |
1623 | 1624 | ||
1624 | if (scmd->device->sector_size < 512) { | 1625 | /* be careful ... don't want any overflows */ |
1625 | /* only legitimate sector_size here is 256 */ | 1626 | do_div(start_lba, factor); |
1626 | start_lba <<= 1; | 1627 | do_div(end_lba, factor); |
1627 | end_lba <<= 1; | ||
1628 | } else { | ||
1629 | /* be careful ... don't want any overflows */ | ||
1630 | unsigned int factor = scmd->device->sector_size / 512; | ||
1631 | do_div(start_lba, factor); | ||
1632 | do_div(end_lba, factor); | ||
1633 | } | ||
1634 | 1628 | ||
1635 | /* The bad lba was reported incorrectly, we have no idea where | 1629 | /* The bad lba was reported incorrectly, we have no idea where |
1636 | * the error is. | 1630 | * the error is. |
@@ -2188,8 +2182,7 @@ got_data: | |||
2188 | if (sector_size != 512 && | 2182 | if (sector_size != 512 && |
2189 | sector_size != 1024 && | 2183 | sector_size != 1024 && |
2190 | sector_size != 2048 && | 2184 | sector_size != 2048 && |
2191 | sector_size != 4096 && | 2185 | sector_size != 4096) { |
2192 | sector_size != 256) { | ||
2193 | sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", | 2186 | sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", |
2194 | sector_size); | 2187 | sector_size); |
2195 | /* | 2188 | /* |
@@ -2244,8 +2237,6 @@ got_data: | |||
2244 | sdkp->capacity <<= 2; | 2237 | sdkp->capacity <<= 2; |
2245 | else if (sector_size == 1024) | 2238 | else if (sector_size == 1024) |
2246 | sdkp->capacity <<= 1; | 2239 | sdkp->capacity <<= 1; |
2247 | else if (sector_size == 256) | ||
2248 | sdkp->capacity >>= 1; | ||
2249 | 2240 | ||
2250 | blk_queue_physical_block_size(sdp->request_queue, | 2241 | blk_queue_physical_block_size(sdp->request_queue, |
2251 | sdkp->physical_block_size); | 2242 | sdkp->physical_block_size); |