All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Brian King <brking@linux.vnet.ibm.com>,
	James.Bottomley@HansenPartnership.com
Cc: hch@lst.de, linux-scsi@vger.kernel.org,
	wenxiong@linux.vnet.ibm.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/1] scsi: Fix max transfer length for 4k disks
Date: Fri, 30 Jan 2015 00:09:56 +0100	[thread overview]
Message-ID: <54CABDC4.9000404@redhat.com> (raw)
In-Reply-To: <201501292155.t0TLt4qF025739@d01av05.pok.ibm.com>



On 29/01/2015 22:54, Brian King wrote:
> The following patch fixes an issue observed with 4k sector disks
> where the max_hw_sectors attribute was getting set too large in
> sd_revalidate_disk. Since sdkp->max_xfer_blocks is in units
> of SCSI logical blocks and queue_max_hw_sectors is in units of
> 512 byte blocks, on a 4k sector disk, every time we went through
> sd_revalidate_disk, we were taking the current value of
> queue_max_hw_sectors and increasing it by a factor of 8. Fix
> this by only shifting sdkp->max_xfer_blocks.
> 
> Cc: stable<stable@vger.kernel.org>
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> ---
> 
>  drivers/scsi/sd.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff -puN drivers/scsi/sd.c~sd_revalidate_4k drivers/scsi/sd.c
> --- linux/drivers/scsi/sd.c~sd_revalidate_4k	2015-01-29 14:44:23.316171187 -0600
> +++ linux-bjking1/drivers/scsi/sd.c	2015-01-29 14:51:05.846126392 -0600
> @@ -2800,9 +2800,11 @@ static int sd_revalidate_disk(struct gen
>  	 */
>  	sd_set_flush_flag(sdkp);
>  
> -	max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
> -				sdkp->max_xfer_blocks);
> +	max_xfer = sdkp->max_xfer_blocks;
>  	max_xfer <<= ilog2(sdp->sector_size) - 9;
> +
> +	max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
> +				max_xfer);
>  	blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
>  	set_capacity(disk, sdkp->capacity);
>  	sd_config_write_same(sdkp);
> _
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

  reply	other threads:[~2015-01-29 23:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 21:54 [PATCH 1/1] scsi: Fix max transfer length for 4k disks Brian King
2015-01-29 23:09 ` Paolo Bonzini [this message]
2015-01-30  0:43 ` Martin K. Petersen
2015-02-03 19:25 ` Venkatesh Srinivas

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=54CABDC4.9000404@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wenxiong@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.