* [PATCH-for-5.1] nvme: Use discard for quirked write zeroes devices
@ 2019-01-30 17:38 Keith Busch
2019-01-30 17:44 ` Christoph Hellwig
2019-01-31 20:44 ` Sagi Grimberg
0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2019-01-30 17:38 UTC (permalink / raw)
The current devices that set NVME_QUIRK_DEALLOCATE_ZEROES don't support
the Write Zeroes NVMe command, but the driver still sets the queue limit
that enables REQ_OP_WRITE_ZEROES. Continue using Data Set Management for
such quirked controllers instead of the preferred Write Zeroes command.
Cc: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/nvme/host/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bde341f16e50..c365f0aa9433 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -611,9 +611,12 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req,
return BLK_STS_OK;
}
-static inline void nvme_setup_write_zeroes(struct nvme_ns *ns,
+static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
struct request *req, struct nvme_command *cmnd)
{
+ if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
+ return nvme_setup_discard(ns, req, cmnd);
+
cmnd->write_zeroes.opcode = nvme_cmd_write_zeroes;
cmnd->write_zeroes.nsid = cpu_to_le32(ns->head->ns_id);
cmnd->write_zeroes.slba =
@@ -621,6 +624,7 @@ static inline void nvme_setup_write_zeroes(struct nvme_ns *ns,
cmnd->write_zeroes.length =
cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
cmnd->write_zeroes.control = 0;
+ return BLK_STS_OK;
}
static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
@@ -717,7 +721,7 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
nvme_setup_flush(ns, cmd);
break;
case REQ_OP_WRITE_ZEROES:
- nvme_setup_write_zeroes(ns, req, cmd);
+ ret = nvme_setup_write_zeroes(ns, req, cmd);
break;
case REQ_OP_DISCARD:
ret = nvme_setup_discard(ns, req, cmd);
--
2.14.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH-for-5.1] nvme: Use discard for quirked write zeroes devices
2019-01-30 17:38 [PATCH-for-5.1] nvme: Use discard for quirked write zeroes devices Keith Busch
@ 2019-01-30 17:44 ` Christoph Hellwig
2019-01-31 20:44 ` Sagi Grimberg
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-01-30 17:44 UTC (permalink / raw)
On Wed, Jan 30, 2019@10:38:22AM -0700, Keith Busch wrote:
> The current devices that set NVME_QUIRK_DEALLOCATE_ZEROES don't support
> the Write Zeroes NVMe command, but the driver still sets the queue limit
> that enables REQ_OP_WRITE_ZEROES. Continue using Data Set Management for
> such quirked controllers instead of the preferred Write Zeroes command.
>
> Cc: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
This looks sensible to me. We should probably fold this into
the original patch to avoid bisection issues.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH-for-5.1] nvme: Use discard for quirked write zeroes devices
2019-01-30 17:38 [PATCH-for-5.1] nvme: Use discard for quirked write zeroes devices Keith Busch
2019-01-30 17:44 ` Christoph Hellwig
@ 2019-01-31 20:44 ` Sagi Grimberg
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2019-01-31 20:44 UTC (permalink / raw)
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-31 20:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-30 17:38 [PATCH-for-5.1] nvme: Use discard for quirked write zeroes devices Keith Busch
2019-01-30 17:44 ` Christoph Hellwig
2019-01-31 20:44 ` Sagi Grimberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.