lib/iscsi: Remove pdu->data_buf and use pdu->data instead for all cases
data_buf was duplicated with data and was not necessary. Hence remove it and use data instead in this patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I207047ce73d938f83e39f1454d44a9e4bba6b2f7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6407 Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
0b576bb738
commit
d752a1755d
@ -324,7 +324,7 @@ iscsi_pdu_calc_data_digest(struct spdk_iscsi_pdu *pdu)
|
|||||||
if (spdk_likely(!pdu->dif_insert_or_strip)) {
|
if (spdk_likely(!pdu->dif_insert_or_strip)) {
|
||||||
crc32c = spdk_crc32c_update(pdu->data, data_len, crc32c);
|
crc32c = spdk_crc32c_update(pdu->data, data_len, crc32c);
|
||||||
} else {
|
} else {
|
||||||
iov.iov_base = pdu->data_buf;
|
iov.iov_base = pdu->data;
|
||||||
iov.iov_len = pdu->data_buf_len;
|
iov.iov_len = pdu->data_buf_len;
|
||||||
num_blocks = pdu->data_buf_len / pdu->dif_ctx.block_size;
|
num_blocks = pdu->data_buf_len / pdu->dif_ctx.block_size;
|
||||||
|
|
||||||
@ -356,9 +356,9 @@ iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn,
|
|||||||
if (spdk_likely(!pdu->dif_insert_or_strip)) {
|
if (spdk_likely(!pdu->dif_insert_or_strip)) {
|
||||||
return iscsi_conn_read_data(conn,
|
return iscsi_conn_read_data(conn,
|
||||||
segment_len - pdu->data_valid_bytes,
|
segment_len - pdu->data_valid_bytes,
|
||||||
pdu->data_buf + pdu->data_valid_bytes);
|
pdu->data + pdu->data_valid_bytes);
|
||||||
} else {
|
} else {
|
||||||
buf_iov.iov_base = pdu->data_buf;
|
buf_iov.iov_base = pdu->data;
|
||||||
buf_iov.iov_len = pdu->data_buf_len;
|
buf_iov.iov_len = pdu->data_buf_len;
|
||||||
rc = spdk_dif_set_md_interleave_iovs(iovs, 32, &buf_iov, 1,
|
rc = spdk_dif_set_md_interleave_iovs(iovs, 32, &buf_iov, 1,
|
||||||
pdu->data_valid_bytes,
|
pdu->data_valid_bytes,
|
||||||
@ -4568,7 +4568,7 @@ iscsi_pdu_payload_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
|
|
||||||
data_len = pdu->data_segment_len;
|
data_len = pdu->data_segment_len;
|
||||||
|
|
||||||
if (pdu->data_buf == NULL) {
|
if (pdu->data == NULL) {
|
||||||
if (data_len <= iscsi_get_max_immediate_data_size()) {
|
if (data_len <= iscsi_get_max_immediate_data_size()) {
|
||||||
pool = g_iscsi.pdu_immediate_data_pool;
|
pool = g_iscsi.pdu_immediate_data_pool;
|
||||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size());
|
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size());
|
||||||
@ -4584,7 +4584,6 @@ iscsi_pdu_payload_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
if (pdu->mobj == NULL) {
|
if (pdu->mobj == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pdu->data_buf = pdu->mobj->buf;
|
|
||||||
pdu->data = pdu->mobj->buf;
|
pdu->data = pdu->mobj->buf;
|
||||||
pdu->data_from_mempool = true;
|
pdu->data_from_mempool = true;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,6 @@ struct spdk_iscsi_pdu {
|
|||||||
struct iscsi_bhs bhs;
|
struct iscsi_bhs bhs;
|
||||||
struct spdk_mobj *mobj;
|
struct spdk_mobj *mobj;
|
||||||
bool is_rejected;
|
bool is_rejected;
|
||||||
uint8_t *data_buf;
|
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
uint8_t header_digest[ISCSI_DIGEST_LEN];
|
uint8_t header_digest[ISCSI_DIGEST_LEN];
|
||||||
uint8_t data_digest[ISCSI_DIGEST_LEN];
|
uint8_t data_digest[ISCSI_DIGEST_LEN];
|
||||||
|
@ -479,12 +479,11 @@ iscsi_fuzz_read_pdu(struct spdk_iscsi_conn *conn)
|
|||||||
break;
|
break;
|
||||||
case ISCSI_PDU_RECV_STATE_AWAIT_PDU_PAYLOAD:
|
case ISCSI_PDU_RECV_STATE_AWAIT_PDU_PAYLOAD:
|
||||||
data_len = pdu->data_segment_len;
|
data_len = pdu->data_segment_len;
|
||||||
if (data_len != 0 && pdu->data_buf == NULL) {
|
if (data_len != 0 && pdu->data == NULL) {
|
||||||
pdu->data_buf = calloc(1, data_len);
|
pdu->data = calloc(1, data_len);
|
||||||
if (pdu->data_buf == NULL) {
|
if (pdu->data == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pdu->data = pdu->data_buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the actual data into local buffer */
|
/* copy the actual data into local buffer */
|
||||||
|
Loading…
Reference in New Issue
Block a user