mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
block: fold cmd_type into the REQ_OP_ space
Instead of keeping two levels of indirection for requests types, fold it all into the operations. The little caveat here is that previously cmd_type only applied to struct request, while the request and bio op fields were set to plain REQ_OP_READ/WRITE even for passthrough operations. Instead this patch adds new REQ_OP_* for SCSI passthrough and driver private requests, althought it has to add two for each so that we can communicate the data in/out nature of the request. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
2f5a8e80f7
commit
aebf526b53
53 changed files with 338 additions and 326 deletions
|
|
@ -208,18 +208,18 @@ EXPORT_SYMBOL_GPL(nvme_requeue_req);
|
|||
struct request *nvme_alloc_request(struct request_queue *q,
|
||||
struct nvme_command *cmd, unsigned int flags, int qid)
|
||||
{
|
||||
unsigned op = nvme_is_write(cmd) ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN;
|
||||
struct request *req;
|
||||
|
||||
if (qid == NVME_QID_ANY) {
|
||||
req = blk_mq_alloc_request(q, nvme_is_write(cmd), flags);
|
||||
req = blk_mq_alloc_request(q, op, flags);
|
||||
} else {
|
||||
req = blk_mq_alloc_request_hctx(q, nvme_is_write(cmd), flags,
|
||||
req = blk_mq_alloc_request_hctx(q, op, flags,
|
||||
qid ? qid - 1 : 0);
|
||||
}
|
||||
if (IS_ERR(req))
|
||||
return req;
|
||||
|
||||
req->cmd_type = REQ_TYPE_DRV_PRIV;
|
||||
req->cmd_flags |= REQ_FAILFAST_DRIVER;
|
||||
nvme_req(req)->cmd = cmd;
|
||||
|
||||
|
|
@ -309,17 +309,27 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
|
|||
{
|
||||
int ret = BLK_MQ_RQ_QUEUE_OK;
|
||||
|
||||
if (req->cmd_type == REQ_TYPE_DRV_PRIV)
|
||||
switch (req_op(req)) {
|
||||
case REQ_OP_DRV_IN:
|
||||
case REQ_OP_DRV_OUT:
|
||||
memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd));
|
||||
else if (req_op(req) == REQ_OP_FLUSH)
|
||||
break;
|
||||
case REQ_OP_FLUSH:
|
||||
nvme_setup_flush(ns, cmd);
|
||||
else if (req_op(req) == REQ_OP_DISCARD)
|
||||
break;
|
||||
case REQ_OP_DISCARD:
|
||||
ret = nvme_setup_discard(ns, req, cmd);
|
||||
else
|
||||
break;
|
||||
case REQ_OP_READ:
|
||||
case REQ_OP_WRITE:
|
||||
nvme_setup_rw(ns, req, cmd);
|
||||
break;
|
||||
default:
|
||||
WARN_ON_ONCE(1);
|
||||
return BLK_MQ_RQ_QUEUE_ERROR;
|
||||
}
|
||||
|
||||
cmd->common.command_id = req->tag;
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nvme_setup_cmd);
|
||||
|
|
|
|||
|
|
@ -1471,7 +1471,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|||
ib_dma_sync_single_for_device(dev, sqe->dma,
|
||||
sizeof(struct nvme_command), DMA_TO_DEVICE);
|
||||
|
||||
if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH)
|
||||
if (req_op(rq) == REQ_OP_FLUSH)
|
||||
flush = true;
|
||||
ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge,
|
||||
req->mr->need_inval ? &req->reg_wr.wr : NULL, flush);
|
||||
|
|
|
|||
Loading…
Reference in a new issue