From d77d19286f9023a3b1086f8c3113cf0d732130fd Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 1 Apr 2011 17:43:46 +0000 Subject: [PATCH] TRACE_OUT_OF_MEM cleanups git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3329 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 4 ++-- qla2x00t/qla2x00-target/qla2x00t.c | 7 +++---- scst/src/dev_handlers/scst_cdrom.c | 7 ++++--- scst/src/dev_handlers/scst_disk.c | 7 ++++--- scst/src/dev_handlers/scst_modisk.c | 7 ++++--- scst/src/dev_handlers/scst_tape.c | 7 ++++--- scst/src/dev_handlers/scst_vdisk.c | 13 +++++-------- scst/src/scst_lib.c | 14 +++++--------- scst/src/scst_main.c | 6 +++--- scst/src/scst_mem.c | 5 +++-- scst/src/scst_proc.c | 4 ++-- 11 files changed, 39 insertions(+), 42 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 8e2396abf..70171503d 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1705,8 +1705,8 @@ static int nop_out_start(struct iscsi_cmnd *cmnd) cmnd->sg = sg = scst_alloc(size, GFP_KERNEL, &cmnd->sg_cnt); if (sg == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Allocating buffer for" - " %d Nop-Out payload failed", size); + TRACE(TRACE_OUT_OF_MEM, "Allocation of buffer " + "for %d Nop-Out payload failed", size); err = -ISCSI_REASON_OUT_OF_RESOURCES; goto out; } diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 78debb689..d76def414 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -5306,8 +5306,8 @@ static int q2t_get_target_name(uint8_t *wwn, char **ppwwn_name) name = kmalloc(wwn_len, GFP_KERNEL); if (name == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "qla2x00t: Allocation of tgt " - "name failed"); + PRINT_ERROR("qla2x00t: Allocation of tgt wwn name (size %d) " + "failed", wwn_len); res = -ENOMEM; goto out; } @@ -5709,8 +5709,7 @@ static int q2t_add_target(scsi_qla_host_t *ha) tgt = kzalloc(sizeof(*tgt), GFP_KERNEL); if (tgt == NULL) { - TRACE(TRACE_OUT_OF_MEM, "qla2x00t: %s", "Allocation of tgt " - "failed"); + PRINT_ERROR("qla2x00t: %s", "Allocation of tgt failed"); res = -ENOMEM; goto out; } diff --git a/scst/src/dev_handlers/scst_cdrom.c b/scst/src/dev_handlers/scst_cdrom.c index 6c72eea13..7f709ea15 100644 --- a/scst/src/dev_handlers/scst_cdrom.c +++ b/scst/src/dev_handlers/scst_cdrom.c @@ -83,15 +83,16 @@ static int cdrom_attach(struct scst_device *dev) params = kzalloc(sizeof(*params), GFP_KERNEL); if (params == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Unable to allocate struct cdrom_params"); + PRINT_ERROR("Unable to allocate struct cdrom_params (size %d)", + sizeof(*params)); res = -ENOMEM; goto out; } buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure"); + PRINT_ERROR("Buffer memory allocation (size %d) failure", + buffer_size); res = -ENOMEM; goto out_free_params; } diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index 55992e20a..8ea089c15 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -181,15 +181,16 @@ static int disk_attach(struct scst_device *dev) params = kzalloc(sizeof(*params), GFP_KERNEL); if (params == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Unable to allocate struct disk_params"); + PRINT_ERROR("Unable to allocate struct disk_params (size %d)", + sizeof(*params)); res = -ENOMEM; goto out; } buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure"); + PRINT_ERROR("Buffer memory allocation (size %d) failure", + buffer_size); res = -ENOMEM; goto out_free_params; } diff --git a/scst/src/dev_handlers/scst_modisk.c b/scst/src/dev_handlers/scst_modisk.c index 08d8eb842..b2fcafdf9 100644 --- a/scst/src/dev_handlers/scst_modisk.c +++ b/scst/src/dev_handlers/scst_modisk.c @@ -168,8 +168,8 @@ static int modisk_attach(struct scst_device *dev) params = kzalloc(sizeof(*params), GFP_KERNEL); if (params == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Unable to allocate struct modisk_params"); + PRINT_ERROR("Unable to allocate struct modisk_params (size %d)", + sizeof(*params)); res = -ENOMEM; goto out; } @@ -187,7 +187,8 @@ static int modisk_attach(struct scst_device *dev) buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure"); + PRINT_ERROR("Buffer memory allocation (size %d) failure", + buffer_size); res = -ENOMEM; goto out_free_params; } diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 7aec7881e..121d08579 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -171,8 +171,8 @@ static int tape_attach(struct scst_device *dev) params = kzalloc(sizeof(*params), GFP_KERNEL); if (params == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Unable to allocate struct tape_params"); + PRINT_ERROR("Unable to allocate struct tape_params (size %d)", + sizeof(*params)); res = -ENOMEM; goto out; } @@ -181,7 +181,8 @@ static int tape_attach(struct scst_device *dev) buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure"); + PRINT_ERROR("Buffer memory allocation (size %d) failure", + buffer_size); res = -ENOMEM; goto out_free_req; } diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 0afafa4e8..efe96b5fb 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -842,8 +842,8 @@ static struct scst_vdisk_thr *vdisk_init_thr_data( res = kmem_cache_zalloc(vdisk_thr_cachep, gfp_mask); if (res == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Unable to allocate struct " - "scst_vdisk_thr"); + PRINT_ERROR("Unable to allocate struct scst_vdisk_thr (size %d)", + sizeof(*res)); goto out; } @@ -3894,8 +3894,7 @@ static int vcdrom_change(struct scst_vdisk_dev *virt_dev, if (!virt_dev->cdrom_empty) { char *fn = kstrdup(filename, GFP_KERNEL); if (fn == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Allocation of filename failed"); + PRINT_ERROR("%s", "Allocation of filename failed"); res = -ENOMEM; goto out_unlock; } @@ -4715,8 +4714,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset, virt_dev->filename = kstrdup(filename, GFP_KERNEL); if (virt_dev->filename == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Allocation of filename failed"); + PRINT_ERROR("%s", "Allocation of filename failed"); res = -ENOMEM; goto out_free_vdev; } @@ -4915,8 +4913,7 @@ static int vcdrom_open(char *p, char *name) if (!virt_dev->cdrom_empty) { virt_dev->filename = kstrdup(filename, GFP_KERNEL); if (virt_dev->filename == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Allocation of filename failed"); + PRINT_ERROR("%s", "Allocation of filename failed"); res = -ENOMEM; goto out_free_vdev; } diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index d012dd6d5..90259e3e5 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2514,7 +2514,7 @@ int scst_alloc_tgt(struct scst_tgt_template *tgtt, struct scst_tgt **tgt) t = kzalloc(sizeof(*t), GFP_KERNEL); if (t == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of tgt failed"); + PRINT_ERROR("%s", "Allocation of tgt failed"); res = -ENOMEM; goto out; } @@ -2573,8 +2573,7 @@ int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev) dev = kzalloc(sizeof(*dev), gfp_mask); if (dev == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Allocation of scst_device failed"); + PRINT_ERROR("%s", "Allocation of scst_device failed"); res = -ENOMEM; goto out; } @@ -2653,8 +2652,7 @@ static struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg, res = kmem_cache_zalloc(scst_acgd_cachep, GFP_KERNEL); if (res == NULL) { - TRACE(TRACE_OUT_OF_MEM, - "%s", "Allocation of scst_acg_dev failed"); + PRINT_ERROR("%s", "Allocation of scst_acg_dev failed"); goto out; } @@ -3287,8 +3285,7 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess, tgt_dev = kmem_cache_zalloc(scst_tgtd_cachep, GFP_KERNEL); if (tgt_dev == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_tgt_dev " - "failed"); + PRINT_ERROR("%s", "Allocation of scst_tgt_dev failed"); res = -ENOMEM; goto out; } @@ -3914,8 +3911,7 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, sess = kmem_cache_zalloc(scst_sess_cachep, gfp_mask); if (sess == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", - "Allocation of scst_session failed"); + PRINT_ERROR("%s", "Allocation of scst_session failed"); goto out; } diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 443b931cc..278d049ce 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -488,7 +488,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, SCST_DEFAULT_ACG_NAME, target_name); if (tgt->default_group_name == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of default " + PRINT_ERROR("Allocation of default " "group name failed (tgt %s)", target_name); rc = -ENOMEM; goto out_free_tgt; @@ -498,7 +498,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, tgt->tgt_name = kstrdup(target_name, GFP_KERNEL); if (tgt->tgt_name == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of tgt name %s failed", + PRINT_ERROR("Allocation of tgt name %s failed", target_name); rc = -ENOMEM; goto out_free_tgt; @@ -509,7 +509,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, tgt->tgt_name = kasprintf(GFP_KERNEL, "%s%s%d", vtt->name, SCST_DEFAULT_TGT_NAME_SUFFIX, tgt_num); if (tgt->tgt_name == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of tgt name failed " + PRINT_ERROR("Allocation of tgt name failed " "(template name %s)", vtt->name); rc = -ENOMEM; goto out_free_tgt; diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index d8cc7f325..d29b7c1f8 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1435,7 +1435,7 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name, for (i = 0; i < pool->max_caches; i++) { sgv_pool_init_cache(pool, i); if (pool->caches[i] == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of sgv_pool " + PRINT_ERROR("Allocation of sgv_pool " "cache %s(%d) failed", name, i); goto out_free; } @@ -1647,7 +1647,8 @@ struct sgv_pool *sgv_pool_create(const char *name, pool = kzalloc(sizeof(*pool), GFP_KERNEL); if (pool == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of sgv_pool failed"); + PRINT_ERROR("Allocation of sgv_pool failed (size %d)", + sizeof(*pool)); goto out_unlock; } diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index 935ad1b60..17ed310b1 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -931,7 +931,7 @@ static int scst_proc_group_add(const char *p, unsigned int addr_method) name = kmalloc(len, GFP_KERNEL); if (name == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of name failed"); + PRINT_ERROR("Allocation of new name (size %d) failed", len); goto out_nomem; } strlcpy(name, p, len); @@ -997,7 +997,7 @@ static int scst_proc_rename_acg(struct scst_acg *acg, const char *new_name) name = kmalloc(len, GFP_KERNEL); if (name == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of new name failed"); + PRINT_ERROR("Allocation of new name (size %d) failed", len); goto out_nomem; } strlcpy(name, new_name, len);