target/iscsi: Allocate session IDs from an IDA
Since the session is never looked up by ID, we can use the more space-efficient IDA instead of the IDR. Signed-off-by: Matthew Wilcox <willy@infradead.org>
This commit is contained in:
@@ -57,9 +57,8 @@ static DEFINE_SPINLOCK(tiqn_lock);
|
||||
static DEFINE_MUTEX(np_lock);
|
||||
|
||||
static struct idr tiqn_idr;
|
||||
struct idr sess_idr;
|
||||
DEFINE_IDA(sess_ida);
|
||||
struct mutex auth_id_lock;
|
||||
spinlock_t sess_idr_lock;
|
||||
|
||||
struct iscsit_global *iscsit_global;
|
||||
|
||||
@@ -700,9 +699,7 @@ static int __init iscsi_target_init_module(void)
|
||||
|
||||
spin_lock_init(&iscsit_global->ts_bitmap_lock);
|
||||
mutex_init(&auth_id_lock);
|
||||
spin_lock_init(&sess_idr_lock);
|
||||
idr_init(&tiqn_idr);
|
||||
idr_init(&sess_idr);
|
||||
|
||||
ret = target_register_template(&iscsi_ops);
|
||||
if (ret)
|
||||
@@ -4375,10 +4372,7 @@ int iscsit_close_session(struct iscsi_session *sess)
|
||||
pr_debug("Decremented number of active iSCSI Sessions on"
|
||||
" iSCSI TPG: %hu to %u\n", tpg->tpgt, tpg->nsessions);
|
||||
|
||||
spin_lock(&sess_idr_lock);
|
||||
idr_remove(&sess_idr, sess->session_index);
|
||||
spin_unlock(&sess_idr_lock);
|
||||
|
||||
ida_free(&sess_ida, sess->session_index);
|
||||
kfree(sess->sess_ops);
|
||||
sess->sess_ops = NULL;
|
||||
spin_unlock_bh(&se_tpg->session_lock);
|
||||
|
Reference in New Issue
Block a user