iscsi: change the type and name of data_ref in spdk_iscsi_pdu

Change the type from int to bool and change the name
from data_ref to data_from_mempool.

Change-Id: If1fc11761e63561443ed44d6a0860e416e424df8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-10-09 12:31:06 +08:00 committed by Jim Harris
parent f7830911e2
commit cc402a588e
4 changed files with 6 additions and 6 deletions

View File

@ -504,7 +504,7 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
}
pdu->data = pdu->data_buf;
pdu->data_ref++;
pdu->data_from_mempool = true;
pdu->data_segment_len = data_len;
}
@ -2617,7 +2617,7 @@ spdk_iscsi_send_datain(struct spdk_iscsi_conn *conn,
rsp_pdu = spdk_get_pdu();
rsph = (struct iscsi_bhs_data_in *)&rsp_pdu->bhs;
rsp_pdu->data = task->scsi.rbuf + offset;
rsp_pdu->data_ref++;
rsp_pdu->data_from_mempool = true;
task_tag = task->scsi.id;
transfer_tag = 0xffffffffU;
@ -3147,7 +3147,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
rsp_pdu = spdk_get_pdu();
rsph = (struct iscsi_bhs_scsi_resp *)&rsp_pdu->bhs;
rsp_pdu->data = task->scsi.sense_data;
rsp_pdu->data_ref++;
rsp_pdu->data_from_mempool = true;
/*
* we need to hold onto this task/cmd because until the

View File

@ -170,7 +170,7 @@ struct spdk_iscsi_pdu {
int hdigest_valid_bytes;
int ddigest_valid_bytes;
int ref;
int data_ref;
bool data_from_mempool; /* indicate whether the data buffer is allocated from mempool */
struct spdk_iscsi_task *task; /* data tied to a task buffer */
uint32_t cmd_sn;
uint32_t writev_offset;

View File

@ -511,7 +511,7 @@ void spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
if (pdu->mobj)
rte_mempool_put(pdu->mobj->mp, (void *)pdu->mobj);
if (pdu->data && !pdu->data_ref)
if (pdu->data && !pdu->data_from_mempool)
free(pdu->data);
rte_mempool_put(g_spdk_iscsi.pdu_pool, (void *)pdu);

View File

@ -36,7 +36,7 @@ spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
}
if (pdu->ref == 0) {
if (pdu->data && !pdu->data_ref) {
if (pdu->data && !pdu->data_from_mempool) {
free(pdu->data);
}
free(pdu);