fix discard and write zeroes configureation for multipath devices
Christoph Hellwig
maintainerHi 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.
Christoph Hellwig
maintainerPATCH 1/3 nvme: remove nvme_ns_config_oncs
Just opencode the two function calls in the caller.
--- drivers/nvme/host/core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/nvme/host/core.c +3 -7
@@ -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
Keith Busch
maintainerPATCH 1/3 nvme: remove nvme_ns_config_oncs
Quoted 1 line · Christoph Hellwig
Just opencode the two function calls in the caller.
Looks good.
Sagi Grimberg
maintainerPATCH 1/3 nvme: remove nvme_ns_config_oncs
In reply to Christoph HellwigChristoph Hellwig
maintainerPATCH 2/3 nvme: add proper discard setup for the multipath device
In reply to Christoph HellwigAdd 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.
--- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
@@ -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
Keith Busch
maintainerPATCH 2/3 nvme: add proper discard setup for the multipath device
Quoted 3 lines · Christoph Hellwig
Add a gendisk argument to
nvme_config_discardso that the call tonvme_update_disk_infofor the multipath device node updates the properrequest_queue.
Looks good.
Sagi Grimberg
maintainerPATCH 2/3 nvme: add proper discard setup for the multipath device
In reply to Christoph HellwigChristoph Hellwig
maintainerPATCH 3/3 nvme: add proper write zeroes setup for the multipath device
In reply to Christoph HellwigAdd 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.
--- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
@@ -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
Keith Busch
maintainerPATCH 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_zeroesso that the call tonvme_update_disk_infofor the multipath device node updates the properrequest_queue.
Looks good.
Sagi Grimberg
maintainerPATCH 3/3 nvme: add proper write zeroes setup for the multipath device
In reply to Christoph HellwigMax Gurtovoy
Reviewed-byQuoted 5 lines · Christoph Hellwig
Hi all,
this series is based on earlier patches from Sagi and fixes up
nvme_update_disk_infoso that we properly configure discard and write zeroes for the multipath device node.
all this series looks good,