aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 22:53:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 22:53:37 -0500
commitcdb98c2698b4af287925abcba4d77d92af82a0c3 (patch)
treec8a7a0a4897521bcfb55b16b8146fafdcf5a99c3
parentf4000cd99750065d5177555c0a805c97174d1b9f (diff)
Revert "nvme: add support for the Write Zeroes command"
This reverts commit 6d31e3ba232ea22458b2f36b6d3f2f9f11bf3fa4. This causes bootup problems for me both on my laptop and my desktop. What they have in common is that they have NVMe disks with dm-crypt, but it's not the same controller, so it's not controller-specific. Jens does not see it on his machine (also NVMe), so it's presumably something that triggers just on bootup. Possibly related to dm-crypt and the fact that I mark my luks volume with "allow-discards" in /etc/crypttab. It's 100% repeatable for me, which made it fairly straightforward to bisect the problem to this commit. Small mercies. So we don't know what the reason is yet, but the revert is needed to get things going again. Acked-by: Jens Axboe <axboe@fb.com> Cc: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/nvme/host/core.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 35b3fee5a453..b40cfb076f02 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -263,21 +263,6 @@ static inline int nvme_setup_discard(struct nvme_ns *ns, struct request *req,
263 return BLK_MQ_RQ_QUEUE_OK; 263 return BLK_MQ_RQ_QUEUE_OK;
264} 264}
265 265
266static inline void nvme_setup_write_zeroes(struct nvme_ns *ns,
267 struct request *req, struct nvme_command *cmnd)
268{
269 struct nvme_write_zeroes_cmd *write_zeroes = &cmnd->write_zeroes;
270
271 memset(cmnd, 0, sizeof(*cmnd));
272 write_zeroes->opcode = nvme_cmd_write_zeroes;
273 write_zeroes->nsid = cpu_to_le32(ns->ns_id);
274 write_zeroes->slba =
275 cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
276 write_zeroes->length =
277 cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
278 write_zeroes->control = 0;
279}
280
281static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req, 266static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
282 struct nvme_command *cmnd) 267 struct nvme_command *cmnd)
283{ 268{
@@ -330,8 +315,6 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
330 nvme_setup_flush(ns, cmd); 315 nvme_setup_flush(ns, cmd);
331 else if (req_op(req) == REQ_OP_DISCARD) 316 else if (req_op(req) == REQ_OP_DISCARD)
332 ret = nvme_setup_discard(ns, req, cmd); 317 ret = nvme_setup_discard(ns, req, cmd);
333 else if (req_op(req) == REQ_OP_WRITE_ZEROES)
334 nvme_setup_write_zeroes(ns, req, cmd);
335 else 318 else
336 nvme_setup_rw(ns, req, cmd); 319 nvme_setup_rw(ns, req, cmd);
337 320
@@ -952,10 +935,6 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
952 935
953 if (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM) 936 if (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM)
954 nvme_config_discard(ns); 937 nvme_config_discard(ns);
955 if (ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES)
956 blk_queue_max_write_zeroes_sectors(ns->queue,
957 ((u32)(USHRT_MAX + 1) * bs) >> 9);
958
959 blk_mq_unfreeze_queue(disk->queue); 938 blk_mq_unfreeze_queue(disk->queue);
960} 939}
961 940