nvme-tcp: fix wrong setting of request iov_iter
We might set the iov_iter direction wrong, which is harmless for this use-case, but get it right. Also this makes the code slightly cleaner. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
f9063a5327
commit
cb9b870fba
1 changed files with 2 additions and 5 deletions
|
@ -983,7 +983,6 @@ static int nvme_tcp_try_send_cmd_pdu(struct nvme_tcp_request *req)
|
||||||
req->state = NVME_TCP_SEND_DATA;
|
req->state = NVME_TCP_SEND_DATA;
|
||||||
if (queue->data_digest)
|
if (queue->data_digest)
|
||||||
crypto_ahash_init(queue->snd_hash);
|
crypto_ahash_init(queue->snd_hash);
|
||||||
nvme_tcp_init_iter(req, WRITE);
|
|
||||||
} else {
|
} else {
|
||||||
nvme_tcp_done_send_req(queue);
|
nvme_tcp_done_send_req(queue);
|
||||||
}
|
}
|
||||||
|
@ -1016,8 +1015,6 @@ static int nvme_tcp_try_send_data_pdu(struct nvme_tcp_request *req)
|
||||||
req->state = NVME_TCP_SEND_DATA;
|
req->state = NVME_TCP_SEND_DATA;
|
||||||
if (queue->data_digest)
|
if (queue->data_digest)
|
||||||
crypto_ahash_init(queue->snd_hash);
|
crypto_ahash_init(queue->snd_hash);
|
||||||
if (!req->data_sent)
|
|
||||||
nvme_tcp_init_iter(req, WRITE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
req->offset += ret;
|
req->offset += ret;
|
||||||
|
@ -2268,12 +2265,12 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns,
|
||||||
req->data_len = blk_rq_nr_phys_segments(rq) ?
|
req->data_len = blk_rq_nr_phys_segments(rq) ?
|
||||||
blk_rq_payload_bytes(rq) : 0;
|
blk_rq_payload_bytes(rq) : 0;
|
||||||
req->curr_bio = rq->bio;
|
req->curr_bio = rq->bio;
|
||||||
|
if (req->curr_bio)
|
||||||
|
nvme_tcp_init_iter(req, rq_data_dir(rq));
|
||||||
|
|
||||||
if (rq_data_dir(rq) == WRITE &&
|
if (rq_data_dir(rq) == WRITE &&
|
||||||
req->data_len <= nvme_tcp_inline_data_size(queue))
|
req->data_len <= nvme_tcp_inline_data_size(queue))
|
||||||
req->pdu_len = req->data_len;
|
req->pdu_len = req->data_len;
|
||||||
else if (req->curr_bio)
|
|
||||||
nvme_tcp_init_iter(req, READ);
|
|
||||||
|
|
||||||
pdu->hdr.type = nvme_tcp_cmd;
|
pdu->hdr.type = nvme_tcp_cmd;
|
||||||
pdu->hdr.flags = 0;
|
pdu->hdr.flags = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue