lib/iscsi: Move getting data length down in spdk_iscsi_read_pdu()

The subsequent patches will separate handling header and payload.
Move getting data_len down because data_len is for payload.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I654b33e9539ed1dba63f6d303de7955eee9bb200
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469964
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-10-03 10:23:17 +09:00 committed by Changpeng Liu
parent 4473732398
commit af8f50e9d4

View File

@ -4649,8 +4649,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
}
}
data_len = ISCSI_ALIGN(DGET24(pdu->bhs.data_segment_len));
/* AHS */
ahs_len = pdu->bhs.total_ahs_len * 4;
assert(ahs_len <= ISCSI_AHS_LEN);
@ -4684,6 +4682,8 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
}
}
data_len = ISCSI_ALIGN(DGET24(pdu->bhs.data_segment_len));
/* copy the actual data into local buffer */
if (pdu->data_valid_bytes < data_len) {
if (pdu->data_buf == NULL) {