nvme/tcp: Restore nvme_tcp_read_data function.
Purpose: To fix performance degradation. Restore the nvme_tcp_read_data function, and for nvme_tcp_readv_data, will call nvme_tcp_read_data if iovcnt=1. Change-Id: Ie3abb943c294dc27d736371cd7ce9a5aa966877a Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448030 Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
ec2cb43589
commit
237260f6a1
@ -312,6 +312,37 @@ end:
|
||||
return ctx->iovcnt;
|
||||
}
|
||||
|
||||
static int
|
||||
nvme_tcp_read_data(struct spdk_sock *sock, int bytes,
|
||||
void *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = spdk_sock_recv(sock, buf, bytes);
|
||||
|
||||
if (ret > 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For connect reset issue, do not output error log */
|
||||
if (errno == ECONNRESET) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_NVME, "spdk_sock_recv() failed, errno %d: %s\n",
|
||||
errno, spdk_strerror(errno));
|
||||
} else {
|
||||
SPDK_ERRLOG("spdk_sock_recv() failed, errno %d: %s\n",
|
||||
errno, spdk_strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
/* connection closed */
|
||||
return NVME_TCP_CONNECTION_FATAL;
|
||||
}
|
||||
|
||||
static int
|
||||
nvme_tcp_readv_data(struct spdk_sock *sock, struct iovec *iov, int iovcnt)
|
||||
{
|
||||
@ -322,6 +353,10 @@ nvme_tcp_readv_data(struct spdk_sock *sock, struct iovec *iov, int iovcnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (iovcnt == 1) {
|
||||
return nvme_tcp_read_data(sock, iov->iov_len, iov->iov_base);
|
||||
}
|
||||
|
||||
ret = spdk_sock_readv(sock, iov, iovcnt);
|
||||
|
||||
if (ret > 0) {
|
||||
@ -347,17 +382,6 @@ nvme_tcp_readv_data(struct spdk_sock *sock, struct iovec *iov, int iovcnt)
|
||||
return NVME_TCP_CONNECTION_FATAL;
|
||||
}
|
||||
|
||||
static int
|
||||
nvme_tcp_read_data(struct spdk_sock *sock, int bytes,
|
||||
void *buf)
|
||||
{
|
||||
struct iovec iov;
|
||||
|
||||
iov.iov_base = buf;
|
||||
iov.iov_len = bytes;
|
||||
|
||||
return nvme_tcp_readv_data(sock, &iov, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
nvme_tcp_read_payload_data(struct spdk_sock *sock, struct nvme_tcp_pdu *pdu)
|
||||
|
Loading…
x
Reference in New Issue
Block a user