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

Merge patch series "Simplify multiple create*_workqueue() invocations"

Bart Van Assche <bvanassche@acm.org> says:

Hi Martin,

Multiple SCSI drivers use snprintf() to format a workqueue name before
invoking one of the create*_workqueue() macros. This patch series
simplifies such code by passing the format string and arguments to
alloc_workqueue(). Additionally, the structure members that are only
used as a temporary buffer for formatting workqueue names are
removed. Please consider this patch series for the next merge window.

Thanks,

Bart.

Link: https://lore.kernel.org/r/20240822195944.654691-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+90 -142
+3 -7
drivers/message/fusion/mptbase.c
··· 1856 1856 /* Initialize workqueue */ 1857 1857 INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work); 1858 1858 1859 - snprintf(ioc->reset_work_q_name, MPT_KOBJ_NAME_LEN, 1860 - "mpt_poll_%d", ioc->id); 1861 - ioc->reset_work_q = alloc_workqueue(ioc->reset_work_q_name, 1862 - WQ_MEM_RECLAIM, 0); 1859 + ioc->reset_work_q = 1860 + alloc_workqueue("mpt_poll_%d", WQ_MEM_RECLAIM, 0, ioc->id); 1863 1861 if (!ioc->reset_work_q) { 1864 1862 printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n", 1865 1863 ioc->name); ··· 1984 1986 1985 1987 INIT_LIST_HEAD(&ioc->fw_event_list); 1986 1988 spin_lock_init(&ioc->fw_event_lock); 1987 - snprintf(ioc->fw_event_q_name, MPT_KOBJ_NAME_LEN, "mpt/%d", ioc->id); 1988 - ioc->fw_event_q = alloc_workqueue(ioc->fw_event_q_name, 1989 - WQ_MEM_RECLAIM, 0); 1989 + ioc->fw_event_q = alloc_workqueue("mpt/%d", WQ_MEM_RECLAIM, 0, ioc->id); 1990 1990 if (!ioc->fw_event_q) { 1991 1991 printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n", 1992 1992 ioc->name);
-3
drivers/message/fusion/mptbase.h
··· 729 729 struct list_head fw_event_list; 730 730 spinlock_t fw_event_lock; 731 731 u8 fw_events_off; /* if '1', then ignore events */ 732 - char fw_event_q_name[MPT_KOBJ_NAME_LEN]; 733 732 734 733 struct mutex sas_discovery_mutex; 735 734 u8 sas_discovery_runtime; ··· 763 764 u8 fc_link_speed[2]; 764 765 spinlock_t fc_rescan_work_lock; 765 766 struct work_struct fc_rescan_work; 766 - char fc_rescan_work_q_name[MPT_KOBJ_NAME_LEN]; 767 767 struct workqueue_struct *fc_rescan_work_q; 768 768 769 769 /* driver forced bus resets count */ ··· 776 778 spinlock_t scsi_lookup_lock; 777 779 u64 dma_mask; 778 780 u32 broadcast_aen_busy; 779 - char reset_work_q_name[MPT_KOBJ_NAME_LEN]; 780 781 struct workqueue_struct *reset_work_q; 781 782 struct delayed_work fault_reset_work; 782 783
+2 -5
drivers/message/fusion/mptfc.c
··· 1349 1349 1350 1350 /* initialize workqueue */ 1351 1351 1352 - snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name), 1353 - "mptfc_wq_%d", sh->host_no); 1354 - ioc->fc_rescan_work_q = 1355 - alloc_ordered_workqueue(ioc->fc_rescan_work_q_name, 1356 - WQ_MEM_RECLAIM); 1352 + ioc->fc_rescan_work_q = alloc_ordered_workqueue( 1353 + "mptfc_wq_%d", WQ_MEM_RECLAIM, sh->host_no); 1357 1354 if (!ioc->fc_rescan_work_q) { 1358 1355 error = -ENOMEM; 1359 1356 goto out_mptfc_host;
+2 -4
drivers/scsi/be2iscsi/be_main.c
··· 5528 5528 struct beiscsi_hba *phba = NULL; 5529 5529 struct be_eq_obj *pbe_eq; 5530 5530 unsigned int s_handle; 5531 - char wq_name[20]; 5532 5531 int ret, i; 5533 5532 5534 5533 ret = beiscsi_enable_pci(pcidev); ··· 5633 5634 5634 5635 phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0; 5635 5636 5636 - snprintf(wq_name, sizeof(wq_name), "beiscsi_%02x_wq", 5637 - phba->shost->host_no); 5638 - phba->wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, wq_name); 5637 + phba->wq = alloc_workqueue("beiscsi_%02x_wq", WQ_MEM_RECLAIM, 1, 5638 + phba->shost->host_no); 5639 5639 if (!phba->wq) { 5640 5640 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5641 5641 "BM_%d : beiscsi_dev_probe-"
+2 -3
drivers/scsi/bfa/bfad_im.c
··· 766 766 struct bfad_im_s *im = bfad->im; 767 767 768 768 bfa_trc(bfad, 0); 769 - snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d", 770 - bfad->inst_no); 771 - im->drv_workq = create_singlethread_workqueue(im->drv_workq_name); 769 + im->drv_workq = alloc_ordered_workqueue("bfad_wq_%d", WQ_MEM_RECLAIM, 770 + bfad->inst_no); 772 771 if (!im->drv_workq) 773 772 return BFA_STATUS_FAILED; 774 773
-1
drivers/scsi/bfa/bfad_im.h
··· 134 134 struct bfad_im_s { 135 135 struct bfad_s *bfad; 136 136 struct workqueue_struct *drv_workq; 137 - char drv_workq_name[KOBJ_NAME_LEN]; 138 137 struct work_struct aen_im_notify_work; 139 138 }; 140 139
+2 -2
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
··· 2363 2363 interface->vlan_id = vlan_id; 2364 2364 interface->tm_timeout = BNX2FC_TM_TIMEOUT; 2365 2365 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"); 2368 2368 if (!interface->timer_work_queue) { 2369 2369 printk(KERN_ERR PFX "ulp_init could not create timer_wq\n"); 2370 2370 rc = -EINVAL;
+2 -1
drivers/scsi/device_handler/scsi_dh_rdac.c
··· 822 822 /* 823 823 * Create workqueue to handle mode selects for rdac 824 824 */ 825 - kmpath_rdacd = create_singlethread_workqueue("kmpath_rdacd"); 825 + kmpath_rdacd = 826 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "kmpath_rdacd"); 826 827 if (!kmpath_rdacd) { 827 828 scsi_unregister_device_handler(&rdac_dh); 828 829 printk(KERN_ERR "kmpath_rdacd creation failed.\n");
+2 -1
drivers/scsi/elx/efct/efct_lio.c
··· 1114 1114 atomic_set(&efct->tgt_efct.watermark_hit, 0); 1115 1115 atomic_set(&efct->tgt_efct.initiator_count, 0); 1116 1116 1117 - lio_wq = create_singlethread_workqueue("efct_lio_worker"); 1117 + lio_wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, 1118 + "efct_lio_worker"); 1118 1119 if (!lio_wq) { 1119 1120 efc_log_err(efct, "workqueue create failed\n"); 1120 1121 return -EIO;
-1
drivers/scsi/esas2r/esas2r.h
··· 929 929 struct list_head fw_event_list; 930 930 spinlock_t fw_event_lock; 931 931 u8 fw_events_off; /* if '1', then ignore events */ 932 - char fw_event_q_name[ESAS2R_KOBJ_NAME_LEN]; 933 932 /* 934 933 * intr_mode stores the interrupt mode currently being used by this 935 934 * adapter. it is based on the interrupt_mode module parameter, but
+2 -3
drivers/scsi/esas2r/esas2r_init.c
··· 311 311 sema_init(&a->nvram_semaphore, 1); 312 312 313 313 esas2r_fw_event_off(a); 314 - snprintf(a->fw_event_q_name, ESAS2R_KOBJ_NAME_LEN, "esas2r/%d", 315 - a->index); 316 - a->fw_event_q = create_singlethread_workqueue(a->fw_event_q_name); 314 + a->fw_event_q = 315 + alloc_ordered_workqueue("esas2r/%d", WQ_MEM_RECLAIM, a->index); 317 316 318 317 init_waitqueue_head(&a->buffered_ioctl_waiter); 319 318 init_waitqueue_head(&a->nvram_waiter);
+5 -13
drivers/scsi/fcoe/fcoe_sysfs.c
··· 45 45 */ 46 46 #define fcoe_ctlr_id(x) \ 47 47 ((x)->id) 48 - #define fcoe_ctlr_work_q_name(x) \ 49 - ((x)->work_q_name) 50 48 #define fcoe_ctlr_work_q(x) \ 51 49 ((x)->work_q) 52 - #define fcoe_ctlr_devloss_work_q_name(x) \ 53 - ((x)->devloss_work_q_name) 54 50 #define fcoe_ctlr_devloss_work_q(x) \ 55 51 ((x)->devloss_work_q) 56 52 #define fcoe_ctlr_mode(x) \ ··· 793 797 794 798 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; 795 799 796 - snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name), 797 - "ctlr_wq_%d", ctlr->id); 798 - ctlr->work_q = create_singlethread_workqueue( 799 - ctlr->work_q_name); 800 + ctlr->work_q = alloc_ordered_workqueue("ctlr_wq_%d", WQ_MEM_RECLAIM, 801 + ctlr->id); 800 802 if (!ctlr->work_q) 801 803 goto out_del; 802 804 803 - snprintf(ctlr->devloss_work_q_name, 804 - sizeof(ctlr->devloss_work_q_name), 805 - "ctlr_dl_wq_%d", ctlr->id); 806 - ctlr->devloss_work_q = create_singlethread_workqueue( 807 - ctlr->devloss_work_q_name); 805 + ctlr->devloss_work_q = alloc_ordered_workqueue("ctlr_dl_wq_%d", 806 + WQ_MEM_RECLAIM, 807 + ctlr->id); 808 808 if (!ctlr->devloss_work_q) 809 809 goto out_del_q; 810 810
+4 -2
drivers/scsi/fnic/fnic_main.c
··· 1161 1161 goto err_create_fnic_ioreq_slab; 1162 1162 } 1163 1163 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"); 1165 1166 if (!fnic_event_queue) { 1166 1167 printk(KERN_ERR PFX "fnic work queue create failed\n"); 1167 1168 err = -ENOMEM; 1168 1169 goto err_create_fnic_workq; 1169 1170 } 1170 1171 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"); 1172 1174 if (!fnic_fip_queue) { 1173 1175 printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); 1174 1176 err = -ENOMEM;
+2 -1
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 2302 2302 2303 2303 hisi_hba->last_slot_index = 0; 2304 2304 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)); 2306 2307 if (!hisi_hba->wq) { 2307 2308 dev_err(dev, "sas_alloc: failed to create workqueue\n"); 2308 2309 goto err_out;
+4 -5
drivers/scsi/hosts.c
··· 292 292 } 293 293 294 294 if (shost->transportt->create_work_queue) { 295 - snprintf(shost->work_q_name, sizeof(shost->work_q_name), 296 - "scsi_wq_%d", shost->host_no); 297 - shost->work_q = alloc_workqueue("%s", 298 - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 299 - 1, shost->work_q_name); 295 + shost->work_q = alloc_workqueue( 296 + "scsi_wq_%d", 297 + WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 1, 298 + shost->host_no); 300 299 301 300 if (!shost->work_q) { 302 301 error = -EINVAL;
+2 -3
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
··· 3425 3425 struct scsi_info *vscsi; 3426 3426 int rc = 0; 3427 3427 long hrc = 0; 3428 - char wq_name[24]; 3429 3428 3430 3429 vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL); 3431 3430 if (!vscsi) { ··· 3535 3536 init_completion(&vscsi->wait_idle); 3536 3537 init_completion(&vscsi->unconfig); 3537 3538 3538 - snprintf(wq_name, 24, "ibmvscsis%s", dev_name(&vdev->dev)); 3539 - vscsi->work_q = create_workqueue(wq_name); 3539 + vscsi->work_q = alloc_workqueue("ibmvscsis%s", WQ_MEM_RECLAIM, 1, 3540 + dev_name(&vdev->dev)); 3540 3541 if (!vscsi->work_q) { 3541 3542 rc = -ENOMEM; 3542 3543 dev_err(&vscsi->dev, "create_workqueue failed\n");
+2 -1
drivers/scsi/libfc/fc_exch.c
··· 2693 2693 fc_cpu_order = ilog2(roundup_pow_of_two(nr_cpu_ids)); 2694 2694 fc_cpu_mask = (1 << fc_cpu_order) - 1; 2695 2695 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"); 2697 2698 if (!fc_exch_workqueue) 2698 2699 goto err; 2699 2700 return 0;
+2 -1
drivers/scsi/libfc/fc_rport.c
··· 2263 2263 */ 2264 2264 int fc_setup_rport(void) 2265 2265 { 2266 - rport_event_queue = create_singlethread_workqueue("fc_rport_eq"); 2266 + rport_event_queue = 2267 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fc_rport_eq"); 2267 2268 if (!rport_event_queue) 2268 2269 return -ENOMEM; 2269 2270 return 0;
+2 -2
drivers/scsi/libsas/sas_init.c
··· 122 122 123 123 error = -ENOMEM; 124 124 snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev)); 125 - sas_ha->event_q = create_singlethread_workqueue(name); 125 + sas_ha->event_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); 126 126 if (!sas_ha->event_q) 127 127 goto Undo_ports; 128 128 129 129 snprintf(name, sizeof(name), "%s_disco_q", dev_name(sas_ha->dev)); 130 - sas_ha->disco_q = create_singlethread_workqueue(name); 130 + sas_ha->disco_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); 131 131 if (!sas_ha->disco_q) 132 132 goto Undo_event_q; 133 133
+2 -2
drivers/scsi/megaraid/megaraid_sas_fusion.c
··· 1988 1988 sizeof(instance->fault_handler_work_q_name), 1989 1989 "poll_megasas%d_status", instance->host->host_no); 1990 1990 1991 - instance->fw_fault_work_q = 1992 - create_singlethread_workqueue(instance->fault_handler_work_q_name); 1991 + instance->fw_fault_work_q = alloc_ordered_workqueue( 1992 + "%s", WQ_MEM_RECLAIM, instance->fault_handler_work_q_name); 1993 1993 if (!instance->fw_fault_work_q) { 1994 1994 dev_err(&instance->pdev->dev, "Failed from %s %d\n", 1995 1995 __func__, __LINE__);
-2
drivers/scsi/mpi3mr/mpi3mr.h
··· 1060 1060 * @sbq_lock: Sense buffer queue lock 1061 1061 * @sbq_host_index: Sense buffer queuehost index 1062 1062 * @event_masks: Event mask bitmap 1063 - * @fwevt_worker_name: Firmware event worker thread name 1064 1063 * @fwevt_worker_thread: Firmware event worker thread 1065 1064 * @fwevt_lock: Firmware event lock 1066 1065 * @fwevt_list: Firmware event list ··· 1240 1241 u32 sbq_host_index; 1241 1242 u32 event_masks[MPI3_EVENT_NOTIFY_EVENTMASK_WORDS]; 1242 1243 1243 - char fwevt_worker_name[MPI3MR_NAME_LENGTH]; 1244 1244 struct workqueue_struct *fwevt_worker_thread; 1245 1245 spinlock_t fwevt_lock; 1246 1246 struct list_head fwevt_list;
+2 -2
drivers/scsi/mpi3mr/mpi3mr_fw.c
··· 2760 2760 snprintf(mrioc->watchdog_work_q_name, 2761 2761 sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name, 2762 2762 mrioc->id); 2763 - mrioc->watchdog_work_q = 2764 - create_singlethread_workqueue(mrioc->watchdog_work_q_name); 2763 + mrioc->watchdog_work_q = alloc_ordered_workqueue( 2764 + "%s", WQ_MEM_RECLAIM, mrioc->watchdog_work_q_name); 2765 2765 if (!mrioc->watchdog_work_q) { 2766 2766 ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__); 2767 2767 return;
+1 -3
drivers/scsi/mpi3mr/mpi3mr_os.c
··· 5305 5305 else 5306 5306 scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); 5307 5307 5308 - snprintf(mrioc->fwevt_worker_name, sizeof(mrioc->fwevt_worker_name), 5309 - "%s%d_fwevt_wrkr", mrioc->driver_name, mrioc->id); 5310 5308 mrioc->fwevt_worker_thread = alloc_ordered_workqueue( 5311 - mrioc->fwevt_worker_name, 0); 5309 + "%s%d_fwevt_wrkr", 0, mrioc->driver_name, mrioc->id); 5312 5310 if (!mrioc->fwevt_worker_thread) { 5313 5311 ioc_err(mrioc, "failure at %s:%d/%s()!\n", 5314 5312 __FILE__, __LINE__, __func__);
+2 -2
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 846 846 snprintf(ioc->fault_reset_work_q_name, 847 847 sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status", 848 848 ioc->driver_name, ioc->id); 849 - ioc->fault_reset_work_q = 850 - create_singlethread_workqueue(ioc->fault_reset_work_q_name); 849 + ioc->fault_reset_work_q = alloc_ordered_workqueue( 850 + "%s", WQ_MEM_RECLAIM, ioc->fault_reset_work_q_name); 851 851 if (!ioc->fault_reset_work_q) { 852 852 ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__); 853 853 return;
+1 -3
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 1162 1162 * @fault_reset_work_q_name: fw fault work queue 1163 1163 * @fault_reset_work_q: "" 1164 1164 * @fault_reset_work: "" 1165 - * @firmware_event_name: fw event work queue 1166 - * @firmware_event_thread: "" 1165 + * @firmware_event_thread: fw event work queue 1167 1166 * @fw_event_lock: 1168 1167 * @fw_event_list: list of fw events 1169 1168 * @current_evet: current processing firmware event ··· 1350 1351 struct delayed_work fault_reset_work; 1351 1352 1352 1353 /* fw event handler */ 1353 - char firmware_event_name[20]; 1354 1354 struct workqueue_struct *firmware_event_thread; 1355 1355 spinlock_t fw_event_lock; 1356 1356 struct list_head fw_event_list;
+1 -3
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 12301 12301 scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); 12302 12302 12303 12303 /* event thread */ 12304 - snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), 12305 - "fw_event_%s%d", ioc->driver_name, ioc->id); 12306 12304 ioc->firmware_event_thread = alloc_ordered_workqueue( 12307 - ioc->firmware_event_name, 0); 12305 + "fw_event_%s%d", 0, ioc->driver_name, ioc->id); 12308 12306 if (!ioc->firmware_event_thread) { 12309 12307 ioc_err(ioc, "failure at %s:%d/%s()!\n", 12310 12308 __FILE__, __LINE__, __func__);
+2 -3
drivers/scsi/myrb.c
··· 112 112 return false; 113 113 } 114 114 115 - snprintf(cb->work_q_name, sizeof(cb->work_q_name), 116 - "myrb_wq_%d", cb->host->host_no); 117 - cb->work_q = create_singlethread_workqueue(cb->work_q_name); 115 + cb->work_q = alloc_ordered_workqueue("myrb_wq_%d", WQ_MEM_RECLAIM, 116 + cb->host->host_no); 118 117 if (!cb->work_q) { 119 118 dma_pool_destroy(cb->dcdb_pool); 120 119 cb->dcdb_pool = NULL;
-1
drivers/scsi/myrb.h
··· 712 712 struct Scsi_Host *host; 713 713 714 714 struct workqueue_struct *work_q; 715 - char work_q_name[20]; 716 715 struct delayed_work monitor_work; 717 716 unsigned long primary_monitor_time; 718 717 unsigned long secondary_monitor_time;
+2 -3
drivers/scsi/myrs.c
··· 2206 2206 return false; 2207 2207 } 2208 2208 2209 - snprintf(cs->work_q_name, sizeof(cs->work_q_name), 2210 - "myrs_wq_%d", shost->host_no); 2211 - cs->work_q = create_singlethread_workqueue(cs->work_q_name); 2209 + cs->work_q = alloc_ordered_workqueue("myrs_wq_%d", WQ_MEM_RECLAIM, 2210 + shost->host_no); 2212 2211 if (!cs->work_q) { 2213 2212 dma_pool_destroy(cs->dcdb_pool); 2214 2213 cs->dcdb_pool = NULL;
-1
drivers/scsi/myrs.h
··· 904 904 bool disable_enc_msg; 905 905 906 906 struct workqueue_struct *work_q; 907 - char work_q_name[20]; 908 907 struct delayed_work monitor_work; 909 908 unsigned long primary_monitor_time; 910 909 unsigned long secondary_monitor_time;
+9 -11
drivers/scsi/qedf/qedf_main.c
··· 3372 3372 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n", 3373 3373 qedf->io_mempool); 3374 3374 3375 - sprintf(host_buf, "qedf_%u_link", 3376 - qedf->lport->host->host_no); 3377 - qedf->link_update_wq = create_workqueue(host_buf); 3375 + qedf->link_update_wq = alloc_workqueue("qedf_%u_link", WQ_MEM_RECLAIM, 3376 + 1, qedf->lport->host->host_no); 3378 3377 INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update); 3379 3378 INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery); 3380 3379 INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump); ··· 3583 3584 ether_addr_copy(params.ll2_mac_address, qedf->mac); 3584 3585 3585 3586 /* Start LL2 processing thread */ 3586 - snprintf(host_buf, 20, "qedf_%d_ll2", host->host_no); 3587 - qedf->ll2_recv_wq = 3588 - create_workqueue(host_buf); 3587 + qedf->ll2_recv_wq = alloc_workqueue("qedf_%d_ll2", WQ_MEM_RECLAIM, 1, 3588 + host->host_no); 3589 3589 if (!qedf->ll2_recv_wq) { 3590 3590 QEDF_ERR(&(qedf->dbg_ctx), "Failed to LL2 workqueue.\n"); 3591 3591 rc = -ENOMEM; ··· 3625 3627 } 3626 3628 } 3627 3629 3628 - sprintf(host_buf, "qedf_%u_timer", qedf->lport->host->host_no); 3629 - qedf->timer_work_queue = 3630 - create_workqueue(host_buf); 3630 + qedf->timer_work_queue = alloc_workqueue("qedf_%u_timer", 3631 + WQ_MEM_RECLAIM, 1, qedf->lport->host->host_no); 3631 3632 if (!qedf->timer_work_queue) { 3632 3633 QEDF_ERR(&(qedf->dbg_ctx), "Failed to start timer " 3633 3634 "workqueue.\n"); ··· 3638 3641 if (mode != QEDF_MODE_RECOVERY) { 3639 3642 sprintf(host_buf, "qedf_%u_dpc", 3640 3643 qedf->lport->host->host_no); 3641 - qedf->dpc_wq = create_workqueue(host_buf); 3644 + qedf->dpc_wq = 3645 + alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, host_buf); 3642 3646 } 3643 3647 INIT_DELAYED_WORK(&qedf->recovery_work, qedf_recovery_handler); 3644 3648 ··· 4180 4182 goto err3; 4181 4183 } 4182 4184 4183 - qedf_io_wq = create_workqueue("qedf_io_wq"); 4185 + qedf_io_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, "qedf_io_wq"); 4184 4186 if (!qedf_io_wq) { 4185 4187 QEDF_ERR(NULL, "Could not create qedf_io_wq.\n"); 4186 4188 goto err4;
+5 -3
drivers/scsi/qedi/qedi_main.c
··· 2767 2767 } 2768 2768 2769 2769 sprintf(host_buf, "host_%d", qedi->shost->host_no); 2770 - qedi->tmf_thread = create_singlethread_workqueue(host_buf); 2770 + qedi->tmf_thread = 2771 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, host_buf); 2771 2772 if (!qedi->tmf_thread) { 2772 2773 QEDI_ERR(&qedi->dbg_ctx, 2773 2774 "Unable to start tmf thread!\n"); ··· 2776 2775 goto free_cid_que; 2777 2776 } 2778 2777 2779 - sprintf(host_buf, "qedi_ofld%d", qedi->shost->host_no); 2780 - qedi->offload_thread = create_workqueue(host_buf); 2778 + qedi->offload_thread = alloc_workqueue("qedi_ofld%d", 2779 + WQ_MEM_RECLAIM, 2780 + 1, qedi->shost->host_no); 2781 2781 if (!qedi->offload_thread) { 2782 2782 QEDI_ERR(&qedi->dbg_ctx, 2783 2783 "Unable to start offload thread!\n");
+4 -2
drivers/scsi/qla2xxx/qla_os.c
··· 3501 3501 3502 3502 if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) { 3503 3503 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); 3504 - ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); 3504 + ha->dpc_lp_wq = 3505 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name); 3505 3506 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); 3506 3507 3507 3508 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); 3508 - ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); 3509 + ha->dpc_hp_wq = 3510 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name); 3509 3511 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); 3510 3512 INIT_WORK(&ha->idc_state_handler, 3511 3513 qla83xx_idc_state_handler_work);
+1 -1
drivers/scsi/qla4xxx/ql4_os.c
··· 8806 8806 DEBUG2(printk("scsi: %s: Starting kernel thread for " 8807 8807 "qla4xxx_dpc\n", __func__)); 8808 8808 sprintf(buf, "qla4xxx_%lu_dpc", ha->host_no); 8809 - ha->dpc_thread = create_singlethread_workqueue(buf); 8809 + ha->dpc_thread = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, buf); 8810 8810 if (!ha->dpc_thread) { 8811 8811 ql4_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n"); 8812 8812 ret = -ENODEV;
+3 -8
drivers/scsi/scsi_transport_fc.c
··· 441 441 fc_host->next_vport_number = 0; 442 442 fc_host->npiv_vports_inuse = 0; 443 443 444 - snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name), 445 - "fc_wq_%d", shost->host_no); 446 - fc_host->work_q = alloc_workqueue("%s", 0, 0, fc_host->work_q_name); 444 + fc_host->work_q = alloc_workqueue("fc_wq_%d", 0, 0, shost->host_no); 447 445 if (!fc_host->work_q) 448 446 return -ENOMEM; 449 447 450 448 fc_host->dev_loss_tmo = fc_dev_loss_tmo; 451 - snprintf(fc_host->devloss_work_q_name, 452 - sizeof(fc_host->devloss_work_q_name), 453 - "fc_dl_%d", shost->host_no); 454 - fc_host->devloss_work_q = alloc_workqueue("%s", 0, 0, 455 - fc_host->devloss_work_q_name); 449 + fc_host->devloss_work_q = alloc_workqueue("fc_dl_%d", 0, 0, 450 + shost->host_no); 456 451 if (!fc_host->devloss_work_q) { 457 452 destroy_workqueue(fc_host->work_q); 458 453 fc_host->work_q = NULL;
+4 -4
drivers/scsi/snic/snic_main.c
··· 300 300 } 301 301 302 302 SNIC_BUG_ON(shost->work_q != NULL); 303 - snprintf(shost->work_q_name, sizeof(shost->work_q_name), "scsi_wq_%d", 304 - shost->host_no); 305 - shost->work_q = create_singlethread_workqueue(shost->work_q_name); 303 + shost->work_q = alloc_ordered_workqueue("scsi_wq_%d", WQ_MEM_RECLAIM, 304 + shost->host_no); 306 305 if (!shost->work_q) { 307 306 SNIC_HOST_ERR(shost, "Failed to Create ScsiHost wq.\n"); 308 307 ··· 883 884 snic_glob->req_cache[SNIC_REQ_TM_CACHE] = cachep; 884 885 885 886 /* snic_event queue */ 886 - snic_glob->event_q = create_singlethread_workqueue("snic_event_wq"); 887 + snic_glob->event_q = 888 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "snic_event_wq"); 887 889 if (!snic_glob->event_q) { 888 890 SNIC_ERR("snic event queue create failed\n"); 889 891 ret = -ENOMEM;
+2 -4
drivers/scsi/stex.c
··· 334 334 struct st_ccb *wait_ccb; 335 335 __le32 *scratch; 336 336 337 - char work_q_name[20]; 338 337 struct workqueue_struct *work_q; 339 338 struct work_struct reset_work; 340 339 wait_queue_head_t reset_waitq; ··· 1794 1795 hba->pdev = pdev; 1795 1796 init_waitqueue_head(&hba->reset_waitq); 1796 1797 1797 - snprintf(hba->work_q_name, sizeof(hba->work_q_name), 1798 - "stex_wq_%d", host->host_no); 1799 - hba->work_q = create_singlethread_workqueue(hba->work_q_name); 1798 + hba->work_q = alloc_ordered_workqueue("stex_wq_%d", WQ_MEM_RECLAIM, 1799 + host->host_no); 1800 1800 if (!hba->work_q) { 1801 1801 printk(KERN_ERR DRV_NAME "(%s): create workqueue failed\n", 1802 1802 pci_name(pdev));
+2 -1
drivers/scsi/vmw_pvscsi.c
··· 1137 1137 snprintf(name, sizeof(name), 1138 1138 "vmw_pvscsi_wq_%u", adapter->host->host_no); 1139 1139 1140 - adapter->workqueue = create_singlethread_workqueue(name); 1140 + adapter->workqueue = 1141 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); 1141 1142 if (!adapter->workqueue) { 1142 1143 printk(KERN_ERR "vmw_pvscsi: failed to create work queue\n"); 1143 1144 return 0;
+7 -15
drivers/ufs/core/ufshcd.c
··· 1804 1804 1805 1805 static void ufshcd_init_clk_scaling(struct ufs_hba *hba) 1806 1806 { 1807 - char wq_name[sizeof("ufs_clkscaling_00")]; 1808 - 1809 1807 if (!ufshcd_is_clkscaling_supported(hba)) 1810 1808 return; 1811 1809 ··· 1815 1817 INIT_WORK(&hba->clk_scaling.resume_work, 1816 1818 ufshcd_clk_scaling_resume_work); 1817 1819 1818 - snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d", 1819 - hba->host->host_no); 1820 - hba->clk_scaling.workq = create_singlethread_workqueue(wq_name); 1820 + hba->clk_scaling.workq = alloc_ordered_workqueue( 1821 + "ufs_clkscaling_%d", WQ_MEM_RECLAIM, hba->host->host_no); 1821 1822 1822 1823 hba->clk_scaling.is_initialized = true; 1823 1824 } ··· 2140 2143 2141 2144 static void ufshcd_init_clk_gating(struct ufs_hba *hba) 2142 2145 { 2143 - char wq_name[sizeof("ufs_clk_gating_00")]; 2144 - 2145 2146 if (!ufshcd_is_clkgating_allowed(hba)) 2146 2147 return; 2147 2148 ··· 2149 2154 INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work); 2150 2155 INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work); 2151 2156 2152 - snprintf(wq_name, ARRAY_SIZE(wq_name), "ufs_clk_gating_%d", 2153 - hba->host->host_no); 2154 - hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name, 2155 - WQ_MEM_RECLAIM | WQ_HIGHPRI); 2157 + hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue( 2158 + "ufs_clk_gating_%d", WQ_MEM_RECLAIM | WQ_HIGHPRI, 2159 + hba->host->host_no); 2156 2160 2157 2161 ufshcd_init_clk_gating_sysfs(hba); 2158 2162 ··· 10388 10394 int err; 10389 10395 struct Scsi_Host *host = hba->host; 10390 10396 struct device *dev = hba->dev; 10391 - char eh_wq_name[sizeof("ufs_eh_wq_00")]; 10392 10397 10393 10398 /* 10394 10399 * dev_set_drvdata() must be called before any callbacks are registered ··· 10454 10461 hba->max_pwr_info.is_valid = false; 10455 10462 10456 10463 /* Initialize work queues */ 10457 - snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d", 10458 - hba->host->host_no); 10459 - hba->eh_wq = create_singlethread_workqueue(eh_wq_name); 10464 + hba->eh_wq = alloc_ordered_workqueue("ufs_eh_wq_%d", WQ_MEM_RECLAIM, 10465 + hba->host->host_no); 10460 10466 if (!hba->eh_wq) { 10461 10467 dev_err(hba->dev, "%s: failed to create eh workqueue\n", 10462 10468 __func__);
-2
include/scsi/fcoe_sysfs.h
··· 50 50 struct fcoe_sysfs_function_template *f; 51 51 52 52 struct list_head fcfs; 53 - char work_q_name[20]; 54 53 struct workqueue_struct *work_q; 55 - char devloss_work_q_name[20]; 56 54 struct workqueue_struct *devloss_work_q; 57 55 struct mutex lock; 58 56
-1
include/scsi/scsi_host.h
··· 677 677 /* 678 678 * Optional work queue to be utilized by the transport 679 679 */ 680 - char work_q_name[20]; 681 680 struct workqueue_struct *work_q; 682 681 683 682 /*
-6
include/scsi/scsi_transport_fc.h
··· 575 575 u16 npiv_vports_inuse; 576 576 577 577 /* work queues for rport state manipulation */ 578 - char work_q_name[20]; 579 578 struct workqueue_struct *work_q; 580 - char devloss_work_q_name[20]; 581 579 struct workqueue_struct *devloss_work_q; 582 580 583 581 /* bsg support */ ··· 652 654 (((struct fc_host_attrs *)(x)->shost_data)->next_vport_number) 653 655 #define fc_host_npiv_vports_inuse(x) \ 654 656 (((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse) 655 - #define fc_host_work_q_name(x) \ 656 - (((struct fc_host_attrs *)(x)->shost_data)->work_q_name) 657 657 #define fc_host_work_q(x) \ 658 658 (((struct fc_host_attrs *)(x)->shost_data)->work_q) 659 - #define fc_host_devloss_work_q_name(x) \ 660 - (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name) 661 659 #define fc_host_devloss_work_q(x) \ 662 660 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) 663 661 #define fc_host_dev_loss_tmo(x) \