From: Mark Hounschell <markh@compro.net>
To: Hannes Reinecke <hare@suse.de>,
James Bottomley <jbottomley@parallels.com>
Cc: Mark Hounschell <dmarkh@cfl.rr.com>,
linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] sd: Disable support for 256 byte/sector disks
Date: Wed, 13 May 2015 08:55:30 -0400 [thread overview]
Message-ID: <555349C2.2020203@compro.net> (raw)
In-Reply-To: <1431506949-11398-1-git-send-email-hare@suse.de>
On 05/13/2015 04:49 AM, Hannes Reinecke wrote:
> 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>
> ---
> drivers/scsi/sd.c | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 79beebf..7f9d65f 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)
> {
> 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;
> /*
> @@ -1621,16 +1622,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 */
> - unsigned int 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.
> @@ -2188,8 +2182,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);
> /*
> @@ -2244,8 +2237,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->physical_block_size);
>
Tested-by: Mark Hounschell <dmarkh@cfl.rr.com>
Mark
next prev parent reply other threads:[~2015-05-13 13:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 8:49 [PATCH] sd: Disable support for 256 byte/sector disks Hannes Reinecke
2015-05-13 12:55 ` Mark Hounschell [this message]
2015-05-13 14:00 ` James Bottomley
2015-05-13 14:09 ` Hannes Reinecke
2015-05-13 14:17 ` James Bottomley
2015-05-13 14:29 ` Mark Hounschell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555349C2.2020203@compro.net \
--to=markh@compro.net \
--cc=dmarkh@cfl.rr.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox