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>
This commit is contained in:
Martin K. Petersen 2024-08-22 21:30:06 -04:00
commit 70302fc7ad
42 changed files with 90 additions and 142 deletions

View File

@ -1856,10 +1856,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
/* Initialize workqueue */ /* Initialize workqueue */
INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work); INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work);
snprintf(ioc->reset_work_q_name, MPT_KOBJ_NAME_LEN, ioc->reset_work_q =
"mpt_poll_%d", ioc->id); alloc_workqueue("mpt_poll_%d", WQ_MEM_RECLAIM, 0, ioc->id);
ioc->reset_work_q = alloc_workqueue(ioc->reset_work_q_name,
WQ_MEM_RECLAIM, 0);
if (!ioc->reset_work_q) { if (!ioc->reset_work_q) {
printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n", printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
ioc->name); ioc->name);
@ -1986,9 +1984,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
INIT_LIST_HEAD(&ioc->fw_event_list); INIT_LIST_HEAD(&ioc->fw_event_list);
spin_lock_init(&ioc->fw_event_lock); spin_lock_init(&ioc->fw_event_lock);
snprintf(ioc->fw_event_q_name, MPT_KOBJ_NAME_LEN, "mpt/%d", ioc->id); ioc->fw_event_q = alloc_workqueue("mpt/%d", WQ_MEM_RECLAIM, 0, ioc->id);
ioc->fw_event_q = alloc_workqueue(ioc->fw_event_q_name,
WQ_MEM_RECLAIM, 0);
if (!ioc->fw_event_q) { if (!ioc->fw_event_q) {
printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n", printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
ioc->name); ioc->name);

View File

@ -729,7 +729,6 @@ typedef struct _MPT_ADAPTER
struct list_head fw_event_list; struct list_head fw_event_list;
spinlock_t fw_event_lock; spinlock_t fw_event_lock;
u8 fw_events_off; /* if '1', then ignore events */ u8 fw_events_off; /* if '1', then ignore events */
char fw_event_q_name[MPT_KOBJ_NAME_LEN];
struct mutex sas_discovery_mutex; struct mutex sas_discovery_mutex;
u8 sas_discovery_runtime; u8 sas_discovery_runtime;
@ -764,7 +763,6 @@ typedef struct _MPT_ADAPTER
u8 fc_link_speed[2]; u8 fc_link_speed[2];
spinlock_t fc_rescan_work_lock; spinlock_t fc_rescan_work_lock;
struct work_struct fc_rescan_work; struct work_struct fc_rescan_work;
char fc_rescan_work_q_name[MPT_KOBJ_NAME_LEN];
struct workqueue_struct *fc_rescan_work_q; struct workqueue_struct *fc_rescan_work_q;
/* driver forced bus resets count */ /* driver forced bus resets count */
@ -778,7 +776,6 @@ typedef struct _MPT_ADAPTER
spinlock_t scsi_lookup_lock; spinlock_t scsi_lookup_lock;
u64 dma_mask; u64 dma_mask;
u32 broadcast_aen_busy; u32 broadcast_aen_busy;
char reset_work_q_name[MPT_KOBJ_NAME_LEN];
struct workqueue_struct *reset_work_q; struct workqueue_struct *reset_work_q;
struct delayed_work fault_reset_work; struct delayed_work fault_reset_work;

View File

@ -1349,11 +1349,8 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* initialize workqueue */ /* initialize workqueue */
snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name), ioc->fc_rescan_work_q = alloc_ordered_workqueue(
"mptfc_wq_%d", sh->host_no); "mptfc_wq_%d", WQ_MEM_RECLAIM, sh->host_no);
ioc->fc_rescan_work_q =
alloc_ordered_workqueue(ioc->fc_rescan_work_q_name,
WQ_MEM_RECLAIM);
if (!ioc->fc_rescan_work_q) { if (!ioc->fc_rescan_work_q) {
error = -ENOMEM; error = -ENOMEM;
goto out_mptfc_host; goto out_mptfc_host;

View File

@ -5528,7 +5528,6 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
struct beiscsi_hba *phba = NULL; struct beiscsi_hba *phba = NULL;
struct be_eq_obj *pbe_eq; struct be_eq_obj *pbe_eq;
unsigned int s_handle; unsigned int s_handle;
char wq_name[20];
int ret, i; int ret, i;
ret = beiscsi_enable_pci(pcidev); ret = beiscsi_enable_pci(pcidev);
@ -5634,9 +5633,8 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0; phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0;
snprintf(wq_name, sizeof(wq_name), "beiscsi_%02x_wq", phba->wq = alloc_workqueue("beiscsi_%02x_wq", WQ_MEM_RECLAIM, 1,
phba->shost->host_no); phba->shost->host_no);
phba->wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, wq_name);
if (!phba->wq) { if (!phba->wq) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : beiscsi_dev_probe-" "BM_%d : beiscsi_dev_probe-"

View File

@ -766,9 +766,8 @@ bfad_thread_workq(struct bfad_s *bfad)
struct bfad_im_s *im = bfad->im; struct bfad_im_s *im = bfad->im;
bfa_trc(bfad, 0); bfa_trc(bfad, 0);
snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d", im->drv_workq = alloc_ordered_workqueue("bfad_wq_%d", WQ_MEM_RECLAIM,
bfad->inst_no); bfad->inst_no);
im->drv_workq = create_singlethread_workqueue(im->drv_workq_name);
if (!im->drv_workq) if (!im->drv_workq)
return BFA_STATUS_FAILED; return BFA_STATUS_FAILED;

