[PATCH 5/16] drivers/scsi: use WARN
From: Julia Lawall julia.law...@lip6.fr Use WARN rather than printk followed by WARN_ON(1), for conciseness. A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression list es; @@ -printk( +WARN(1, es); -WARN_ON(1); // /smpl Signed-off-by: Julia Lawall julia.law...@lip6.fr --- drivers/scsi/initio.c |3 +-- drivers/scsi/scsi_lib.c |3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index dd741bc..1572860 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -2774,8 +2774,7 @@ static void i91uSCBPost(u8 * host_mem, u8 * cblk_mem) host = (struct initio_host *) host_mem; cblk = (struct scsi_ctrl_blk *) cblk_mem; if ((cmnd = cblk-srb) == NULL) { - printk(KERN_ERR i91uSCBPost: SRB pointer is empty\n); - WARN_ON(1); + WARN(1, KERN_ERR i91uSCBPost: SRB pointer is empty\n); initio_release_scb(host, cblk); /* Release SCB for current channel */ return; } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index da36a3a..e5fdcae 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2573,10 +2573,9 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count, } if (unlikely(i == sg_count)) { - printk(KERN_ERR %s: Bytes in sg: %zu, requested offset %zu, + WARN(1, KERN_ERR %s: Bytes in sg: %zu, requested offset %zu, elements %d\n, __func__, sg_len, *offset, sg_count); - WARN_ON(1); return NULL; } -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/16] drivers/scsi/gdth.c: use WARN
From: Julia Lawall julia.law...@lip6.fr Use WARN rather than printk followed by WARN_ON(1), for conciseness. If (count) is also merged into WARN, for further conciseness. A simplified version of the semantic patch that makes part of this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression list es; @@ -printk( +WARN(1, es); -WARN_ON(1); // /smpl Signed-off-by: Julia Lawall julia.law...@lip6.fr --- drivers/scsi/gdth.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 5d72274..0dbcb27 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -2318,11 +2318,10 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, break; buffer += cpnow; } -} else if (count) { -printk(GDT-HA %d: SCSI command with no buffers but data transfer expected!\n, - ha-hanum); -WARN_ON(1); } + else + WARN(count, GDT-HA %d: SCSI command with no buffers but data transfer expected!\n, +ha-hanum); } static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch,v2 04/10] scsi: allocate scsi_cmnd-s from the device's local numa node
On 11/02/12 22:45, Jeff Moyer wrote: diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 2936b44..4db6973 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -173,16 +173,20 @@ static DEFINE_MUTEX(host_cmd_pool_mutex); * NULL on failure */ static struct scsi_cmnd * -scsi_pool_alloc_command(struct scsi_host_cmd_pool *pool, gfp_t gfp_mask) +scsi_pool_alloc_command(struct scsi_host_cmd_pool *pool, gfp_t gfp_mask, + int node) { struct scsi_cmnd *cmd; - cmd = kmem_cache_zalloc(pool-cmd_slab, gfp_mask | pool-gfp_mask); + cmd = kmem_cache_alloc_node(pool-cmd_slab, + gfp_mask | pool-gfp_mask | __GFP_ZERO, + node); if (!cmd) return NULL; - cmd-sense_buffer = kmem_cache_alloc(pool-sense_slab, -gfp_mask | pool-gfp_mask); + cmd-sense_buffer = kmem_cache_alloc_node(pool-sense_slab, + gfp_mask | pool-gfp_mask | __GFP_ZERO, + node); It's not clear to me why __GFP_ZERO is added to the allocation flags ? Bart. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch,v2 05/10] sd: use alloc_disk_node
On 11/02/12 22:45, Jeff Moyer wrote: Signed-off-by: Jeff Moyer jmo...@redhat.com --- drivers/scsi/sd.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 12f6fdf..8deb915 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2714,7 +2714,7 @@ static int sd_probe(struct device *dev) if (!sdkp) goto out; - gd = alloc_disk(SD_MINORS); + gd = alloc_disk_node(SD_MINORS, dev_to_node(dev)); if (!gd) goto out_free; shost-numa_node can be another NUMA node than dev_to_node(dev). Have you considered using shost-numa_node here ? Bart. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/8] drivers/scsi/bfa/bfa_svc.c: drop if around WARN_ON
From: Julia Lawall julia.law...@lip6.fr Just use WARN_ON rather than an if containing only WARN_ON(1). A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) WARN_ON(1); + WARN_ON(e); // /smpl Signed-off-by: Julia Lawall julia.law...@lip6.fr --- drivers/scsi/bfa/bfa_svc.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index 299c1c8..765b8d0 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c @@ -626,8 +626,7 @@ bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, /* * alloc required sgpgs */ - if (n_sgles BFI_SGE_INLINE) - WARN_ON(1); + WARN_ON(n_sgles BFI_SGE_INLINE); } } -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/8] drivers/scsi/scsi_transport_fc.c: drop if around WARN_ON
From: Julia Lawall julia.law...@lip6.fr Just use WARN_ON rather than an if containing only WARN_ON(1). A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) WARN_ON(1); + WARN_ON(e); // /smpl Signed-off-by: Julia Lawall julia.law...@lip6.fr --- drivers/scsi/scsi_transport_fc.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index e894ca7..f54c945 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -1699,9 +1699,8 @@ fc_stat_show(const struct device *dev, char *buf, unsigned long offset) struct fc_host_statistics *stats; ssize_t ret = -ENOENT; - if (offset sizeof(struct fc_host_statistics) || - offset % sizeof(u64) != 0) - WARN_ON(1); + WARN_ON(offset sizeof(struct fc_host_statistics) || + offset % sizeof(u64) != 0); if (i-f-get_fc_host_stats) { stats = (i-f-get_fc_host_stats)(shost); -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8] drivers/scsi/qla2xxx/qla_nx.c: drop if around WARN_ON
From: Julia Lawall julia.law...@lip6.fr Just use WARN_ON rather than an if containing only WARN_ON(1). A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) WARN_ON(1); + WARN_ON(e); // /smpl Signed-off-by: Julia Lawall julia.law...@lip6.fr --- drivers/scsi/qla2xxx/qla_nx.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index f5e297c..4c62a5d 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c @@ -388,8 +388,7 @@ qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off) if ((off = QLA82XX_CRB_PCIX_HOST) (off QLA82XX_CRB_PCIX_HOST2)) { /* We are in first CRB window */ - if (ha-curr_window != 0) - WARN_ON(1); + WARN_ON(ha-curr_window != 0); return off; } -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html