From: Douglas Gilbert <dgilbert@interlog.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 2/3] sd: Reject optimal transfer length smaller than page size
Date: Wed, 16 Dec 2015 19:55:10 -0500 [thread overview]
Message-ID: <567207EE.5050508@interlog.com> (raw)
In-Reply-To: <1450306433-20166-2-git-send-email-martin.petersen@oracle.com>
On 15-12-16 05:53 PM, Martin K. Petersen wrote:
> Eryu Guan reported that loading scsi_debug would fail. This turned out
> to be caused by scsi_debug reporting an optimal I/O size of 32KB which
> is smaller than the 64KB page size on the PowerPC system in question.
>
> Add a check to ensure that we only use the device-reported OPTIMAL
> TRANSFER LENGTH if it is bigger than or equal to the page cache size.
>
> Reported-by: Eryu Guan <guaneryu@gmail.com>
> Reported-by: Ming Lei <tom.leiming@gmail.com>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
> drivers/scsi/sd.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 3d22fc3e3c1a..4e08d1cd704d 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk)
>
> /*
> * Use the device's preferred I/O size for reads and writes
> - * unless the reported value is unreasonably large (or garbage).
> + * unless the reported value is unreasonably small, large, or
> + * garbage.
> */
> - if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
> - sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
> + if (sdkp->opt_xfer_blocks &&
> + sdkp->opt_xfer_blocks <= dev_max &&
> + sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> + sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
> rw_max = q->limits.io_opt =
> logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
> else
>
and following that 'else' is:
rw_max = BLK_DEF_MAX_SECTORS;
and blkdev.h says:
enum blk_default_limits {
BLK_MAX_SEGMENTS = 128,
BLK_SAFE_MAX_SECTORS = 255,
BLK_DEF_MAX_SECTORS = 2560,
BLK_MAX_SEGMENT_SIZE = 65536,
BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
};
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
next prev parent reply other threads:[~2015-12-17 0:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 22:53 [PATCH 1/3] scsi_debug: Increase the reported optimal transfer length Martin K. Petersen
2015-12-16 22:53 ` [PATCH 2/3] sd: Reject optimal transfer length smaller than page size Martin K. Petersen
2015-12-17 0:55 ` Douglas Gilbert [this message]
2015-12-17 13:19 ` Ewan Milne
2015-12-16 22:53 ` [PATCH 3/3] block: Export max_dev_sectors_kb in sysfs Martin K. Petersen
2015-12-17 4:03 ` Elliott, Robert (Persistent Memory)
2015-12-17 13:27 ` Ewan Milne
2015-12-16 23:14 ` [PATCH 1/3] scsi_debug: Increase the reported optimal transfer length Douglas Gilbert
2015-12-17 13:18 ` Ewan Milne
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=567207EE.5050508@interlog.com \
--to=dgilbert@interlog.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox