iscsi: Update _pdu only when completing read in spdk_iscsi_read_pdu
The only caller iscsi_conn_handle_incoming_pdus accesses the returned pdu only when the return code is 1. So we can remove update of _pdu for other cases in spdk_iscsi_read_pdu. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I54b9f050c3b45c87f4797a90d7606638d6c821ad Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456771 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
2882b9895a
commit
1204ff34e0
@ -426,7 +426,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
}
|
}
|
||||||
pdu->bhs_valid_bytes += rc;
|
pdu->bhs_valid_bytes += rc;
|
||||||
if (pdu->bhs_valid_bytes < ISCSI_BHS_LEN) {
|
if (pdu->bhs_valid_bytes < ISCSI_BHS_LEN) {
|
||||||
*_pdu = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,7 +445,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
|
|
||||||
pdu->ahs_valid_bytes += rc;
|
pdu->ahs_valid_bytes += rc;
|
||||||
if (pdu->ahs_valid_bytes < ahs_len) {
|
if (pdu->ahs_valid_bytes < ahs_len) {
|
||||||
*_pdu = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,7 +461,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
|
|
||||||
pdu->hdigest_valid_bytes += rc;
|
pdu->hdigest_valid_bytes += rc;
|
||||||
if (pdu->hdigest_valid_bytes < ISCSI_DIGEST_LEN) {
|
if (pdu->hdigest_valid_bytes < ISCSI_DIGEST_LEN) {
|
||||||
*_pdu = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,7 +481,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
}
|
}
|
||||||
pdu->mobj = spdk_mempool_get(pool);
|
pdu->mobj = spdk_mempool_get(pool);
|
||||||
if (pdu->mobj == NULL) {
|
if (pdu->mobj == NULL) {
|
||||||
*_pdu = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pdu->data_buf = pdu->mobj->buf;
|
pdu->data_buf = pdu->mobj->buf;
|
||||||
@ -497,7 +493,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
|
|
||||||
pdu->data_valid_bytes += rc;
|
pdu->data_valid_bytes += rc;
|
||||||
if (pdu->data_valid_bytes < data_len) {
|
if (pdu->data_valid_bytes < data_len) {
|
||||||
*_pdu = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,7 +509,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
|
|
||||||
pdu->ddigest_valid_bytes += rc;
|
pdu->ddigest_valid_bytes += rc;
|
||||||
if (pdu->ddigest_valid_bytes < ISCSI_DIGEST_LEN) {
|
if (pdu->ddigest_valid_bytes < ISCSI_DIGEST_LEN) {
|
||||||
*_pdu = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,7 +564,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
*_pdu = NULL;
|
|
||||||
spdk_put_pdu(pdu);
|
spdk_put_pdu(pdu);
|
||||||
conn->pdu_in_progress = NULL;
|
conn->pdu_in_progress = NULL;
|
||||||
return SPDK_ISCSI_CONNECTION_FATAL;
|
return SPDK_ISCSI_CONNECTION_FATAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user