3939
4040#define to_tcm_loop_hba (hba ) container_of(hba, struct tcm_loop_hba, dev)
4141
42- static struct workqueue_struct * tcm_loop_workqueue ;
4342static struct kmem_cache * tcm_loop_cmd_cache ;
4443
4544static int tcm_loop_hba_no_cnt ;
@@ -106,10 +105,8 @@ static struct device_driver tcm_loop_driverfs = {
106105 */
107106static struct device * tcm_loop_primary ;
108107
109- static void tcm_loop_submission_work (struct work_struct * work )
108+ static void tcm_loop_target_queue_cmd (struct tcm_loop_cmd * tl_cmd )
110109{
111- struct tcm_loop_cmd * tl_cmd =
112- container_of (work , struct tcm_loop_cmd , work );
113110 struct se_cmd * se_cmd = & tl_cmd -> tl_se_cmd ;
114111 struct scsi_cmnd * sc = tl_cmd -> sc ;
115112 struct tcm_loop_nexus * tl_nexus ;
@@ -161,10 +158,10 @@ static void tcm_loop_submission_work(struct work_struct *work)
161158 if (target_submit_prep (se_cmd , sc -> cmnd , scsi_sglist (sc ),
162159 scsi_sg_count (sc ), sgl_bidi , sgl_bidi_count ,
163160 scsi_prot_sglist (sc ), scsi_prot_sg_count (sc ),
164- GFP_NOIO ))
161+ GFP_ATOMIC ))
165162 return ;
166163
167- target_submit (se_cmd );
164+ target_queue_submission (se_cmd );
168165 return ;
169166
170167out_done :
@@ -187,8 +184,8 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
187184 memset (tl_cmd , 0 , sizeof (* tl_cmd ));
188185 tl_cmd -> sc = sc ;
189186 tl_cmd -> sc_cmd_tag = sc -> request -> tag ;
190- INIT_WORK ( & tl_cmd -> work , tcm_loop_submission_work );
191- queue_work ( tcm_loop_workqueue , & tl_cmd -> work );
187+
188+ tcm_loop_target_queue_cmd ( tl_cmd );
192189 return 0 ;
193190}
194191
@@ -1160,17 +1157,13 @@ static int __init tcm_loop_fabric_init(void)
11601157{
11611158 int ret = - ENOMEM ;
11621159
1163- tcm_loop_workqueue = alloc_workqueue ("tcm_loop" , 0 , 0 );
1164- if (!tcm_loop_workqueue )
1165- goto out ;
1166-
11671160 tcm_loop_cmd_cache = kmem_cache_create ("tcm_loop_cmd_cache" ,
11681161 sizeof (struct tcm_loop_cmd ),
11691162 __alignof__(struct tcm_loop_cmd ),
11701163 0 , NULL );
11711164 if (!tcm_loop_cmd_cache ) {
11721165 pr_debug ("kmem_cache_create() for tcm_loop_cmd_cache failed\n" );
1173- goto out_destroy_workqueue ;
1166+ goto out ;
11741167 }
11751168
11761169 ret = tcm_loop_alloc_core_bus ();
@@ -1187,8 +1180,6 @@ static int __init tcm_loop_fabric_init(void)
11871180 tcm_loop_release_core_bus ();
11881181out_destroy_cache :
11891182 kmem_cache_destroy (tcm_loop_cmd_cache );
1190- out_destroy_workqueue :
1191- destroy_workqueue (tcm_loop_workqueue );
11921183out :
11931184 return ret ;
11941185}
@@ -1198,7 +1189,6 @@ static void __exit tcm_loop_fabric_exit(void)
11981189 target_unregister_template (& loop_ops );
11991190 tcm_loop_release_core_bus ();
12001191 kmem_cache_destroy (tcm_loop_cmd_cache );
1201- destroy_workqueue (tcm_loop_workqueue );
12021192}
12031193
12041194MODULE_DESCRIPTION ("TCM loopback virtual Linux/SCSI fabric module" );
0 commit comments