All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] sd: Fix maximum I/O size for BLOCK_PC requests
Date: Thu, 16 Jul 2015 13:12:44 +0200	[thread overview]
Message-ID: <55A791AC.8010700@suse.de> (raw)
In-Reply-To: <1437009226-599-1-git-send-email-martin.petersen@oracle.com>

On 07/16/2015 03:13 AM, Martin K. Petersen wrote:
> Commit bcdb247c6b6a ("sd: Limit transfer length") clamped the maximum
> size of an I/O request to the MAXIMUM TRANSFER LENGTH field in the BLOCK
> LIMITS VPD. This had the unfortunate effect of also limiting the maximum
> size of non-filesystem requests sent to the device through sg/bsg.
> 
> Avoid using blk_queue_max_hw_sectors() and set the max_sectors queue
> limit directly.
> 
> Also update the comment in blk_limits_max_hw_sectors() to clarify that
> max_hw_sectors defines the limit for the I/O controller only.
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> Reported-by: Brian King <brking@linux.vnet.ibm.com>
> Tested-by: Brian King <brking@linux.vnet.ibm.com>
> Cc: <stable@vger.kernel.org> # 3.17+
> ---
>  block/blk-settings.c | 4 ++--
>  drivers/scsi/sd.c    | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 12600bfffca9..e0057d035200 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -241,8 +241,8 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
>   * Description:
>   *    Enables a low level driver to set a hard upper limit,
>   *    max_hw_sectors, on the size of requests.  max_hw_sectors is set by
> - *    the device driver based upon the combined capabilities of I/O
> - *    controller and storage device.
> + *    the device driver based upon the capabilities of the I/O
> + *    controller.
>   *
>   *    max_sectors is a soft limit imposed by the block layer for
>   *    filesystem type requests.  This value can be overridden on a
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 3b2fcb4fada0..a20da8c25b4f 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2770,9 +2770,9 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	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);
> +	sdkp->disk->queue->limits.max_sectors =
> +		min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer);
> +
>  	set_capacity(disk, sdkp->capacity);
>  	sd_config_write_same(sdkp);
>  	kfree(buffer);
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

WARNING: multiple messages have this Message-ID (diff)
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] sd: Fix maximum I/O size for BLOCK_PC requests
Date: Thu, 16 Jul 2015 13:12:44 +0200	[thread overview]
Message-ID: <55A791AC.8010700@suse.de> (raw)
In-Reply-To: <1437009226-599-1-git-send-email-martin.petersen@oracle.com>

On 07/16/2015 03:13 AM, Martin K. Petersen wrote:
> Commit bcdb247c6b6a ("sd: Limit transfer length") clamped the maximum
> size of an I/O request to the MAXIMUM TRANSFER LENGTH field in the BLOCK
> LIMITS VPD. This had the unfortunate effect of also limiting the maximum
> size of non-filesystem requests sent to the device through sg/bsg.
> 
> Avoid using blk_queue_max_hw_sectors() and set the max_sectors queue
> limit directly.
> 
> Also update the comment in blk_limits_max_hw_sectors() to clarify that
> max_hw_sectors defines the limit for the I/O controller only.
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> Reported-by: Brian King <brking@linux.vnet.ibm.com>
> Tested-by: Brian King <brking@linux.vnet.ibm.com>
> Cc: <stable@vger.kernel.org> # 3.17+
> ---
>  block/blk-settings.c | 4 ++--
>  drivers/scsi/sd.c    | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 12600bfffca9..e0057d035200 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -241,8 +241,8 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
>   * Description:
>   *    Enables a low level driver to set a hard upper limit,
>   *    max_hw_sectors, on the size of requests.  max_hw_sectors is set by
> - *    the device driver based upon the combined capabilities of I/O
> - *    controller and storage device.
> + *    the device driver based upon the capabilities of the I/O
> + *    controller.
>   *
>   *    max_sectors is a soft limit imposed by the block layer for
>   *    filesystem type requests.  This value can be overridden on a
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 3b2fcb4fada0..a20da8c25b4f 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2770,9 +2770,9 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	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);
> +	sdkp->disk->queue->limits.max_sectors =
> +		min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer);
> +
>  	set_capacity(disk, sdkp->capacity);
>  	sd_config_write_same(sdkp);
>  	kfree(buffer);
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: F. Imend�rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N�rnberg)

  reply	other threads:[~2015-07-16 11:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 19:02 [PATCH 1/1] [PATCH] block: Add blk_max_rw_sectors limit Brian King
2015-06-16 22:46 ` Martin K. Petersen
2015-06-17 10:33   ` Christoph Hellwig
2015-06-17 13:26   ` Brian King
2015-06-23 16:13     ` [PATCH] sd: Fix maximum I/O size for BLOCK_PC requests Martin K. Petersen
2015-06-24 12:10       ` Christoph Hellwig
2015-07-16  1:13     ` Martin K. Petersen
2015-07-16  1:13       ` Martin K. Petersen
2015-07-16 11:12       ` Hannes Reinecke [this message]
2015-07-16 11:12         ` Hannes Reinecke

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=55A791AC.8010700@suse.de \
    --to=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@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 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.