mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
[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>
This commit is contained in:
committed by
James Bottomley
parent
9aaa2b4621
commit
c8dc1e523b
@@ -360,6 +360,10 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
|
||||
|
||||
switch(opcode) {
|
||||
case ISCSI_OP_LOGOUT_RSP:
|
||||
if (datalen) {
|
||||
rc = ISCSI_ERR_PROTO;
|
||||
break;
|
||||
}
|
||||
conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
|
||||
/* fall through */
|
||||
case ISCSI_OP_LOGIN_RSP:
|
||||
@@ -383,7 +387,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
|
||||
iscsi_tmf_rsp(conn, hdr);
|
||||
break;
|
||||
case ISCSI_OP_NOOP_IN:
|
||||
if (hdr->ttt != ISCSI_RESERVED_TAG) {
|
||||
if (hdr->ttt != ISCSI_RESERVED_TAG || datalen) {
|
||||
rc = ISCSI_ERR_PROTO;
|
||||
break;
|
||||
}
|
||||
@@ -1405,7 +1409,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
|
||||
data = kmalloc(DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, GFP_KERNEL);
|
||||
if (!data)
|
||||
goto login_mtask_data_alloc_fail;
|
||||
conn->login_mtask->data = data;
|
||||
conn->login_mtask->data = conn->data = data;
|
||||
|
||||
init_timer(&conn->tmabort_timer);
|
||||
mutex_init(&conn->xmitmutex);
|
||||
@@ -1477,7 +1481,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
|
||||
}
|
||||
|
||||
spin_lock_bh(&session->lock);
|
||||
kfree(conn->login_mtask->data);
|
||||
kfree(conn->data);
|
||||
__kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask,
|
||||
sizeof(void*));
|
||||
list_del(&conn->item);
|
||||
|
||||
Reference in New Issue
Block a user