View File

@ -134,7 +134,6 @@ struct bfad_fcp_binding {
struct bfad_im_s { struct bfad_im_s {
struct bfad_s *bfad; struct bfad_s *bfad;
struct workqueue_struct *drv_workq; struct workqueue_struct *drv_workq;
char drv_workq_name[KOBJ_NAME_LEN];
struct work_struct aen_im_notify_work; struct work_struct aen_im_notify_work;
}; };

View File

@ -2363,8 +2363,8 @@ static int _bnx2fc_create(struct net_device *netdev,
interface->vlan_id = vlan_id; interface->vlan_id = vlan_id;
interface->tm_timeout = BNX2FC_TM_TIMEOUT; interface->tm_timeout = BNX2FC_TM_TIMEOUT;
interface->timer_work_queue = interface->timer_work_queue = alloc_ordered_workqueue(
create_singlethread_workqueue("bnx2fc_timer_wq"); "%s", WQ_MEM_RECLAIM, "bnx2fc_timer_wq");
if (!interface->timer_work_queue) { if (!interface->timer_work_queue) {
printk(KERN_ERR PFX "ulp_init could not create timer_wq\n"); printk(KERN_ERR PFX "ulp_init could not create timer_wq\n");
rc = -EINVAL; rc = -EINVAL;

View File

@ -822,7 +822,8 @@ static int __init rdac_init(void)
/* /*
* Create workqueue to handle mode selects for rdac * Create workqueue to handle mode selects for rdac
*/ */
kmpath_rdacd = create_singlethread_workqueue("kmpath_rdacd"); kmpath_rdacd =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "kmpath_rdacd");
if (!kmpath_rdacd) { if (!kmpath_rdacd) {
scsi_unregister_device_handler(&rdac_dh); scsi_unregister_device_handler(&rdac_dh);
printk(KERN_ERR "kmpath_rdacd creation failed.\n"); printk(KERN_ERR "kmpath_rdacd creation failed.\n");

View File

@ -1114,7 +1114,8 @@ int efct_scsi_tgt_new_device(struct efct *efct)
atomic_set(&efct->tgt_efct.watermark_hit, 0); atomic_set(&efct->tgt_efct.watermark_hit, 0);
atomic_set(&efct->tgt_efct.initiator_count, 0); atomic_set(&efct->tgt_efct.initiator_count, 0);
lio_wq = create_singlethread_workqueue("efct_lio_worker"); lio_wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
"efct_lio_worker");
if (!lio_wq) { if (!lio_wq) {
efc_log_err(efct, "workqueue create failed\n"); efc_log_err(efct, "workqueue create failed\n");
return -EIO; return -EIO;

View File

@ -929,7 +929,6 @@ struct esas2r_adapter {
struct list_head fw_event_list; struct list_head fw_event_list;
spinlock_t fw_event_lock; spinlock_t fw_event_lock;
u8 fw_events_off; /* if '1', then ignore events */ u8 fw_events_off; /* if '1', then ignore events */
char fw_event_q_name[ESAS2R_KOBJ_NAME_LEN];
/* /*
* intr_mode stores the interrupt mode currently being used by this * intr_mode stores the interrupt mode currently being used by this
* adapter. it is based on the interrupt_mode module parameter, but * adapter. it is based on the interrupt_mode module parameter, but

View File

@ -311,9 +311,8 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
sema_init(&a->nvram_semaphore, 1); sema_init(&a->nvram_semaphore, 1);
esas2r_fw_event_off(a); esas2r_fw_event_off(a);
snprintf(a->fw_event_q_name, ESAS2R_KOBJ_NAME_LEN, "esas2r/%d", a->fw_event_q =
a->index); alloc_ordered_workqueue("esas2r/%d", WQ_MEM_RECLAIM, a->index);
a->fw_event_q = create_singlethread_workqueue(a->fw_event_q_name);
init_waitqueue_head(&a->buffered_ioctl_waiter); init_waitqueue_head(&a->buffered_ioctl_waiter);
init_waitqueue_head(&a->nvram_waiter); init_waitqueue_head(&a->nvram_waiter);

View File

@ -45,12 +45,8 @@ MODULE_PARM_DESC(fcf_dev_loss_tmo,
*/ */
#define fcoe_ctlr_id(x) \ #define fcoe_ctlr_id(x) \
((x)->id) ((x)->id)
#define fcoe_ctlr_work_q_name(x) \
((x)->work_q_name)
#define fcoe_ctlr_work_q(x) \ #define fcoe_ctlr_work_q(x) \
((x)->work_q) ((x)->work_q)
#define fcoe_ctlr_devloss_work_q_name(x) \
((x)->devloss_work_q_name)
#define fcoe_ctlr_devloss_work_q(x) \ #define fcoe_ctlr_devloss_work_q(x) \
((x)->devloss_work_q) ((x)->devloss_work_q)
#define fcoe_ctlr_mode(x) \ #define fcoe_ctlr_mode(x) \
@ -797,18 +793,14 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo;
snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name), ctlr->work_q = alloc_ordered_workqueue("ctlr_wq_%d", WQ_MEM_RECLAIM,
"ctlr_wq_%d", ctlr->id); ctlr->id);
ctlr->work_q = create_singlethread_workqueue(
ctlr->work_q_name);
if (!ctlr->work_q) if (!ctlr->work_q)
goto out_del; goto out_del;
snprintf(ctlr->devloss_work_q_name, ctlr->devloss_work_q = alloc_ordered_workqueue("ctlr_dl_wq_%d",
sizeof(ctlr->devloss_work_q_name), WQ_MEM_RECLAIM,
"ctlr_dl_wq_%d", ctlr->id); ctlr->id);
ctlr->devloss_work_q = create_singlethread_workqueue(
ctlr->devloss_work_q_name);
if (!ctlr->devloss_work_q) if (!ctlr->devloss_work_q)
goto out_del_q; goto out_del_q;

View File

@ -1161,14 +1161,16 @@ static int __init fnic_init_module(void)
goto err_create_fnic_ioreq_slab; goto err_create_fnic_ioreq_slab;
} }
fnic_event_queue = create_singlethread_workqueue("fnic_event_wq"); fnic_event_queue =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fnic_event_wq");
if (!fnic_event_queue) { if (!fnic_event_queue) {
printk(KERN_ERR PFX "fnic work queue create failed\n"); printk(KERN_ERR PFX "fnic work queue create failed\n");
err = -ENOMEM; err = -ENOMEM;
goto err_create_fnic_workq; goto err_create_fnic_workq;
} }
fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); fnic_fip_queue =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fnic_fip_q");
if (!fnic_fip_queue) { if (!fnic_fip_queue) {
printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); printk(KERN_ERR PFX "fnic FIP work queue create failed\n");
err = -ENOMEM; err = -ENOMEM;

View File

@ -2302,7 +2302,8 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba)
hisi_hba->last_slot_index = 0; hisi_hba->last_slot_index = 0;
hisi_hba->wq = create_singlethread_workqueue(dev_name(dev)); hisi_hba->wq =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, dev_name(dev));
if (!hisi_hba->wq) { if (!hisi_hba->wq) {
dev_err(dev, "sas_alloc: failed to create workqueue\n"); dev_err(dev, "sas_alloc: failed to create workqueue\n");
goto err_out; goto err_out;

View File

@ -292,11 +292,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
} }
if (shost->transportt->create_work_queue) { if (shost->transportt->create_work_queue) {
snprintf(shost->work_q_name, sizeof(shost->work_q_name), shost->work_q = alloc_workqueue(
"scsi_wq_%d", shost->host_no); "scsi_wq_%d",
shost->work_q = alloc_workqueue("%s", WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 1,
WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, shost->host_no);
1, shost->work_q_name);
if (!shost->work_q) { if (!shost->work_q) {
error = -EINVAL; error = -EINVAL;

View File

@ -3425,7 +3425,6 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
struct scsi_info *vscsi; struct scsi_info *vscsi;
int rc = 0; int rc = 0;
long hrc = 0; long hrc = 0;
char wq_name[24];
vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL); vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL);
if (!vscsi) { if (!vscsi) {
@ -3536,8 +3535,8 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
init_completion(&vscsi->wait_idle); init_completion(&vscsi->wait_idle);
init_completion(&vscsi->unconfig); init_completion(&vscsi->unconfig);
snprintf(wq_name, 24, "ibmvscsis%s", dev_name(&vdev->dev)); vscsi->work_q = alloc_workqueue("ibmvscsis%s", WQ_MEM_RECLAIM, 1,
vscsi->work_q = create_workqueue(wq_name); dev_name(&vdev->dev));
if (!vscsi->work_q) { if (!vscsi->work_q) {
rc = -ENOMEM; rc = -ENOMEM;
dev_err(&vscsi->dev, "create_workqueue failed\n"); dev_err(&vscsi->dev, "create_workqueue failed\n");

View File

@ -2693,7 +2693,8 @@ int fc_setup_exch_mgr(void)
fc_cpu_order = ilog2(roundup_pow_of_two(nr_cpu_ids)); fc_cpu_order = ilog2(roundup_pow_of_two(nr_cpu_ids));
fc_cpu_mask = (1 << fc_cpu_order) - 1; fc_cpu_mask = (1 << fc_cpu_order) - 1;
fc_exch_workqueue = create_singlethread_workqueue("fc_exch_workqueue"); fc_exch_workqueue = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
"fc_exch_workqueue");
if (!fc_exch_workqueue) if (!fc_exch_workqueue)
goto err; goto err;
return 0; return 0;

View File

@ -2263,7 +2263,8 @@ struct fc4_prov fc_rport_t0_prov = {
*/ */
int fc_setup_rport(void) int fc_setup_rport(void)
{ {
rport_event_queue = create_singlethread_workqueue("fc_rport_eq"); rport_event_queue =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fc_rport_eq");
if (!rport_event_queue) if (!rport_event_queue)
return -ENOMEM; return -ENOMEM;
return 0; return 0;

View File

@ -122,12 +122,12 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
error = -ENOMEM; error = -ENOMEM;
snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev)); snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev));
sas_ha->event_q = create_singlethread_workqueue(name); sas_ha->event_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name);
if (!sas_ha->event_q) if (!sas_ha->event_q)
goto Undo_ports; goto Undo_ports;
snprintf(name, sizeof(name), "%s_disco_q", dev_name(sas_ha->dev)); snprintf(name, sizeof(name), "%s_disco_q", dev_name(sas_ha->dev));
sas_ha->disco_q = create_singlethread_workqueue(name); sas_ha->disco_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name);
if (!sas_ha->disco_q) if (!sas_ha->disco_q)
goto Undo_event_q; goto Undo_event_q;

View File

@ -1988,8 +1988,8 @@ megasas_fusion_start_watchdog(struct megasas_instance *instance)
sizeof(instance->fault_handler_work_q_name), sizeof(instance->fault_handler_work_q_name),
"poll_megasas%d_status", instance->host->host_no); "poll_megasas%d_status", instance->host->host_no);
instance->fw_fault_work_q = instance->fw_fault_work_q = alloc_ordered_workqueue(
create_singlethread_workqueue(instance->fault_handler_work_q_name); "%s", WQ_MEM_RECLAIM, instance->fault_handler_work_q_name);
if (!instance->fw_fault_work_q) { if (!instance->fw_fault_work_q) {
dev_err(&instance->pdev->dev, "Failed from %s %d\n", dev_err(&instance->pdev->dev, "Failed from %s %d\n",
__func__, __LINE__); __func__, __LINE__);

View File

@ -1060,7 +1060,6 @@ struct scmd_priv {
* @sbq_lock: Sense buffer queue lock * @sbq_lock: Sense buffer queue lock
* @sbq_host_index: Sense buffer queuehost index * @sbq_host_index: Sense buffer queuehost index
* @event_masks: Event mask bitmap * @event_masks: Event mask bitmap
* @fwevt_worker_name: Firmware event worker thread name
* @fwevt_worker_thread: Firmware event worker thread * @fwevt_worker_thread: Firmware event worker thread
* @fwevt_lock: Firmware event lock * @fwevt_lock: Firmware event lock
* @fwevt_list: Firmware event list * @fwevt_list: Firmware event list
@ -1241,7 +1240,6 @@ struct mpi3mr_ioc {
u32 sbq_host_index; u32 sbq_host_index;
u32 event_masks[MPI3_EVENT_NOTIFY_EVENTMASK_WORDS]; u32 event_masks[MPI3_EVENT_NOTIFY_EVENTMASK_WORDS];
char fwevt_worker_name[MPI3MR_NAME_LENGTH];
struct workqueue_struct *fwevt_worker_thread; struct workqueue_struct *fwevt_worker_thread;
spinlock_t fwevt_lock; spinlock_t fwevt_lock;
struct list_head fwevt_list; struct list_head fwevt_list;

View File

@ -2760,8 +2760,8 @@ void mpi3mr_start_watchdog(struct mpi3mr_ioc *mrioc)
snprintf(mrioc->watchdog_work_q_name, snprintf(mrioc->watchdog_work_q_name,
sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name, sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name,
mrioc->id); mrioc->id);
mrioc->watchdog_work_q = mrioc->watchdog_work_q = alloc_ordered_workqueue(
create_singlethread_workqueue(mrioc->watchdog_work_q_name); "%s", WQ_MEM_RECLAIM, mrioc->watchdog_work_q_name);
if (!mrioc->watchdog_work_q) { if (!mrioc->watchdog_work_q) {
ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__); ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__);
return; return;

View File

@ -5305,10 +5305,8 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
else else
scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC);
snprintf(mrioc->fwevt_worker_name, sizeof(mrioc->fwevt_worker_name),
"%s%d_fwevt_wrkr", mrioc->driver_name, mrioc->id);
mrioc->fwevt_worker_thread = alloc_ordered_workqueue( mrioc->fwevt_worker_thread = alloc_ordered_workqueue(
mrioc->fwevt_worker_name, 0); "%s%d_fwevt_wrkr", 0, mrioc->driver_name, mrioc->id);
if (!mrioc->fwevt_worker_thread) { if (!mrioc->fwevt_worker_thread) {
ioc_err(mrioc, "failure at %s:%d/%s()!\n", ioc_err(mrioc, "failure at %s:%d/%s()!\n",
__FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);

View File

@ -846,8 +846,8 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc)
snprintf(ioc->fault_reset_work_q_name, snprintf(ioc->fault_reset_work_q_name,
sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status", sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
ioc->driver_name, ioc->id); ioc->driver_name, ioc->id);
ioc->fault_reset_work_q = ioc->fault_reset_work_q = alloc_ordered_workqueue(
create_singlethread_workqueue(ioc->fault_reset_work_q_name); "%s", WQ_MEM_RECLAIM, ioc->fault_reset_work_q_name);
if (!ioc->fault_reset_work_q) { if (!ioc->fault_reset_work_q) {
ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__); ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__);
return; return;

View File

@ -1162,8 +1162,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
* @fault_reset_work_q_name: fw fault work queue * @fault_reset_work_q_name: fw fault work queue
* @fault_reset_work_q: "" * @fault_reset_work_q: ""
* @fault_reset_work: "" * @fault_reset_work: ""
* @firmware_event_name: fw event work queue * @firmware_event_thread: fw event work queue
* @firmware_event_thread: ""
* @fw_event_lock: * @fw_event_lock:
* @fw_event_list: list of fw events * @fw_event_list: list of fw events
* @current_evet: current processing firmware event * @current_evet: current processing firmware event
@ -1351,7 +1350,6 @@ struct MPT3SAS_ADAPTER {
struct delayed_work fault_reset_work; struct delayed_work fault_reset_work;
/* fw event handler */ /* fw event handler */
char firmware_event_name[20];
struct workqueue_struct *firmware_event_thread; struct workqueue_struct *firmware_event_thread;
spinlock_t fw_event_lock; spinlock_t fw_event_lock;
struct list_head fw_event_list; struct list_head fw_event_list;

View File

@ -12301,10 +12301,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC);
/* event thread */ /* event thread */
snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name),
"fw_event_%s%d", ioc->driver_name, ioc->id);
ioc->firmware_event_thread = alloc_ordered_workqueue( ioc->firmware_event_thread = alloc_ordered_workqueue(
ioc->firmware_event_name, 0); "fw_event_%s%d", 0, ioc->driver_name, ioc->id);
if (!ioc->firmware_event_thread) { if (!ioc->firmware_event_thread) {
ioc_err(ioc, "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
__FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);

View File

@ -112,9 +112,8 @@ static bool myrb_create_mempools(struct pci_dev *pdev, struct myrb_hba *cb)
return false; return false;
} }
snprintf(cb->work_q_name, sizeof(cb->work_q_name), cb->work_q = alloc_ordered_workqueue("myrb_wq_%d", WQ_MEM_RECLAIM,
"myrb_wq_%d", cb->host->host_no); cb->host->host_no);
cb->work_q = create_singlethread_workqueue(cb->work_q_name);
if (!cb->work_q) { if (!cb->work_q) {
dma_pool_destroy(cb->dcdb_pool); dma_pool_destroy(cb->dcdb_pool);
cb->dcdb_pool = NULL; cb->dcdb_pool = NULL;

View File

@ -712,7 +712,6 @@ struct myrb_hba {
struct Scsi_Host *host; struct Scsi_Host *host;
struct workqueue_struct *work_q; struct workqueue_struct *work_q;
char work_q_name[20];
struct delayed_work monitor_work; struct delayed_work monitor_work;
unsigned long primary_monitor_time; unsigned long primary_monitor_time;
unsigned long secondary_monitor_time; unsigned long secondary_monitor_time;

View File

@ -2206,9 +2206,8 @@ static bool myrs_create_mempools(struct pci_dev *pdev, struct myrs_hba *cs)
return false; return false;
} }
snprintf(cs->work_q_name, sizeof(cs->work_q_name), cs->work_q = alloc_ordered_workqueue("myrs_wq_%d", WQ_MEM_RECLAIM,
"myrs_wq_%d", shost->host_no); shost->host_no);
cs->work_q = create_singlethread_workqueue(cs->work_q_name);
if (!cs->work_q) { if (!cs->work_q) {
dma_pool_destroy(cs->dcdb_pool); dma_pool_destroy(cs->dcdb_pool);
cs->dcdb_pool = NULL; cs->dcdb_pool = NULL;

View File

@ -904,7 +904,6 @@ struct myrs_hba {
bool disable_enc_msg; bool disable_enc_msg;
struct workqueue_struct *work_q; struct workqueue_struct *work_q;
char work_q_name[20];
struct delayed_work monitor_work; struct delayed_work monitor_work;
unsigned long primary_monitor_time; unsigned long primary_monitor_time;
unsigned long secondary_monitor_time; unsigned long secondary_monitor_time;

View File

@ -3372,9 +3372,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n", QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n",
qedf->io_mempool); qedf->io_mempool);
sprintf(host_buf, "qedf_%u_link", qedf->link_update_wq = alloc_workqueue("qedf_%u_link", WQ_MEM_RECLAIM,
qedf->lport->host->host_no); 1, qedf->lport->host->host_no);
qedf->link_update_wq = create_workqueue(host_buf);
INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update); INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update);
INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery); INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery);
INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump); INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump);
@ -3584,9 +3583,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
ether_addr_copy(params.ll2_mac_address, qedf->mac); ether_addr_copy(params.ll2_mac_address, qedf->mac);
/* Start LL2 processing thread */ /* Start LL2 processing thread */
snprintf(host_buf, 20, "qedf_%d_ll2", host->host_no); qedf->ll2_recv_wq = alloc_workqueue("qedf_%d_ll2", WQ_MEM_RECLAIM, 1,
qedf->ll2_recv_wq = host->host_no);
create_workqueue(host_buf);
if (!qedf->ll2_recv_wq) { if (!qedf->ll2_recv_wq) {
QEDF_ERR(&(qedf->dbg_ctx), "Failed to LL2 workqueue.\n"); QEDF_ERR(&(qedf->dbg_ctx), "Failed to LL2 workqueue.\n");
rc = -ENOMEM; rc = -ENOMEM;
@ -3627,9 +3625,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
} }
} }
sprintf(host_buf, "qedf_%u_timer", qedf->lport->host->host_no); qedf->timer_work_queue = alloc_workqueue("qedf_%u_timer",
qedf->timer_work_queue = WQ_MEM_RECLAIM, 1, qedf->lport->host->host_no);
create_workqueue(host_buf);
if (!qedf->timer_work_queue) { if (!qedf->timer_work_queue) {
QEDF_ERR(&(qedf->dbg_ctx), "Failed to start timer " QEDF_ERR(&(qedf->dbg_ctx), "Failed to start timer "
"workqueue.\n"); "workqueue.\n");
@ -3641,7 +3638,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
if (mode != QEDF_MODE_RECOVERY) { if (mode != QEDF_MODE_RECOVERY) {
sprintf(host_buf, "qedf_%u_dpc", sprintf(host_buf, "qedf_%u_dpc",
qedf->lport->host->host_no); qedf->lport->host->host_no);
qedf->dpc_wq = create_workqueue(host_buf); qedf->dpc_wq =
alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, host_buf);
} }
INIT_DELAYED_WORK(&qedf->recovery_work, qedf_recovery_handler); INIT_DELAYED_WORK(&qedf->recovery_work, qedf_recovery_handler);
@ -4182,7 +4180,7 @@ static int __init qedf_init(void)
goto err3; goto err3;
} }
qedf_io_wq = create_workqueue("qedf_io_wq"); qedf_io_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, "qedf_io_wq");
if (!qedf_io_wq) { if (!qedf_io_wq) {
QEDF_ERR(NULL, "Could not create qedf_io_wq.\n"); QEDF_ERR(NULL, "Could not create qedf_io_wq.\n");
goto err4; goto err4;

View File

@ -2767,7 +2767,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
} }
sprintf(host_buf, "host_%d", qedi->shost->host_no); sprintf(host_buf, "host_%d", qedi->shost->host_no);
qedi->tmf_thread = create_singlethread_workqueue(host_buf); qedi->tmf_thread =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, host_buf);
if (!qedi->tmf_thread) { if (!qedi->tmf_thread) {
QEDI_ERR(&qedi->dbg_ctx, QEDI_ERR(&qedi->dbg_ctx,
"Unable to start tmf thread!\n"); "Unable to start tmf thread!\n");
@ -2775,8 +2776,9 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
goto free_cid_que; goto free_cid_que;
} }
sprintf(host_buf, "qedi_ofld%d", qedi->shost->host_no); qedi->offload_thread = alloc_workqueue("qedi_ofld%d",
qedi->offload_thread = create_workqueue(host_buf); WQ_MEM_RECLAIM,
1, qedi->shost->host_no);
if (!qedi->offload_thread) { if (!qedi->offload_thread) {
QEDI_ERR(&qedi->dbg_ctx, QEDI_ERR(&qedi->dbg_ctx,
"Unable to start offload thread!\n"); "Unable to start offload thread!\n");

View File

@ -3501,11 +3501,13 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) { if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) {
sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no);
ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); ha->dpc_lp_wq =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name);
INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen);
sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no);
ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); ha->dpc_hp_wq =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name);
INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work);
INIT_WORK(&ha->idc_state_handler, INIT_WORK(&ha->idc_state_handler,
qla83xx_idc_state_handler_work); qla83xx_idc_state_handler_work);

