diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index ac695b336a98..4cd525ee5f4a 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -513,35 +513,6 @@ static void nvme_submit_flush(struct nvme_queue *nvmeq, struct nvme_ns *ns, writel(nvmeq->sq_tail, nvmeq->q_db); } -static int nvme_submit_flush_sync(struct nvme_queue *nvmeq, struct nvme_ns *ns) -{ - struct request *req; - struct nvme_command cmnd; - - req = blk_mq_alloc_request(ns->queue, WRITE, GFP_KERNEL, false); - if (!req) - return -ENOMEM; - - nvme_setup_flush(&cmnd, ns, req->tag); - nvme_submit_sync_cmd(req, &cmnd, NULL, NVME_IO_TIMEOUT); - - return 0; -} - -struct flush_cmd_info { - struct nvme_ns *ns; - struct nvme_iod *iod; -}; - -static void req_flush_completion(struct nvme_queue *nvmeq, void *ctx, - struct nvme_completion *cqe) -{ - struct flush_cmd_info *flush_cmd = ctx; - nvme_submit_flush_sync(nvmeq, flush_cmd->ns); - req_completion(nvmeq, flush_cmd->iod, cqe); - kfree(flush_cmd); -} - static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod, struct nvme_ns *ns) { @@ -560,7 +531,7 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod, nvme_submit_discard(nvmeq, ns, req, iod); goto end_submit; } - if (req->cmd_flags & REQ_FLUSH && !iod->nents) { + if (req->cmd_flags & REQ_FLUSH) { nvme_submit_flush(nvmeq, ns, req->tag); goto end_submit; } @@ -615,16 +586,6 @@ static int nvme_submit_req_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, nvme_set_info(cmd, iod, req_completion); - if ((req->cmd_flags & REQ_FLUSH) && psegs) { - struct flush_cmd_info *flush_cmd = kmalloc( - sizeof(struct flush_cmd_info), GFP_KERNEL); - if (!flush_cmd) - goto free_iod; - flush_cmd->ns = ns; - flush_cmd->iod = iod; - nvme_set_info(cmd, flush_cmd, req_flush_completion); - } - if (req->cmd_flags & REQ_DISCARD) { void *range; /* @@ -655,7 +616,6 @@ static int nvme_submit_req_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, finish_cmd: nvme_finish_cmd(nvmeq, req->tag, NULL); - free_iod: nvme_free_iod(nvmeq->dev, iod); return BLK_MQ_RQ_QUEUE_ERROR; }