From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: tom.ty89@gmail.com
Cc: tj@kernel.org, martin.petersen@oracle.com,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-block@vger.kernel.org
Subject: Re: [PATCH v2 2/2] sd: check BLK_DEF_MAX_SECTORS against max_dev_sectors
Date: Fri, 12 Aug 2016 17:37:36 -0400 [thread overview]
Message-ID: <yq11t1tmzxb.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <974f3a0aa9e82caf067353fd7d7119c07d7e98c1.1471011949.git.tom.ty89@gmail.com> (tom's message of "Fri, 12 Aug 2016 22:27:04 +0800")
>>>>> "Tom" == tom ty89 <tom.ty89@gmail.com> writes:
Tom,
Tom> The SCSI disk driver sets max_sectors to BLK_DEF_MAX_SECTORS when
Tom> the device does not report Optimal Transfer Length. However, it
Tom> checks only whether it is smaller than max_hw_sectors, but not
Tom> max_dev_sectors.
It would be pretty unusual for a device that is smart enough to report a
transfer length limit to be constrained to 1 MB and change.
@@ -2875,8 +2875,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) {
q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
- } else
+ } else {
rw_max = BLK_DEF_MAX_SECTORS;
+ /* Combine with device limits */
+ rw_max = min(rw_max, q->limits.max_dev_sectors);
+ }
/* Combine with controller limits */
q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));
If you want to fix this please drop the braces and do:
rw_max = min(BLK_DEF_MAX_SECTORS, q->limits.max_dev_sectors);
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2016-08-12 21:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 14:27 [PATCH v2 1/2] libata-scsi: use dev->max_sectors from libata-core appropriately tom.ty89
2016-08-12 14:27 ` [PATCH v2 2/2] sd: check BLK_DEF_MAX_SECTORS against max_dev_sectors tom.ty89
2016-08-12 21:37 ` Martin K. Petersen [this message]
2016-08-14 9:00 ` Tom Yan
2016-08-14 9:40 ` Tom Yan
2016-08-16 4:10 ` Martin K. Petersen
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=yq11t1tmzxb.fsf@sermon.lab.mkp.net \
--to=martin.petersen@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=tj@kernel.org \
--cc=tom.ty89@gmail.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