From 92a59d877741f15ba34ffc12e306dbe337d038e6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 14 Dec 2021 19:20:06 +0800 Subject: [PATCH] nvme: add proper discard setup for the multipath device mainline inclusion from mainline-v5.1-rc1 commit 2631857160ecbea04e54423f5053133fe2b6ea45 category: bugfix bugzilla: NA CVE: NA Link: https://gitee.com/openeuler/kernel/issues/I4JFBE?from=project-issue ------------------------------------------------- Add a gendisk argument to nvme_config_discard so that the call to nvme_update_disk_info for the multipath device node updates the proper request_queue. Signed-off-by: Christoph Hellwig Reported-by: Sagi Grimberg Reviewed-by: Keith Busch Reviewed-by: Max Gurtovoy Tested-by: Sagi Grimberg Signed-off-by: Jens Axboe conflicts: drivers/nvme/host/core.c [adjust context] Signed-off-by: chengjike Reviewed-by: Ao Sun Reviewed-by: Zhenwei Yang Reviewed-by: Hou Tao Signed-off-by: Yang Yingliang --- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 522ab9c0133c..7c4a97e2cd93 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1558,10 +1558,10 @@ static void nvme_set_chunk_size(struct nvme_ns *ns) blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(chunk_size)); } -static void nvme_config_discard(struct nvme_ns *ns) +static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns) { struct nvme_ctrl *ctrl = ns->ctrl; - struct request_queue *queue = ns->queue; + struct request_queue *queue = disk->queue; u32 size = queue_logical_block_size(queue); if (!(ctrl->oncs & NVME_CTRL_ONCS_DSM)) { @@ -1647,7 +1647,7 @@ static void nvme_update_disk_info(struct gendisk *disk, capacity = 0; set_capacity(disk, capacity); - nvme_config_discard(ns); + nvme_config_discard(disk, ns); if (id->nsattr & (1 << 0)) set_disk_ro(disk, true); -- GitLab