From: Long Li <longli@microsoft.com>
To: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Long Li <longli@microsoft.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] sd: remove redundant check for BLK_DEF_MAX_SECTORS
Date: Fri, 3 Jun 2016 20:57:58 -0700 [thread overview]
Message-ID: <1465012678-32547-1-git-send-email-longli@microsoft.com> (raw)
q->limits.max_sectors is already checked against BLK_DEF_MAX_SECTORS in __scsi_alloc_queue(), when it calls blk_queue_max_hw_sectors(). There is no need to check it again in sd.
This change also allows a SCSI driver set an maximum sector size bigger than BLK_DEF_MAX_SECTORS, without returning values on optional VPD page 0xb0 "Block Limits".
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/scsi/sd.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 60bff78..d8c4047 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2870,11 +2870,8 @@ 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
- rw_max = BLK_DEF_MAX_SECTORS;
-
- /* Combine with controller limits */
- q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));
+ q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));
+ }
set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity));
sd_config_write_same(sdkp);
--
2.7.4
next reply other threads:[~2016-06-04 3:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-04 3:57 Long Li [this message]
2016-06-04 8:41 ` [PATCH] sd: remove redundant check for BLK_DEF_MAX_SECTORS Tom Yan
2016-06-04 15:18 ` Long Li
2016-06-05 5:16 ` Tom Yan
2016-06-07 3:42 ` Martin K. Petersen
2016-06-08 4:22 ` Long Li
2016-06-09 3:29 ` 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=1465012678-32547-1-git-send-email-longli@microsoft.com \
--to=longli@microsoft.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).