lib/iscsi: Change the type of pending_r2t from int to uint32_t

Other count variables in iSCSI library have used uint32_t rather
than int.

Change the type of spdk_iscsi_conn::pending_r2t from int to uint32_t
and add assert to check if pending_r2t is not negative.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9bd296c0142b0808ae822952277c9ecc133e5f62
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3775
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:
Shuhei Matsumoto 2020-08-13 16:17:01 +09:00 committed by Tomasz Zawadzki
parent 5aaf754f81
commit 07f2d83dea
2 changed files with 3 additions and 1 deletions

View File

@ -137,7 +137,7 @@ struct spdk_iscsi_conn {
TAILQ_HEAD(, spdk_iscsi_pdu) write_pdu_list;
TAILQ_HEAD(, spdk_iscsi_pdu) snack_pdu_list;
int pending_r2t;
uint32_t pending_r2t;
uint16_t cid;

View File

@ -2804,6 +2804,7 @@ iscsi_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t task_tag)
assert(conn->data_out_cnt >= task->data_out_cnt);
conn->data_out_cnt -= task->data_out_cnt;
assert(conn->pending_r2t > 0);
conn->pending_r2t--;
assert(task->is_r2t_active == true);
@ -2834,6 +2835,7 @@ void iscsi_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
task->next_expected_r2t_offset = 0;
assert(conn->data_out_cnt >= task->data_out_cnt);
conn->data_out_cnt -= task->data_out_cnt;
assert(conn->pending_r2t > 0);
conn->pending_r2t--;
TAILQ_REMOVE(&conn->active_r2t_tasks, task, link);