diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2006-07-24 16:47:39 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-07-28 12:49:34 -0400 |
commit | c8dc1e523b0f1e6dd71cdabd8c7d7587c6dc27f9 (patch) | |
tree | 466efa148c152f4330c92f02f81bc72e8f395114 /drivers/scsi/libiscsi.c | |
parent | 9aaa2b4621280b6de1ecfb6dd7cd5cbe59fd1264 (diff) |
[SCSI] iscsi bugfixes: reduce memory allocations
We currently try to allocate a max_recv_data_segment_length
which can be very large (default is 64K), and common uses
are up to 1MB. It is very very difficult to allocte this
much contiguous memory and it turns out we never even use it.
We really only need a couple of pages, so this patch has us
allocates just what we know what we need today.
Later if vendors start adding vendor specific data and
we need to handle large buffers we can do this, but for
the last 4 years we have not seen anyone do this or request
it.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index c989bc6180b3..03b3dee49009 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -360,6 +360,10 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
360 | 360 | ||
361 | switch(opcode) { | 361 | switch(opcode) { |
362 | case ISCSI_OP_LOGOUT_RSP: | 362 | case ISCSI_OP_LOGOUT_RSP: |
363 | if (datalen) { | ||
364 | rc = ISCSI_ERR_PROTO; | ||
365 | break; | ||
366 | } | ||
363 | conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; | 367 | conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; |
364 | /* fall through */ | 368 | /* fall through */ |
365 | case ISCSI_OP_LOGIN_RSP: | 369 | case ISCSI_OP_LOGIN_RSP: |
@@ -383,7 +387,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
383 | iscsi_tmf_rsp(conn, hdr); | 387 | iscsi_tmf_rsp(conn, hdr); |
384 | break; | 388 | break; |
385 | case ISCSI_OP_NOOP_IN: | 389 | case ISCSI_OP_NOOP_IN: |
386 | if (hdr->ttt != ISCSI_RESERVED_TAG) { | 390 | if (hdr->ttt != ISCSI_RESERVED_TAG || datalen) { |
387 | rc = ISCSI_ERR_PROTO; | 391 | rc = ISCSI_ERR_PROTO; |
388 | break; | 392 | break; |
389 | } | 393 | } |
@@ -1405,7 +1409,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, uint32_t conn_idx) | |||
1405 | data = kmalloc(DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, GFP_KERNEL); | 1409 | data = kmalloc(DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, GFP_KERNEL); |
1406 | if (!data) | 1410 | if (!data) |
1407 | goto login_mtask_data_alloc_fail; | 1411 | goto login_mtask_data_alloc_fail; |
1408 | conn->login_mtask->data = data; | 1412 | conn->login_mtask->data = conn->data = data; |
1409 | 1413 | ||
1410 | init_timer(&conn->tmabort_timer); | 1414 | init_timer(&conn->tmabort_timer); |
1411 | mutex_init(&conn->xmitmutex); | 1415 | mutex_init(&conn->xmitmutex); |
@@ -1477,7 +1481,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
1477 | } | 1481 | } |
1478 | 1482 | ||
1479 | spin_lock_bh(&session->lock); | 1483 | spin_lock_bh(&session->lock); |
1480 | kfree(conn->login_mtask->data); | 1484 | kfree(conn->data); |
1481 | __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask, | 1485 | __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask, |
1482 | sizeof(void*)); | 1486 | sizeof(void*)); |
1483 | list_del(&conn->item); | 1487 | list_del(&conn->item); |