* [PATCH] nvme: Check hw sectors before setting chunk sectors
@ 2017-12-14 18:20 Keith Busch
2017-12-15 3:45 ` Martin K. Petersen
2017-12-20 19:05 ` Sagi Grimberg
0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2017-12-14 18:20 UTC (permalink / raw)
Some devices with IDs matching the "stripe" quirk don't actually have
this quirk, and don't have an MDTS value. When MDTS is not set, the
driver sets the max sectors to UINT_MAX, which is not a power of 2,
hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips setting
chunk sectors for such devices.
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/nvme/host/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f837d666cbd4..9831a592bbb9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1705,7 +1705,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
}
- if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE)
+ if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE &&
+ is_power_of_2(ctrl->max_hw_sectors))
blk_queue_chunk_sectors(q, ctrl->max_hw_sectors);
blk_queue_virt_boundary(q, ctrl->page_size - 1);
if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] nvme: Check hw sectors before setting chunk sectors
2017-12-14 18:20 [PATCH] nvme: Check hw sectors before setting chunk sectors Keith Busch
@ 2017-12-15 3:45 ` Martin K. Petersen
2017-12-20 19:05 ` Sagi Grimberg
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-12-15 3:45 UTC (permalink / raw)
Keith,
> Some devices with IDs matching the "stripe" quirk don't actually have
> this quirk, and don't have an MDTS value. When MDTS is not set, the
> driver sets the max sectors to UINT_MAX, which is not a power of 2,
> hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips
> setting chunk sectors for such devices.
Reviewed-by: Martin K. Petersen <martin.petersen at oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] nvme: Check hw sectors before setting chunk sectors
2017-12-14 18:20 [PATCH] nvme: Check hw sectors before setting chunk sectors Keith Busch
2017-12-15 3:45 ` Martin K. Petersen
@ 2017-12-20 19:05 ` Sagi Grimberg
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2017-12-20 19:05 UTC (permalink / raw)
Reviewed-by: Sagi Grimberg<sagi at grimberg.me>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-20 19:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14 18:20 [PATCH] nvme: Check hw sectors before setting chunk sectors Keith Busch
2017-12-15 3:45 ` Martin K. Petersen
2017-12-20 19:05 ` Sagi Grimberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox