From: Hannes Reinecke <hare@kernel.org>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@kernel.org>,
Martin Wilck <martin.wilck@suse.com>
Subject: [PATCH] scsi_lib: Align max_sectors to kb
Date: Thu, 18 Apr 2024 09:00:15 +0200 [thread overview]
Message-ID: <20240418070015.27781-1-hare@kernel.org> (raw)
max_sectors can be modified via sysfs, but only in kb units.
Which leads to a misalignment on stacked devices if the original
max_sector size is an odd number. So align the max_sectors setting
to kb to avoid this issue.
Reported-by: Martin Wilck <martin.wilck@suse.com>
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
drivers/scsi/scsi_lib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2e28e2360c85..aad2ac1353d1 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1983,7 +1983,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
blk_queue_max_integrity_segments(q, shost->sg_prot_tablesize);
}
- blk_queue_max_hw_sectors(q, shost->max_sectors);
+ /* Align to kb to avoid conflicts with Sysfs settings */
+ blk_queue_max_hw_sectors(q, shost->max_sectors & ~0x1);
blk_queue_segment_boundary(q, shost->dma_boundary);
dma_set_seg_boundary(dev, shost->dma_boundary);
--
2.35.3
next reply other threads:[~2024-04-18 7:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 7:00 Hannes Reinecke [this message]
2024-04-18 7:03 ` [PATCH] scsi_lib: Align max_sectors to kb Christoph Hellwig
2024-04-18 7:42 ` Hannes Reinecke
2024-04-18 9:00 ` Martin Wilck
2024-04-18 14:51 ` Christoph Hellwig
2024-04-18 16:46 ` Martin Wilck
2024-04-19 6:20 ` Christoph Hellwig
2024-04-19 8:27 ` Martin Wilck
2024-04-22 7:28 ` Christoph Hellwig
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=20240418070015.27781-1-hare@kernel.org \
--to=hare@kernel.org \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=martin.wilck@suse.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 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.