From: Tom Yan <tom.ty89@gmail.com>
To: linux-scsi@vger.kernel.org, dgilbert@interlog.com, bvanassche@acm.org
Cc: stern@rowland.harvard.edu.com, akinobu.mita@gmail.com,
hch@lst.de, linux-api@vger.kernel.org,
Tom Yan <tom.ty89@gmail.com>
Subject: [PATCH RESEND 4/4] block/scsi_ioctl.c: use queue_logical_sector_size() in max_sectors_bytes()
Date: Sun, 6 Sep 2020 09:25:12 +0800 [thread overview]
Message-ID: <20200906012512.1428-4-tom.ty89@gmail.com> (raw)
In-Reply-To: <20200906012512.1428-1-tom.ty89@gmail.com>
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
---
block/scsi_ioctl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index ef722f04f88a..ae6aae40a8b6 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -73,10 +73,11 @@ static int sg_set_timeout(struct request_queue *q, int __user *p)
static int max_sectors_bytes(struct request_queue *q)
{
unsigned int max_sectors = queue_max_sectors(q);
+ unsigned int logical_block_size = queue_logical_block_size(q);
- max_sectors = min_t(unsigned int, max_sectors, INT_MAX >> 9);
+ max_sectors = min_t(unsigned int, max_sectors, USHRT_MAX);
- return max_sectors << 9;
+ return max_sectors * logical_block_size;
}
static int sg_get_reserved_size(struct request_queue *q, int __user *p)
--
2.28.0
next prev parent reply other threads:[~2020-09-06 1:25 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 4:42 About BLKSECTGET in sg Tom Yan
2020-09-04 16:28 ` Douglas Gilbert
2020-09-04 19:21 ` Tom Yan
2020-09-04 20:05 ` [PATCH 1/4] scsi: sg: fix BLKSECTGET ioctl Tom Yan
2020-09-04 20:05 ` [PATCH 2/4] scsi: sg: implement BLKSSZGET Tom Yan
2020-09-05 18:37 ` Douglas Gilbert
2020-09-04 20:05 ` [PATCH 3/4] scsi: sg: use queue_logical_sector_size() in max_sectors_bytes() Tom Yan
2020-09-05 18:37 ` Douglas Gilbert
2020-09-04 20:05 ` [PATCH 4/4] block/scsi_ioctl.c: " Tom Yan
2020-09-05 18:37 ` Douglas Gilbert
2020-09-05 18:37 ` [PATCH 1/4] scsi: sg: fix BLKSECTGET ioctl Douglas Gilbert
2020-09-05 19:32 ` Bart Van Assche
2020-09-05 20:36 ` Douglas Gilbert
2020-09-06 1:19 ` Tom Yan
2020-09-06 1:25 ` [PATCH RESEND " Tom Yan
2020-09-06 1:25 ` [PATCH RESEND 2/4] scsi: sg: implement BLKSSZGET Tom Yan
2020-09-06 1:25 ` [PATCH RESEND 3/4] scsi: sg: use queue_logical_sector_size() in max_sectors_bytes() Tom Yan
2020-09-06 1:25 ` Tom Yan [this message]
2020-09-06 1:27 ` [PATCH RESEND 1/4] scsi: sg: fix BLKSECTGET ioctl Tom Yan
2020-09-06 1:27 ` [PATCH RESEND 2/4] scsi: sg: implement BLKSSZGET Tom Yan
2020-09-07 6:09 ` Christoph Hellwig
2020-09-07 9:01 ` Tom Yan
2020-09-08 8:42 ` Christoph Hellwig
2020-09-10 1:59 ` Tom Yan
2020-09-10 5:28 ` Christoph Hellwig
2020-09-11 2:52 ` Tom Yan
2020-09-11 6:48 ` Christoph Hellwig
2020-09-11 17:52 ` Douglas Gilbert
2020-09-11 21:33 ` Alan Stern
2020-09-16 5:47 ` Tom Yan
2020-09-06 1:27 ` [PATCH RESEND 3/4] scsi: sg: use queue_logical_sector_size() in max_sectors_bytes() Tom Yan
2020-09-06 6:26 ` Greg KH
2020-09-06 7:01 ` Tom Yan
2020-09-06 7:40 ` [PATCH v2 1/4] scsi: sg: fix BLKSECTGET ioctl Tom Yan
2020-09-06 7:40 ` [PATCH v2 2/4] scsi: sg: implement BLKSSZGET Tom Yan
2020-09-06 7:40 ` [PATCH v2 3/4] scsi: sg: use queue_logical_sector_size() in max_sectors_bytes() Tom Yan
2020-09-06 7:40 ` [PATCH v2 4/4] block/scsi_ioctl.c: " Tom Yan
2020-09-06 7:51 ` [PATCH v3 1/4] scsi: sg: fix BLKSECTGET ioctl Tom Yan
2020-09-06 7:51 ` [PATCH v3 2/4] scsi: sg: implement BLKSSZGET Tom Yan
2020-09-06 7:51 ` [PATCH v3 3/4] scsi: sg: use queue_logical_sector_size() in max_sectors_bytes() Tom Yan
2020-09-06 7:51 ` [PATCH v3 4/4] block/scsi_ioctl.c: " Tom Yan
2020-09-06 1:27 ` [PATCH RESEND " Tom Yan
2020-09-06 5:09 ` [PATCH 1/4] scsi: sg: fix BLKSECTGET ioctl Douglas Gilbert
2020-09-06 7:16 ` Tom Yan
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=20200906012512.1428-4-tom.ty89@gmail.com \
--to=tom.ty89@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=bvanassche@acm.org \
--cc=dgilbert@interlog.com \
--cc=hch@lst.de \
--cc=linux-api@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=stern@rowland.harvard.edu.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).