diff options
Diffstat (limited to 'drivers/scsi/libiscsi_tcp.c')
-rw-r--r-- | drivers/scsi/libiscsi_tcp.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index ca25ee5190b0..a83ee56a185e 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c | |||
@@ -445,15 +445,15 @@ void iscsi_tcp_cleanup_task(struct iscsi_task *task) | |||
445 | return; | 445 | return; |
446 | 446 | ||
447 | /* flush task's r2t queues */ | 447 | /* flush task's r2t queues */ |
448 | while (__kfifo_get(tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) { | 448 | while (__kfifo_get(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) { |
449 | __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, | 449 | __kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, |
450 | sizeof(void*)); | 450 | sizeof(void*)); |
451 | ISCSI_DBG_TCP(task->conn, "pending r2t dropped\n"); | 451 | ISCSI_DBG_TCP(task->conn, "pending r2t dropped\n"); |
452 | } | 452 | } |
453 | 453 | ||
454 | r2t = tcp_task->r2t; | 454 | r2t = tcp_task->r2t; |
455 | if (r2t != NULL) { | 455 | if (r2t != NULL) { |
456 | __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, | 456 | __kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, |
457 | sizeof(void*)); | 457 | sizeof(void*)); |
458 | tcp_task->r2t = NULL; | 458 | tcp_task->r2t = NULL; |
459 | } | 459 | } |
@@ -541,7 +541,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
541 | return 0; | 541 | return 0; |
542 | } | 542 | } |
543 | 543 | ||
544 | rc = __kfifo_get(tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); | 544 | rc = __kfifo_get(&tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); |
545 | if (!rc) { | 545 | if (!rc) { |
546 | iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. " | 546 | iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. " |
547 | "Target has sent more R2Ts than it " | 547 | "Target has sent more R2Ts than it " |
@@ -554,7 +554,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
554 | if (r2t->data_length == 0) { | 554 | if (r2t->data_length == 0) { |
555 | iscsi_conn_printk(KERN_ERR, conn, | 555 | iscsi_conn_printk(KERN_ERR, conn, |
556 | "invalid R2T with zero data len\n"); | 556 | "invalid R2T with zero data len\n"); |
557 | __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, | 557 | __kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, |
558 | sizeof(void*)); | 558 | sizeof(void*)); |
559 | return ISCSI_ERR_DATALEN; | 559 | return ISCSI_ERR_DATALEN; |
560 | } | 560 | } |
@@ -570,7 +570,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
570 | "invalid R2T with data len %u at offset %u " | 570 | "invalid R2T with data len %u at offset %u " |
571 | "and total length %d\n", r2t->data_length, | 571 | "and total length %d\n", r2t->data_length, |
572 | r2t->data_offset, scsi_out(task->sc)->length); | 572 | r2t->data_offset, scsi_out(task->sc)->length); |
573 | __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, | 573 | __kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, |
574 | sizeof(void*)); | 574 | sizeof(void*)); |
575 | return ISCSI_ERR_DATALEN; | 575 | return ISCSI_ERR_DATALEN; |
576 | } | 576 | } |
@@ -580,7 +580,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
580 | r2t->sent = 0; | 580 | r2t->sent = 0; |
581 | 581 | ||
582 | tcp_task->exp_datasn = r2tsn + 1; | 582 | tcp_task->exp_datasn = r2tsn + 1; |
583 | __kfifo_put(tcp_task->r2tqueue, (void*)&r2t, sizeof(void*)); | 583 | __kfifo_put(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*)); |
584 | conn->r2t_pdus_cnt++; | 584 | conn->r2t_pdus_cnt++; |
585 | 585 | ||
586 | iscsi_requeue_task(task); | 586 | iscsi_requeue_task(task); |
@@ -951,7 +951,7 @@ int iscsi_tcp_task_init(struct iscsi_task *task) | |||
951 | return conn->session->tt->init_pdu(task, 0, task->data_count); | 951 | return conn->session->tt->init_pdu(task, 0, task->data_count); |
952 | } | 952 | } |
953 | 953 | ||
954 | BUG_ON(__kfifo_len(tcp_task->r2tqueue)); | 954 | BUG_ON(__kfifo_len(&tcp_task->r2tqueue)); |
955 | tcp_task->exp_datasn = 0; | 955 | tcp_task->exp_datasn = 0; |
956 | 956 | ||
957 | /* Prepare PDU, optionally w/ immediate data */ | 957 | /* Prepare PDU, optionally w/ immediate data */ |
@@ -982,7 +982,7 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task) | |||
982 | if (r2t->data_length <= r2t->sent) { | 982 | if (r2t->data_length <= r2t->sent) { |
983 | ISCSI_DBG_TCP(task->conn, | 983 | ISCSI_DBG_TCP(task->conn, |
984 | " done with r2t %p\n", r2t); | 984 | " done with r2t %p\n", r2t); |
985 | __kfifo_put(tcp_task->r2tpool.queue, | 985 | __kfifo_put(&tcp_task->r2tpool.queue, |
986 | (void *)&tcp_task->r2t, | 986 | (void *)&tcp_task->r2t, |
987 | sizeof(void *)); | 987 | sizeof(void *)); |
988 | tcp_task->r2t = r2t = NULL; | 988 | tcp_task->r2t = r2t = NULL; |
@@ -990,7 +990,7 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task) | |||
990 | } | 990 | } |
991 | 991 | ||
992 | if (r2t == NULL) { | 992 | if (r2t == NULL) { |
993 | __kfifo_get(tcp_task->r2tqueue, | 993 | __kfifo_get(&tcp_task->r2tqueue, |
994 | (void *)&tcp_task->r2t, sizeof(void *)); | 994 | (void *)&tcp_task->r2t, sizeof(void *)); |
995 | r2t = tcp_task->r2t; | 995 | r2t = tcp_task->r2t; |
996 | } | 996 | } |
@@ -1127,9 +1127,8 @@ int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session) | |||
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | /* R2T xmit queue */ | 1129 | /* R2T xmit queue */ |
1130 | tcp_task->r2tqueue = kfifo_alloc( | 1130 | if (kfifo_alloc(&tcp_task->r2tqueue, |
1131 | session->max_r2t * 4 * sizeof(void*), GFP_KERNEL, NULL); | 1131 | session->max_r2t * 4 * sizeof(void*), GFP_KERNEL, NULL)) { |
1132 | if (tcp_task->r2tqueue == ERR_PTR(-ENOMEM)) { | ||
1133 | iscsi_pool_free(&tcp_task->r2tpool); | 1132 | iscsi_pool_free(&tcp_task->r2tpool); |
1134 | goto r2t_alloc_fail; | 1133 | goto r2t_alloc_fail; |
1135 | } | 1134 | } |
@@ -1142,7 +1141,7 @@ r2t_alloc_fail: | |||
1142 | struct iscsi_task *task = session->cmds[i]; | 1141 | struct iscsi_task *task = session->cmds[i]; |
1143 | struct iscsi_tcp_task *tcp_task = task->dd_data; | 1142 | struct iscsi_tcp_task *tcp_task = task->dd_data; |
1144 | 1143 | ||
1145 | kfifo_free(tcp_task->r2tqueue); | 1144 | kfifo_free(&tcp_task->r2tqueue); |
1146 | iscsi_pool_free(&tcp_task->r2tpool); | 1145 | iscsi_pool_free(&tcp_task->r2tpool); |
1147 | } | 1146 | } |
1148 | return -ENOMEM; | 1147 | return -ENOMEM; |
@@ -1157,7 +1156,7 @@ void iscsi_tcp_r2tpool_free(struct iscsi_session *session) | |||
1157 | struct iscsi_task *task = session->cmds[i]; | 1156 | struct iscsi_task *task = session->cmds[i]; |
1158 | struct iscsi_tcp_task *tcp_task = task->dd_data; | 1157 | struct iscsi_tcp_task *tcp_task = task->dd_data; |
1159 | 1158 | ||
1160 | kfifo_free(tcp_task->r2tqueue); | 1159 | kfifo_free(&tcp_task->r2tqueue); |
1161 | iscsi_pool_free(&tcp_task->r2tpool); | 1160 | iscsi_pool_free(&tcp_task->r2tpool); |
1162 | } | 1161 | } |
1163 | } | 1162 | } |