diff options
author | Mark Hounschell <dmarkh@cfl.rr.com> | 2015-05-13 10:49:09 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2015-09-18 13:52:02 +0200 |
commit | be8ec25609be78a9536cb7c89e77a1d549fced0d (patch) | |
tree | 65fbdb69ae58bb31d709ca9834168c624f6ce615 | |
parent | 06763ca2d529c0f2bfcf13aa47bdf211de4259c9 (diff) | |
download | lwn-be8ec25609be78a9536cb7c89e77a1d549fced0d.tar.gz lwn-be8ec25609be78a9536cb7c89e77a1d549fced0d.zip |
sd: Disable support for 256 byte/sector disks
commit 74856fbf441929918c49ff262ace9835048e4e6a 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: Mark Hounschell <dmarkh@cfl.rr.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit fd6b72574fcdaee123768804d8f1ac28c2a5b3de)
Signed-off-by: Willy Tarreau <w@1wt.eu>
-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 a5b55fe2f2b5..9202fc8174b7 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1045,6 +1045,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) { u64 start_lba = blk_rq_pos(scmd->request); u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); + u64 factor = scmd->device->sector_size / 512; u64 bad_lba; int info_valid; /* @@ -1066,16 +1067,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) if (scsi_bufflen(scmd) <= scmd->device->sector_size) return 0; - if (scmd->device->sector_size < 512) { - /* only legitimate sector_size here is 256 */ - start_lba <<= 1; - 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); - } + /* be careful ... don't want any overflows */ + do_div(start_lba, factor); + do_div(end_lba, factor); /* The bad lba was reported incorrectly, we have no idea where * the error is. @@ -1581,8 +1575,7 @@ got_data: if (sector_size != 512 && sector_size != 1024 && sector_size != 2048 && - sector_size != 4096 && - sector_size != 256) { + sector_size != 4096) { sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", sector_size); /* @@ -1631,8 +1624,6 @@ got_data: sdkp->capacity <<= 2; else if (sector_size == 1024) sdkp->capacity <<= 1; - else if (sector_size == 256) - sdkp->capacity >>= 1; blk_queue_physical_block_size(sdp->request_queue, sdkp->hw_sector_size); sdkp->device->sector_size = sector_size; |