Skip to content

Commit b97c074

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: Expand all create*_workqueue() invocations
The workqueue maintainer wants to remove the create*_workqueue() macros because these macros always set the WQ_MEM_RECLAIM flag and because these only support literal workqueue names. Hence this patch that replaces the create*_workqueue() invocations with the definition of this macro. The WQ_MEM_RECLAIM flag has been retained because I think that flag is necessary for workqueues created by storage drivers. This patch has been generated by running spatch and git clang-format. spatch has been invoked as follows: spatch --in-place --sp-file expand-create-workqueue.spatch $(git grep -lEw 'create_(freezable_|singlethread_|)workqueue' */scsi */ufs) The contents of the expand-create-workqueue.spatch file is as follows: @@ expression name; @@ -create_workqueue(name) +alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, name) @@ expression name; @@ -create_freezable_workqueue(name) +alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1, name) @@ expression name; @@ -create_singlethread_workqueue(name) +alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name) Reviewed-by: Peter Wang <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8400291 commit b97c074

File tree

25 files changed

+64
-43
lines changed

25 files changed

+64
-43
lines changed

drivers/scsi/bfa/bfad_im.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,8 @@ bfad_thread_workq(struct bfad_s *bfad)
768768
bfa_trc(bfad, 0);
769769
snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d",
770770
bfad->inst_no);
771-
im->drv_workq = create_singlethread_workqueue(im->drv_workq_name);
771+
im->drv_workq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
772+
im->drv_workq_name);
772773
if (!im->drv_workq)
773774
return BFA_STATUS_FAILED;
774775

drivers/scsi/bnx2fc/bnx2fc_fcoe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,8 +2363,8 @@ static int _bnx2fc_create(struct net_device *netdev,
23632363
interface->vlan_id = vlan_id;
23642364
interface->tm_timeout = BNX2FC_TM_TIMEOUT;
23652365

2366-
interface->timer_work_queue =
2367-
create_singlethread_workqueue("bnx2fc_timer_wq");
2366+
interface->timer_work_queue = alloc_ordered_workqueue(
2367+
"%s", WQ_MEM_RECLAIM, "bnx2fc_timer_wq");
23682368
if (!interface->timer_work_queue) {
23692369
printk(KERN_ERR PFX "ulp_init could not create timer_wq\n");
23702370
rc = -EINVAL;

drivers/scsi/device_handler/scsi_dh_rdac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ static int __init rdac_init(void)
822822
/*
823823
* Create workqueue to handle mode selects for rdac
824824
*/
825-
kmpath_rdacd = create_singlethread_workqueue("kmpath_rdacd");
825+
kmpath_rdacd =
826+
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "kmpath_rdacd");
826827
if (!kmpath_rdacd) {
827828
scsi_unregister_device_handler(&rdac_dh);
828829
printk(KERN_ERR "kmpath_rdacd creation failed.\n");

drivers/scsi/elx/efct/efct_lio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,8 @@ int efct_scsi_tgt_new_device(struct efct *efct)
11141114
atomic_set(&efct->tgt_efct.watermark_hit, 0);
11151115
atomic_set(&efct->tgt_efct.initiator_count, 0);
11161116

1117-
lio_wq = create_singlethread_workqueue("efct_lio_worker");
1117+
lio_wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
1118+
"efct_lio_worker");
11181119
if (!lio_wq) {
11191120
efc_log_err(efct, "workqueue create failed\n");
11201121
return -EIO;

drivers/scsi/esas2r/esas2r_init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
313313
esas2r_fw_event_off(a);
314314
snprintf(a->fw_event_q_name, ESAS2R_KOBJ_NAME_LEN, "esas2r/%d",
315315
a->index);
316-
a->fw_event_q = create_singlethread_workqueue(a->fw_event_q_name);
316+
a->fw_event_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
317+
a->fw_event_q_name);
317318

318319
init_waitqueue_head(&a->buffered_ioctl_waiter);
319320
init_waitqueue_head(&a->nvram_waiter);

drivers/scsi/fcoe/fcoe_sysfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,16 +799,16 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
799799

800800
snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name),
801801
"ctlr_wq_%d", ctlr->id);
802-
ctlr->work_q = create_singlethread_workqueue(
803-
ctlr->work_q_name);
802+
ctlr->work_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
803+
ctlr->work_q_name);
804804
if (!ctlr->work_q)
805805
goto out_del;
806806

807807
snprintf(ctlr->devloss_work_q_name,
808808
sizeof(ctlr->devloss_work_q_name),
809809
"ctlr_dl_wq_%d", ctlr->id);
810-
ctlr->devloss_work_q = create_singlethread_workqueue(
811-
ctlr->devloss_work_q_name);
810+
ctlr->devloss_work_q = alloc_ordered_workqueue(
811+
"%s", WQ_MEM_RECLAIM, ctlr->devloss_work_q_name);
812812
if (!ctlr->devloss_work_q)
813813
goto out_del_q;
814814

drivers/scsi/fnic/fnic_main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,14 +1161,16 @@ static int __init fnic_init_module(void)
11611161
goto err_create_fnic_ioreq_slab;
11621162
}
11631163

1164-
fnic_event_queue = create_singlethread_workqueue("fnic_event_wq");
1164+
fnic_event_queue =
1165+
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fnic_event_wq");
11651166
if (!fnic_event_queue) {
11661167
printk(KERN_ERR PFX "fnic work queue create failed\n");
11671168
err = -ENOMEM;
11681169
goto err_create_fnic_workq;
11691170
}
11701171

1171-
fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q");
1172+
fnic_fip_queue =
1173+
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fnic_fip_q");
11721174
if (!fnic_fip_queue) {
11731175
printk(KERN_ERR PFX "fnic FIP work queue create failed\n");
11741176
err = -ENOMEM;

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,8 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba)
23022302

23032303
hisi_hba->last_slot_index = 0;
23042304

2305-
hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));
2305+
hisi_hba->wq =
2306+
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, dev_name(dev));
23062307
if (!hisi_hba->wq) {
23072308
dev_err(dev, "sas_alloc: failed to create workqueue\n");
23082309
goto err_out;

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3537,7 +3537,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
35373537
init_completion(&vscsi->unconfig);
35383538

35393539
snprintf(wq_name, 24, "ibmvscsis%s", dev_name(&vdev->dev));
3540-
vscsi->work_q = create_workqueue(wq_name);
3540+
vscsi->work_q = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, wq_name);
35413541
if (!vscsi->work_q) {
35423542
rc = -ENOMEM;
35433543
dev_err(&vscsi->dev, "create_workqueue failed\n");

drivers/scsi/libfc/fc_exch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,8 @@ int fc_setup_exch_mgr(void)
26932693
fc_cpu_order = ilog2(roundup_pow_of_two(nr_cpu_ids));
26942694
fc_cpu_mask = (1 << fc_cpu_order) - 1;
26952695

2696-
fc_exch_workqueue = create_singlethread_workqueue("fc_exch_workqueue");
2696+
fc_exch_workqueue = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
2697+
"fc_exch_workqueue");
26972698
if (!fc_exch_workqueue)
26982699
goto err;
26992700
return 0;

0 commit comments

Comments
 (0)