Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: target: Introduce transport_init_session()

Other than initializing xcopy_pt_sess.sess_wait_list, this patch does not
change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
d1bff07f 317f8971

+19 -9
+17 -5
drivers/target/target_core_transport.c
··· 225 225 } 226 226 227 227 /** 228 + * transport_init_session - initialize a session object 229 + * @se_sess: Session object pointer. 230 + * 231 + * The caller must have zero-initialized @se_sess before calling this function. 232 + */ 233 + void transport_init_session(struct se_session *se_sess) 234 + { 235 + INIT_LIST_HEAD(&se_sess->sess_list); 236 + INIT_LIST_HEAD(&se_sess->sess_acl_list); 237 + INIT_LIST_HEAD(&se_sess->sess_cmd_list); 238 + INIT_LIST_HEAD(&se_sess->sess_wait_list); 239 + spin_lock_init(&se_sess->sess_cmd_lock); 240 + } 241 + EXPORT_SYMBOL(transport_init_session); 242 + 243 + /** 228 244 * transport_alloc_session - allocate a session object and initialize it 229 245 * @sup_prot_ops: bitmask that defines which T10-PI modes are supported. 230 246 */ ··· 254 238 " se_sess_cache\n"); 255 239 return ERR_PTR(-ENOMEM); 256 240 } 257 - INIT_LIST_HEAD(&se_sess->sess_list); 258 - INIT_LIST_HEAD(&se_sess->sess_acl_list); 259 - INIT_LIST_HEAD(&se_sess->sess_cmd_list); 260 - INIT_LIST_HEAD(&se_sess->sess_wait_list); 261 - spin_lock_init(&se_sess->sess_cmd_lock); 241 + transport_init_session(se_sess); 262 242 se_sess->sup_prot_ops = sup_prot_ops; 263 243 264 244 return se_sess;
+1 -4
drivers/target/target_core_xcopy.c
··· 497 497 INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list); 498 498 INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list); 499 499 memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); 500 - INIT_LIST_HEAD(&xcopy_pt_sess.sess_list); 501 - INIT_LIST_HEAD(&xcopy_pt_sess.sess_acl_list); 502 - INIT_LIST_HEAD(&xcopy_pt_sess.sess_cmd_list); 503 - spin_lock_init(&xcopy_pt_sess.sess_cmd_lock); 500 + transport_init_session(&xcopy_pt_sess); 504 501 505 502 xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg; 506 503 xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess;
+1
include/target/target_core_fabric.h
··· 115 115 int (*callback)(struct se_portal_group *, 116 116 struct se_session *, void *)); 117 117 118 + void transport_init_session(struct se_session *); 118 119 struct se_session *transport_alloc_session(enum target_prot_op); 119 120 int transport_alloc_session_tags(struct se_session *, unsigned int, 120 121 unsigned int);