mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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;
|
||||
if (queue->data_digest)
|
||||
crypto_ahash_init(queue->snd_hash);
|
||||
nvme_tcp_init_iter(req, WRITE);
|
||||
} else {
|
||||
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;
|
||||
if (queue->data_digest)
|
||||
crypto_ahash_init(queue->snd_hash);
|
||||
if (!req->data_sent)
|
||||
nvme_tcp_init_iter(req, WRITE);
|
||||
return 1;
|
||||
}
|
||||
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) ?
|
||||
blk_rq_payload_bytes(rq) : 0;
|
||||
req->curr_bio = rq->bio;
|
||||
if (req->curr_bio)
|
||||
nvme_tcp_init_iter(req, rq_data_dir(rq));
|
||||
|
||||
if (rq_data_dir(rq) == WRITE &&
|
||||
req->data_len <= nvme_tcp_inline_data_size(queue))
|
||||
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.flags = 0;
|
||||
|
|
Loading…
Reference in a new issue