aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorOlaf Kirch <olaf.kirch@oracle.com>2007-12-13 13:43:25 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:28:27 -0500
commit6320377fd94316e58f75d0be6f6e7a644950a4ee (patch)
tree7c7b47e6bafae9f25cfd9e1416494b6406c2d0b9 /include/scsi
parent38ad03de3fd350e683213ddf898a7049534628a8 (diff)
[SCSI] libiscsi, iscsi_tcp: iscsi pool cleanup
iscsi_pool_init simplified iscsi_pool_init currently has a lot of duplicate kfree() calls it does when some allocation fails. This patch simplifies the code a little by using iscsi_pool_free to tear down the pool in case of an error. iscsi_pool_init also returns a copy of the item array to the caller. Not all callers use this array, so we make it optional. Instead of allocating a second array and return that, allocate just one array, of twice the size. Update users of iscsi_pool_{init,free} This patch drops the (now useless) second argument to iscsi_pool_free, and updates all callers. It also removes the ctask->r2ts array, which was never used anyway. Since the items argument to iscsi_pool_init is now optional, we can pass NULL instead. Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libiscsi.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index a9a9e869188d..4b3e3c15121a 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -215,7 +215,7 @@ struct iscsi_conn {
215 uint32_t eh_abort_cnt; 215 uint32_t eh_abort_cnt;
216}; 216};
217 217
218struct iscsi_queue { 218struct iscsi_pool {
219 struct kfifo *queue; /* FIFO Queue */ 219 struct kfifo *queue; /* FIFO Queue */
220 void **pool; /* Pool of elements */ 220 void **pool; /* Pool of elements */
221 int max; /* Max number of elements */ 221 int max; /* Max number of elements */
@@ -274,10 +274,10 @@ struct iscsi_session {
274 274
275 int cmds_max; /* size of cmds array */ 275 int cmds_max; /* size of cmds array */
276 struct iscsi_cmd_task **cmds; /* Original Cmds arr */ 276 struct iscsi_cmd_task **cmds; /* Original Cmds arr */
277 struct iscsi_queue cmdpool; /* PDU's pool */ 277 struct iscsi_pool cmdpool; /* PDU's pool */
278 int mgmtpool_max; /* size of mgmt array */ 278 int mgmtpool_max; /* size of mgmt array */
279 struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */ 279 struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */
280 struct iscsi_queue mgmtpool; /* Mgmt PDU's pool */ 280 struct iscsi_pool mgmtpool; /* Mgmt PDU's pool */
281}; 281};
282 282
283/* 283/*
@@ -350,8 +350,8 @@ extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
350/* 350/*
351 * generic helpers 351 * generic helpers
352 */ 352 */
353extern void iscsi_pool_free(struct iscsi_queue *, void **); 353extern void iscsi_pool_free(struct iscsi_pool *);
354extern int iscsi_pool_init(struct iscsi_queue *, int, void ***, int); 354extern int iscsi_pool_init(struct iscsi_pool *, int, void ***, int);
355 355
356/* 356/*
357 * inline functions to deal with padding. 357 * inline functions to deal with padding.