iscsi: simplify nesting and order in iscsi_conn_read_data()

Try to make the logic of the function a little clearer.

Change-Id: Ic78bed73feef94d94487f0a4240019789be8d2bc
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/414353
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-06-08 14:54:01 +09:00 committed by Jim Harris
parent edf924824e
commit feb7f2b3fc

View File

@ -732,12 +732,14 @@ spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
if (ret > 0) { if (ret > 0) {
spdk_trace_record(TRACE_READ_FROM_SOCKET_DONE, conn->id, ret, 0, 0); spdk_trace_record(TRACE_READ_FROM_SOCKET_DONE, conn->id, ret, 0, 0);
return ret;
} }
if (ret < 0) { if (ret < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) { if (errno == EAGAIN || errno == EWOULDBLOCK) {
return 0; return 0;
} else { }
/* For connect reset issue, do not output error log */ /* For connect reset issue, do not output error log */
if (errno == ECONNRESET) { if (errno == ECONNRESET) {
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_sock_recv() failed, errno %d: %s\n", SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_sock_recv() failed, errno %d: %s\n",
@ -747,15 +749,9 @@ spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
errno, spdk_strerror(errno)); errno, spdk_strerror(errno));
} }
} }
return SPDK_ISCSI_CONNECTION_FATAL;
}
/* connection closed */ /* connection closed */
if (ret == 0) {
return SPDK_ISCSI_CONNECTION_FATAL; return SPDK_ISCSI_CONNECTION_FATAL;
}
return ret;
} }
void void