Skip to contentSkip to conversation

fix discard and write zeroes configureation for multipath devices

PATCH New Christoph Hellwig 4 participants 11 messages Mar 12, 2019 NVMe

lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

Hi all,

this series is based on earlier patches from Sagi and fixes up nvme_update_disk_info so that we properly configure discard and write zeroes for the multipath device node.

author maintainer
#1 lore raw

PATCH 1/3 nvme: remove nvme_ns_config_oncs

Just opencode the two function calls in the caller.

Signed-off-by Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/core.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/nvme/host/core.c +3 -7
index 844cf84105b0..724ac6075901 100644
@@ -1552,12 +1552,6 @@ static inline void nvme_config_write_zeroes(struct nvme_ns *ns)
 	blk_queue_max_write_zeroes_sectors(ns->queue, max_sectors);
 }
 
-static inline void nvme_ns_config_oncs(struct nvme_ns *ns)
-{
-	nvme_config_discard(ns);
-	nvme_config_write_zeroes(ns);
-}
-
 static void nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
 		struct nvme_id_ns *id, struct nvme_ns_ids *ids)
 {
@@ -1620,7 +1614,9 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	}
 
 	set_capacity(disk, capacity);
-	nvme_ns_config_oncs(ns);
+
+	nvme_config_discard(ns);
+	nvme_config_write_zeroes(ns);
 
 	if (id->nsattr & (1 << 0))
 		set_disk_ro(disk, true);
Signature · 1 line
2.20.1
maintainer
#2 lore raw

PATCH 1/3 nvme: remove nvme_ns_config_oncs

Quoted 1 line · Christoph Hellwig

Just opencode the two function calls in the caller.

Looks good.

Reviewed-by Keith Busch <keith.busch at intel.com>
author maintainer
#4 lore raw

PATCH 2/3 nvme: add proper discard setup for the multipath device

In reply to Christoph Hellwig

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 <hch at lst.de>
Reported-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
index 724ac6075901..b3c13a486423 100644
@@ -1495,10 +1495,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)) {
@@ -1615,7 +1615,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
 
 	set_capacity(disk, capacity);
 
-	nvme_config_discard(ns);
+	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(ns);
 
 	if (id->nsattr & (1 << 0))
Signature · 1 line
2.20.1
maintainer
#5 lore raw

PATCH 2/3 nvme: add proper discard setup for the multipath device

Quoted 3 lines · Christoph Hellwig

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.

Looks good.

Reviewed-by Keith Busch <keith.busch at intel.com>
author maintainer
#7 lore raw

PATCH 3/3 nvme: add proper write zeroes setup for the multipath device

In reply to Christoph Hellwig

Add a gendisk argument to nvme_config_write_zeroes so that the call to nvme_update_disk_info for the multipath device node updates the proper request_queue.

Signed-off-by Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
index b3c13a486423..5791e2ca2d2e 100644
@@ -1526,7 +1526,7 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
 		blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);
 }
 
-static inline void nvme_config_write_zeroes(struct nvme_ns *ns)
+static void nvme_config_write_zeroes(struct gendisk *disk, struct nvme_ns *ns)
 {
 	u32 max_sectors;
 	unsigned short bs = 1 << ns->lba_shift;
@@ -1549,7 +1549,7 @@ static inline void nvme_config_write_zeroes(struct nvme_ns *ns)
 	else
 		max_sectors = ((u32)(ns->ctrl->max_hw_sectors + 1) * bs) >> 9;
 
-	blk_queue_max_write_zeroes_sectors(ns->queue, max_sectors);
+	blk_queue_max_write_zeroes_sectors(disk->queue, max_sectors);
 }
 
 static void nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
@@ -1616,7 +1616,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	set_capacity(disk, capacity);
 
 	nvme_config_discard(disk, ns);
-	nvme_config_write_zeroes(ns);
+	nvme_config_write_zeroes(disk, ns);
 
 	if (id->nsattr & (1 << 0))
 		set_disk_ro(disk, true);
Signature · 1 line
2.20.1
maintainer
#8 lore raw

PATCH 3/3 nvme: add proper write zeroes setup for the multipath device

Quoted 3 lines · Christoph Hellwig

Add a gendisk argument to nvme_config_write_zeroes so that the call to nvme_update_disk_info for the multipath device node updates the proper request_queue.

Looks good.

Reviewed-by Keith Busch <keith.busch at intel.com>
Reviewed-by
#10 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

Hi all,

this series is based on earlier patches from Sagi and fixes up nvme_update_disk_info so that we properly configure discard and write zeroes for the multipath device node.

all this series looks good,

Reviewed-by Max Gurtovoy <maxg at mellanox.com>