summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-03-04 15:04:53 +0100
committerKeith Busch <kbusch@kernel.org>2024-03-04 17:24:56 +0100
commitd60c23e4552b04fda600c6a8681dfe57b3ee2bd8 (patch)
tree42d180042b1c4d8684725d38d255845258ab2c10 /drivers/nvme/host
parentnvme: move a few things out of nvme_update_disk_info (diff)
downloadlinux-d60c23e4552b04fda600c6a8681dfe57b3ee2bd8.tar.xz
linux-d60c23e4552b04fda600c6a8681dfe57b3ee2bd8.zip
nvme: move setting the write cache flags out of nvme_set_queue_limits
nvme_set_queue_limits is used on the admin queue and all gendisks including hidden ones that don't support block I/O. The write cache setting on the other hand only makes sense for block I/O. Move the blk_queue_write_cache call to nvme_update_ns_info_block instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers/nvme/host')
-rw-r--r--drivers/nvme/host/core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 63c2b581f785..ce70bfb66242 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1954,15 +1954,12 @@ static u32 nvme_max_drv_segments(struct nvme_ctrl *ctrl)
static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
struct request_queue *q)
{
- bool vwc = ctrl->vwc & NVME_CTRL_VWC_PRESENT;
-
blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
blk_queue_max_segments(q, min_t(u32, USHRT_MAX,
min_not_zero(nvme_max_drv_segments(ctrl), ctrl->max_segments)));
blk_queue_max_integrity_segments(q, ctrl->max_integrity_segments);
blk_queue_virt_boundary(q, NVME_CTRL_PAGE_SIZE - 1);
blk_queue_dma_alignment(q, 3);
- blk_queue_write_cache(q, vwc, vwc);
}
static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id)
@@ -2093,6 +2090,7 @@ static int nvme_update_ns_info_generic(struct nvme_ns *ns,
static int nvme_update_ns_info_block(struct nvme_ns *ns,
struct nvme_ns_info *info)
{
+ bool vwc = ns->ctrl->vwc & NVME_CTRL_VWC_PRESENT;
struct nvme_id_ns *id;
sector_t capacity;
unsigned lbaf;
@@ -2154,6 +2152,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
if ((id->dlfeat & 0x7) == 0x1 && (id->dlfeat & (1 << 3)))
ns->head->features |= NVME_NS_DEAC;
set_disk_ro(ns->disk, nvme_ns_is_readonly(ns, info));
+ blk_queue_write_cache(ns->disk->queue, vwc, vwc);
set_bit(NVME_NS_READY, &ns->flags);
blk_mq_unfreeze_queue(ns->disk->queue);