View File

@ -8806,7 +8806,7 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev,
DEBUG2(printk("scsi: %s: Starting kernel thread for " DEBUG2(printk("scsi: %s: Starting kernel thread for "
"qla4xxx_dpc\n", __func__)); "qla4xxx_dpc\n", __func__));
sprintf(buf, "qla4xxx_%lu_dpc", ha->host_no); sprintf(buf, "qla4xxx_%lu_dpc", ha->host_no);
ha->dpc_thread = create_singlethread_workqueue(buf); ha->dpc_thread = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, buf);
if (!ha->dpc_thread) { if (!ha->dpc_thread) {
ql4_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n"); ql4_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n");
ret = -ENODEV; ret = -ENODEV;

View File

@ -441,18 +441,13 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
fc_host->next_vport_number = 0; fc_host->next_vport_number = 0;
fc_host->npiv_vports_inuse = 0; fc_host->npiv_vports_inuse = 0;
snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name), fc_host->work_q = alloc_workqueue("fc_wq_%d", 0, 0, shost->host_no);
"fc_wq_%d", shost->host_no);
fc_host->work_q = alloc_workqueue("%s", 0, 0, fc_host->work_q_name);
if (!fc_host->work_q) if (!fc_host->work_q)
return -ENOMEM; return -ENOMEM;
fc_host->dev_loss_tmo = fc_dev_loss_tmo; fc_host->dev_loss_tmo = fc_dev_loss_tmo;
snprintf(fc_host->devloss_work_q_name, fc_host->devloss_work_q = alloc_workqueue("fc_dl_%d", 0, 0,
sizeof(fc_host->devloss_work_q_name), shost->host_no);
"fc_dl_%d", shost->host_no);
fc_host->devloss_work_q = alloc_workqueue("%s", 0, 0,
fc_host->devloss_work_q_name);
if (!fc_host->devloss_work_q) { if (!fc_host->devloss_work_q) {
destroy_workqueue(fc_host->work_q); destroy_workqueue(fc_host->work_q);
fc_host->work_q = NULL; fc_host->work_q = NULL;

View File

@ -300,9 +300,8 @@ snic_add_host(struct Scsi_Host *shost, struct pci_dev *pdev)
} }
SNIC_BUG_ON(shost->work_q != NULL); SNIC_BUG_ON(shost->work_q != NULL);
snprintf(shost->work_q_name, sizeof(shost->work_q_name), "scsi_wq_%d", shost->work_q = alloc_ordered_workqueue("scsi_wq_%d", WQ_MEM_RECLAIM,
shost->host_no); shost->host_no);
shost->work_q = create_singlethread_workqueue(shost->work_q_name);
if (!shost->work_q) { if (!shost->work_q) {
SNIC_HOST_ERR(shost, "Failed to Create ScsiHost wq.\n"); SNIC_HOST_ERR(shost, "Failed to Create ScsiHost wq.\n");
@ -884,7 +883,8 @@ snic_global_data_init(void)
snic_glob->req_cache[SNIC_REQ_TM_CACHE] = cachep; snic_glob->req_cache[SNIC_REQ_TM_CACHE] = cachep;
/* snic_event queue */ /* snic_event queue */
snic_glob->event_q = create_singlethread_workqueue("snic_event_wq"); snic_glob->event_q =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "snic_event_wq");
if (!snic_glob->event_q) { if (!snic_glob->event_q) {
SNIC_ERR("snic event queue create failed\n"); SNIC_ERR("snic event queue create failed\n");
ret = -ENOMEM; ret = -ENOMEM;

View File

@ -334,7 +334,6 @@ struct st_hba {
struct st_ccb *wait_ccb; struct st_ccb *wait_ccb;
__le32 *scratch; __le32 *scratch;
char work_q_name[20];
struct workqueue_struct *work_q; struct workqueue_struct *work_q;
struct work_struct reset_work; struct work_struct reset_work;
wait_queue_head_t reset_waitq; wait_queue_head_t reset_waitq;
@ -1795,9 +1794,8 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
hba->pdev = pdev; hba->pdev = pdev;
init_waitqueue_head(&hba->reset_waitq); init_waitqueue_head(&hba->reset_waitq);
snprintf(hba->work_q_name, sizeof(hba->work_q_name), hba->work_q = alloc_ordered_workqueue("stex_wq_%d", WQ_MEM_RECLAIM,
"stex_wq_%d", host->host_no); host->host_no);
hba->work_q = create_singlethread_workqueue(hba->work_q_name);
if (!hba->work_q) { if (!hba->work_q) {
printk(KERN_ERR DRV_NAME "(%s): create workqueue failed\n", printk(KERN_ERR DRV_NAME "(%s): create workqueue failed\n",
pci_name(pdev)); pci_name(pdev));

View File

@ -1137,7 +1137,8 @@ static int pvscsi_setup_msg_workqueue(struct pvscsi_adapter *adapter)
snprintf(name, sizeof(name), snprintf(name, sizeof(name),
"vmw_pvscsi_wq_%u", adapter->host->host_no); "vmw_pvscsi_wq_%u", adapter->host->host_no);
adapter->workqueue = create_singlethread_workqueue(name); adapter->workqueue =
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name);
if (!adapter->workqueue) { if (!adapter->workqueue) {
printk(KERN_ERR "vmw_pvscsi: failed to create work queue\n"); printk(KERN_ERR "vmw_pvscsi: failed to create work queue\n");
return 0; return 0;

View File

@ -1804,8 +1804,6 @@ static void ufshcd_remove_clk_scaling_sysfs(struct ufs_hba *hba)
static void ufshcd_init_clk_scaling(struct ufs_hba *hba) static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
{ {
char wq_name[sizeof("ufs_clkscaling_00")];
if (!ufshcd_is_clkscaling_supported(hba)) if (!ufshcd_is_clkscaling_supported(hba))
return; return;
@ -1817,9 +1815,8 @@ static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
INIT_WORK(&hba->clk_scaling.resume_work, INIT_WORK(&hba->clk_scaling.resume_work,
ufshcd_clk_scaling_resume_work); ufshcd_clk_scaling_resume_work);
snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d", hba->clk_scaling.workq = alloc_ordered_workqueue(
hba->host->host_no); "ufs_clkscaling_%d", WQ_MEM_RECLAIM, hba->host->host_no);
hba->clk_scaling.workq = create_singlethread_workqueue(wq_name);
hba->clk_scaling.is_initialized = true; hba->clk_scaling.is_initialized = true;
} }
@ -2143,8 +2140,6 @@ static void ufshcd_remove_clk_gating_sysfs(struct ufs_hba *hba)
static void ufshcd_init_clk_gating(struct ufs_hba *hba) static void ufshcd_init_clk_gating(struct ufs_hba *hba)
{ {
char wq_name[sizeof("ufs_clk_gating_00")];
if (!ufshcd_is_clkgating_allowed(hba)) if (!ufshcd_is_clkgating_allowed(hba))
return; return;
@ -2154,10 +2149,9 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba)
INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work); INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work);
INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work); INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work);
snprintf(wq_name, ARRAY_SIZE(wq_name), "ufs_clk_gating_%d", hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(
hba->host->host_no); "ufs_clk_gating_%d", WQ_MEM_RECLAIM | WQ_HIGHPRI,
hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name, hba->host->host_no);
WQ_MEM_RECLAIM | WQ_HIGHPRI);
ufshcd_init_clk_gating_sysfs(hba); ufshcd_init_clk_gating_sysfs(hba);
@ -10394,7 +10388,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
int err; int err;
struct Scsi_Host *host = hba->host; struct Scsi_Host *host = hba->host;
struct device *dev = hba->dev; struct device *dev = hba->dev;
char eh_wq_name[sizeof("ufs_eh_wq_00")];
/* /*
* dev_set_drvdata() must be called before any callbacks are registered * dev_set_drvdata() must be called before any callbacks are registered
@ -10461,9 +10454,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
hba->max_pwr_info.is_valid = false; hba->max_pwr_info.is_valid = false;
/* Initialize work queues */ /* Initialize work queues */
snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d", hba->eh_wq = alloc_ordered_workqueue("ufs_eh_wq_%d", WQ_MEM_RECLAIM,
hba->host->host_no); hba->host->host_no);
hba->eh_wq = create_singlethread_workqueue(eh_wq_name);
if (!hba->eh_wq) { if (!hba->eh_wq) {
dev_err(hba->dev, "%s: failed to create eh workqueue\n", dev_err(hba->dev, "%s: failed to create eh workqueue\n",
__func__); __func__);

View File

@ -50,9 +50,7 @@ struct fcoe_ctlr_device {
struct fcoe_sysfs_function_template *f; struct fcoe_sysfs_function_template *f;
struct list_head fcfs; struct list_head fcfs;
char work_q_name[20];
struct workqueue_struct *work_q; struct workqueue_struct *work_q;
char devloss_work_q_name[20];
struct workqueue_struct *devloss_work_q; struct workqueue_struct *devloss_work_q;
struct mutex lock; struct mutex lock;

View File

@ -677,7 +677,6 @@ struct Scsi_Host {
/* /*
* Optional work queue to be utilized by the transport * Optional work queue to be utilized by the transport
*/ */
char work_q_name[20];
struct workqueue_struct *work_q; struct workqueue_struct *work_q;
/* /*

View File

@ -575,9 +575,7 @@ struct fc_host_attrs {
u16 npiv_vports_inuse; u16 npiv_vports_inuse;
/* work queues for rport state manipulation */ /* work queues for rport state manipulation */
char work_q_name[20];
struct workqueue_struct *work_q; struct workqueue_struct *work_q;
char devloss_work_q_name[20];
struct workqueue_struct *devloss_work_q; struct workqueue_struct *devloss_work_q;
/* bsg support */ /* bsg support */
@ -654,12 +652,8 @@ struct fc_host_attrs {
(((struct fc_host_attrs *)(x)->shost_data)->next_vport_number) (((struct fc_host_attrs *)(x)->shost_data)->next_vport_number)
#define fc_host_npiv_vports_inuse(x) \ #define fc_host_npiv_vports_inuse(x) \
(((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse) (((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse)
#define fc_host_work_q_name(x) \
(((struct fc_host_attrs *)(x)->shost_data)->work_q_name)
#define fc_host_work_q(x) \ #define fc_host_work_q(x) \
(((struct fc_host_attrs *)(x)->shost_data)->work_q) (((struct fc_host_attrs *)(x)->shost_data)->work_q)
#define fc_host_devloss_work_q_name(x) \
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name)
#define fc_host_devloss_work_q(x) \ #define fc_host_devloss_work_q(x) \
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
#define fc_host_dev_loss_tmo(x) \ #define fc_host_dev_loss_tmo(x) \