Skip to content

Commit

Permalink
Revert "nvme: add support for the Write Zeroes command"
Browse files Browse the repository at this point in the history
This reverts commit 6d31e3b.

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>
  • Loading branch information
Linus Torvalds committed Dec 14, 2016
1 parent f4000cd commit cdb98c2
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,6 @@ static inline int nvme_setup_discard(struct nvme_ns *ns, struct request *req,
return BLK_MQ_RQ_QUEUE_OK;
}

static inline void nvme_setup_write_zeroes(struct nvme_ns *ns,
struct request *req, struct nvme_command *cmnd)
{
struct nvme_write_zeroes_cmd *write_zeroes = &cmnd->write_zeroes;

memset(cmnd, 0, sizeof(*cmnd));
write_zeroes->opcode = nvme_cmd_write_zeroes;
write_zeroes->nsid = cpu_to_le32(ns->ns_id);
write_zeroes->slba =
cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
write_zeroes->length =
cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
write_zeroes->control = 0;
}

static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
struct nvme_command *cmnd)
{
Expand Down Expand Up @@ -330,8 +315,6 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
nvme_setup_flush(ns, cmd);
else if (req_op(req) == REQ_OP_DISCARD)
ret = nvme_setup_discard(ns, req, cmd);
else if (req_op(req) == REQ_OP_WRITE_ZEROES)
nvme_setup_write_zeroes(ns, req, cmd);
else
nvme_setup_rw(ns, req, cmd);

Expand Down Expand Up @@ -952,10 +935,6 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)

if (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM)
nvme_config_discard(ns);
if (ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES)
blk_queue_max_write_zeroes_sectors(ns->queue,
((u32)(USHRT_MAX + 1) * bs) >> 9);

blk_mq_unfreeze_queue(disk->queue);
}

Expand Down

0 comments on commit cdb98c2

Please sign in to comment.