From af8f50e9d474e5ac02bdf3dfbb244373c01539d2 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 3 Oct 2019 10:23:17 +0900 Subject: [PATCH] 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 Change-Id: I654b33e9539ed1dba63f6d303de7955eee9bb200 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469964 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Paul Luse Reviewed-by: Changpeng Liu --- lib/iscsi/iscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index b1bc43119..b3cf2e8b1 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -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) {