iscsi-target: Convert to per-cpu ida_alloc + ida_free command map
This patch changes iscsi-target to use transport_alloc_session_tags() pre-allocation logic for per-cpu session tag pooling with internal ida_alloc() + ida_free() calls based upon the saved se_cmd->map_tag id. This includes tag pool setup based upon per NodeACL queue_depth after locating se_node_acl in iscsi_target_locate_portal(). Also update iscsit_allocate_cmd() and iscsit_release_cmd() to use percpu_ida_alloc() and percpu_ida_free() respectively. v5 changes; - Convert to percpu_ida.h include v2 changes: - Fix bug with SessionType=Discovery in iscsi_target_locate_portal() Cc: Or Gerlitz <ogerlitz@mellanox.com> Cc: Kent Overstreet <kmo@daterainc.com> Signed-off-by: Nicholas Bellinger <nab@daterainc.com>
This commit is contained in:

committed by
Nicholas Bellinger

parent
d703ce2f7f
commit
988e3a8546
@@ -983,8 +983,9 @@ int iscsi_target_locate_portal(
|
||||
struct iscsi_tiqn *tiqn;
|
||||
struct iscsi_tpg_np *tpg_np = NULL;
|
||||
struct iscsi_login_req *login_req;
|
||||
u32 payload_length;
|
||||
int sessiontype = 0, ret = 0;
|
||||
struct se_node_acl *se_nacl;
|
||||
u32 payload_length, queue_depth = 0;
|
||||
int sessiontype = 0, ret = 0, tag_num, tag_size;
|
||||
|
||||
INIT_DELAYED_WORK(&conn->login_work, iscsi_target_do_login_rx);
|
||||
INIT_DELAYED_WORK(&conn->login_cleanup_work, iscsi_target_do_cleanup);
|
||||
@@ -1084,7 +1085,7 @@ int iscsi_target_locate_portal(
|
||||
goto out;
|
||||
}
|
||||
ret = 0;
|
||||
goto out;
|
||||
goto alloc_tags;
|
||||
}
|
||||
|
||||
get_target:
|
||||
@@ -1181,8 +1182,27 @@ get_target:
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
se_nacl = sess->se_sess->se_node_acl;
|
||||
queue_depth = se_nacl->queue_depth;
|
||||
/*
|
||||
* Setup pre-allocated tags based upon allowed per NodeACL CmdSN
|
||||
* depth for non immediate commands, plus extra tags for immediate
|
||||
* commands.
|
||||
*
|
||||
* Also enforce a ISCSIT_MIN_TAGS to prevent unnecessary contention
|
||||
* in per-cpu-ida tag allocation logic + small queue_depth.
|
||||
*/
|
||||
alloc_tags:
|
||||
tag_num = max_t(u32, ISCSIT_MIN_TAGS, queue_depth);
|
||||
tag_num += ISCSIT_EXTRA_TAGS;
|
||||
tag_size = sizeof(struct iscsi_cmd) + conn->conn_transport->priv_size;
|
||||
|
||||
ret = 0;
|
||||
ret = transport_alloc_session_tags(sess->se_sess, tag_num, tag_size);
|
||||
if (ret < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
||||
ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
||||
ret = -1;
|
||||
}
|
||||
out:
|
||||
kfree(tmpbuf);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user