From: Tom Yan <tom.ty89@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: Tom Yan <tom.ty89@gmail.com>
Subject: [PATCH 1/2] scsi: sg: use queue_logical_block_size() in max_sectors_bytes()
Date: Wed, 23 Sep 2020 13:52:47 +0800 [thread overview]
Message-ID: <20200923055248.1901-1-tom.ty89@gmail.com> (raw)
Logical block size was never / is no longer necessarily 512.
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
---
drivers/scsi/sg.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 20472aaaf630..8a2cca71017f 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -848,10 +848,11 @@ static int srp_done(Sg_fd *sfp, Sg_request *srp)
static int max_sectors_bytes(struct request_queue *q)
{
unsigned int max_sectors = queue_max_sectors(q);
+ max_sectors *= queue_logical_block_size(q);
- max_sectors = min_t(unsigned int, max_sectors, INT_MAX >> 9);
+ max_sectors = min_t(unsigned int, max_sectors, INT_MAX);
- return max_sectors << 9;
+ return max_sectors;
}
static void
--
2.28.0
next reply other threads:[~2020-09-23 5:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 5:52 Tom Yan [this message]
2020-09-23 5:52 ` [PATCH 2/2] block/scsi_ioctl.c: use queue_logical_block_size() in max_sectors_bytes() Tom Yan
2020-09-24 17:52 ` [PATCH 1/2] scsi: sg: " Bart Van Assche
2020-09-28 1:44 ` Tom Yan
-- strict thread matches above, loose matches on Subject: below --
2020-09-17 16:00 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=20200923055248.1901-1-tom.ty89@gmail.com \
--to=tom.ty89@gmail.com \
--cc=linux-scsi@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.