* [PATCH] multipath: set discard and norot queue flags on the multipath stacking device
@ 2019-02-26 22:55 Sagi Grimberg
2019-03-08 13:41 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Sagi Grimberg @ 2019-02-26 22:55 UTC (permalink / raw)
If the underlying device supports discard we set it and clear it otherwise.
Without this blkdiscard doesn't work on a multipath device node.
Also while we're at it, unconditionally set non rotational queue flag to
make schedulers do the right thing.
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
drivers/nvme/host/core.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d29ff9b910d9..7321da21f8c9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1561,9 +1561,13 @@ 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)
+static inline void nvme_ns_config_oncs(struct gendisk *disk, struct nvme_ns *ns)
{
nvme_config_discard(ns);
+ if (blk_queue_discard(ns->queue))
+ blk_queue_flag_set(QUEUE_FLAG_DISCARD, disk->queue);
+ else
+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, disk->queue);
nvme_config_write_zeroes(ns);
}
@@ -1612,6 +1616,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
blk_queue_logical_block_size(disk->queue, bs);
blk_queue_physical_block_size(disk->queue, bs);
blk_queue_io_min(disk->queue, bs);
+ blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
if (ns->ms && !ns->ext &&
(ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
@@ -1620,7 +1625,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
capacity = 0;
set_capacity(disk, capacity);
- nvme_ns_config_oncs(ns);
+ nvme_ns_config_oncs(disk, ns);
if (id->nsattr & (1 << 0))
set_disk_ro(disk, true);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] multipath: set discard and norot queue flags on the multipath stacking device
2019-02-26 22:55 [PATCH] multipath: set discard and norot queue flags on the multipath stacking device Sagi Grimberg
@ 2019-03-08 13:41 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2019-03-08 13:41 UTC (permalink / raw)
On Tue, Feb 26, 2019@02:55:50PM -0800, Sagi Grimberg wrote:
> If the underlying device supports discard we set it and clear it otherwise.
> Without this blkdiscard doesn't work on a multipath device node.
>
> Also while we're at it, unconditionally set non rotational queue flag to
> make schedulers do the right thing.
QUEUE_FLAG_NONROT is already set by nvme_mpath_alloc_disk.
For discard don't we also need to the limits? Also what about
Write Zeroes?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-08 13:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-26 22:55 [PATCH] multipath: set discard and norot queue flags on the multipath stacking device Sagi Grimberg
2019-03-08 13:41 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox