Commit f5b7b559 authored by Sagi Grimberg's avatar Sagi Grimberg

nvme-rdma: Get rid of duplicate variable

We already have need_inval in ib_mr, lets use
that instead.
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent aa719874
...@@ -77,7 +77,6 @@ struct nvme_rdma_request { ...@@ -77,7 +77,6 @@ struct nvme_rdma_request {
u32 num_sge; u32 num_sge;
int nents; int nents;
bool inline_data; bool inline_data;
bool need_inval;
struct ib_reg_wr reg_wr; struct ib_reg_wr reg_wr;
struct ib_cqe reg_cqe; struct ib_cqe reg_cqe;
struct nvme_rdma_queue *queue; struct nvme_rdma_queue *queue;
...@@ -286,7 +285,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) ...@@ -286,7 +285,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq)
struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
int ret = 0; int ret = 0;
if (!req->need_inval) if (!req->mr->need_inval)
goto out; goto out;
ib_dereg_mr(req->mr); ib_dereg_mr(req->mr);
...@@ -298,7 +297,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) ...@@ -298,7 +297,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq)
req->mr = NULL; req->mr = NULL;
} }
req->need_inval = false; req->mr->need_inval = false;
out: out:
return ret; return ret;
...@@ -850,7 +849,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue, ...@@ -850,7 +849,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue,
if (!blk_rq_bytes(rq)) if (!blk_rq_bytes(rq))
return; return;
if (req->need_inval) { if (req->mr->need_inval) {
res = nvme_rdma_inv_rkey(queue, req); res = nvme_rdma_inv_rkey(queue, req);
if (res < 0) { if (res < 0) {
dev_err(ctrl->ctrl.device, dev_err(ctrl->ctrl.device,
...@@ -936,7 +935,7 @@ static int nvme_rdma_map_sg_fr(struct nvme_rdma_queue *queue, ...@@ -936,7 +935,7 @@ static int nvme_rdma_map_sg_fr(struct nvme_rdma_queue *queue,
IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_READ |
IB_ACCESS_REMOTE_WRITE; IB_ACCESS_REMOTE_WRITE;
req->need_inval = true; req->mr->need_inval = true;
sg->addr = cpu_to_le64(req->mr->iova); sg->addr = cpu_to_le64(req->mr->iova);
put_unaligned_le24(req->mr->length, sg->length); put_unaligned_le24(req->mr->length, sg->length);
...@@ -959,7 +958,7 @@ static int nvme_rdma_map_data(struct nvme_rdma_queue *queue, ...@@ -959,7 +958,7 @@ static int nvme_rdma_map_data(struct nvme_rdma_queue *queue,
req->num_sge = 1; req->num_sge = 1;
req->inline_data = false; req->inline_data = false;
req->need_inval = false; req->mr->need_inval = false;
c->common.flags |= NVME_CMD_SGL_METABUF; c->common.flags |= NVME_CMD_SGL_METABUF;
...@@ -1146,7 +1145,7 @@ static int nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue, ...@@ -1146,7 +1145,7 @@ static int nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue,
if ((wc->wc_flags & IB_WC_WITH_INVALIDATE) && if ((wc->wc_flags & IB_WC_WITH_INVALIDATE) &&
wc->ex.invalidate_rkey == req->mr->rkey) wc->ex.invalidate_rkey == req->mr->rkey)
req->need_inval = false; req->mr->need_inval = false;
blk_mq_complete_request(rq, status); blk_mq_complete_request(rq, status);
...@@ -1476,7 +1475,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -1476,7 +1475,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH) if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH)
flush = true; flush = true;
ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge, ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge,
req->need_inval ? &req->reg_wr.wr : NULL, flush); req->mr->need_inval ? &req->reg_wr.wr : NULL, flush);
if (ret) { if (ret) {
nvme_rdma_unmap_data(queue, rq); nvme_rdma_unmap_data(queue, rq);
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment