Commit b1fc2b0f authored by Mark Hounschell's avatar Mark Hounschell Committed by Kamal Mostafa

sd: Disable support for 256 byte/sector disks

commit 74856fbf upstream.

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: default avatarMark Hounschell <dmarkh@cfl.rr.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 2b5b809f
...@@ -1601,6 +1601,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) ...@@ -1601,6 +1601,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
{ {
u64 start_lba = blk_rq_pos(scmd->request); u64 start_lba = blk_rq_pos(scmd->request);
u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512);
u64 factor = scmd->device->sector_size / 512;
u64 bad_lba; u64 bad_lba;
int info_valid; int info_valid;
/* /*
...@@ -1622,16 +1623,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) ...@@ -1622,16 +1623,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
if (scsi_bufflen(scmd) <= scmd->device->sector_size) if (scsi_bufflen(scmd) <= scmd->device->sector_size)
return 0; return 0;
if (scmd->device->sector_size < 512) { /* be careful ... don't want any overflows */
/* only legitimate sector_size here is 256 */ do_div(start_lba, factor);
start_lba <<= 1; do_div(end_lba, factor);
end_lba <<= 1;
} else {
/* be careful ... don't want any overflows */
u64 factor = scmd->device->sector_size / 512;
do_div(start_lba, factor);
do_div(end_lba, factor);
}
/* The bad lba was reported incorrectly, we have no idea where /* The bad lba was reported incorrectly, we have no idea where
* the error is. * the error is.
...@@ -2198,8 +2192,7 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2198,8 +2192,7 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
if (sector_size != 512 && if (sector_size != 512 &&
sector_size != 1024 && sector_size != 1024 &&
sector_size != 2048 && sector_size != 2048 &&
sector_size != 4096 && sector_size != 4096) {
sector_size != 256) {
sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n",
sector_size); sector_size);
/* /*
...@@ -2250,8 +2243,6 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2250,8 +2243,6 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
sdkp->capacity <<= 2; sdkp->capacity <<= 2;
else if (sector_size == 1024) else if (sector_size == 1024)
sdkp->capacity <<= 1; sdkp->capacity <<= 1;
else if (sector_size == 256)
sdkp->capacity >>= 1;
blk_queue_physical_block_size(sdp->request_queue, blk_queue_physical_block_size(sdp->request_queue,
sdkp->physical_block_size); sdkp->physical_block_size);
......
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