diff options
author | Andy Grover <agrover@redhat.com> | 2011-06-08 10:36:43 -0700 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 09:37:48 +0000 |
commit | 6708bb27bb2703da238f21f516034263348af5be (patch) | |
tree | a23e1f9eab22933d773d6b6ad6263d6751379a00 /drivers/target/target_core_device.c | |
parent | ec98f7825c6eaa4a9afb0eb518826efc8a2ed4a2 (diff) |
target: Follow up core updates from AGrover and HCH (round 4)
This patch contains the squashed version of forth round series cleanups
from Andy and Christoph following the post heavy lifting in the preceeding:
'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
changes. This also includes a conversion of target core and the v3.0
mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
CONFIG_DYNAMIC_DEBUG infrastructure!
These have been squashed into this third and final round for v3.1.
target: Remove ifdeffed code in t_g_process_write
target: Remove direct ramdisk code
target: Rename task_sg_num to task_sg_nents
target: Remove custom debug macros for pr_debug. Use pr_err().
target: Remove custom debug macros in mainline fabrics
target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
target: Remove transport do_se_mem_map callback
target: Further simplify transport_free_pages
target: Redo task allocation return value handling
target: Remove extra parentheses
target: change alloc_task call to take *cdb, not *cmd
(nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)
Signed-off-by: Andy Grover <agrover@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r-- | drivers/target/target_core_device.c | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 1185c3b76d4..81860ddc7cc 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -84,7 +84,7 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) (deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY)) { se_cmd->scsi_sense_reason = TCM_WRITE_PROTECTED; se_cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; - printk("TARGET_CORE[%s]: Detected WRITE_PROTECTED LUN" + pr_err("TARGET_CORE[%s]: Detected WRITE_PROTECTED LUN" " Access for 0x%08x\n", se_cmd->se_tfo->get_fabric_name(), unpacked_lun); @@ -117,7 +117,7 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) if (unpacked_lun != 0) { se_cmd->scsi_sense_reason = TCM_NON_EXISTENT_LUN; se_cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; - printk("TARGET_CORE[%s]: Detected NON_EXISTENT_LUN" + pr_err("TARGET_CORE[%s]: Detected NON_EXISTENT_LUN" " Access for 0x%08x\n", se_cmd->se_tfo->get_fabric_name(), unpacked_lun); @@ -204,7 +204,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun) spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); if (!se_lun) { - printk(KERN_INFO "TARGET_CORE[%s]: Detected NON_EXISTENT_LUN" + pr_debug("TARGET_CORE[%s]: Detected NON_EXISTENT_LUN" " Access for 0x%08x\n", se_cmd->se_tfo->get_fabric_name(), unpacked_lun); @@ -255,15 +255,15 @@ struct se_dev_entry *core_get_se_deve_from_rtpi( continue; lun = deve->se_lun; - if (!(lun)) { - printk(KERN_ERR "%s device entries device pointer is" + if (!lun) { + pr_err("%s device entries device pointer is" " NULL, but Initiator has access.\n", tpg->se_tpg_tfo->get_fabric_name()); continue; } port = lun->lun_sep; - if (!(port)) { - printk(KERN_ERR "%s device entries device pointer is" + if (!port) { + pr_err("%s device entries device pointer is" " NULL, but Initiator has access.\n", tpg->se_tpg_tfo->get_fabric_name()); continue; @@ -301,7 +301,7 @@ int core_free_device_list_for_node( continue; if (!deve->se_lun) { - printk(KERN_ERR "%s device entries device pointer is" + pr_err("%s device entries device pointer is" " NULL, but Initiator has access.\n", tpg->se_tpg_tfo->get_fabric_name()); continue; @@ -372,7 +372,7 @@ int core_update_device_list_for_node( * struct se_dev_entry pointers below as logic in * core_alua_do_transition_tg_pt() depends on these being present. */ - if (!(enable)) { + if (!enable) { /* * deve->se_lun_acl will be NULL for demo-mode created LUNs * that have not been explicitly concerted to MappedLUNs -> @@ -395,14 +395,14 @@ int core_update_device_list_for_node( */ if (deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS) { if (deve->se_lun_acl != NULL) { - printk(KERN_ERR "struct se_dev_entry->se_lun_acl" + pr_err("struct se_dev_entry->se_lun_acl" " already set for demo mode -> explict" " LUN ACL transition\n"); spin_unlock_irq(&nacl->device_list_lock); return -EINVAL; } if (deve->se_lun != lun) { - printk(KERN_ERR "struct se_dev_entry->se_lun does" + pr_err("struct se_dev_entry->se_lun does" " match passed struct se_lun for demo mode" " -> explict LUN ACL transition\n"); spin_unlock_irq(&nacl->device_list_lock); @@ -501,8 +501,8 @@ static struct se_port *core_alloc_port(struct se_device *dev) struct se_port *port, *port_tmp; port = kzalloc(sizeof(struct se_port), GFP_KERNEL); - if (!(port)) { - printk(KERN_ERR "Unable to allocate struct se_port\n"); + if (!port) { + pr_err("Unable to allocate struct se_port\n"); return ERR_PTR(-ENOMEM); } INIT_LIST_HEAD(&port->sep_alua_list); @@ -513,7 +513,7 @@ static struct se_port *core_alloc_port(struct se_device *dev) spin_lock(&dev->se_port_lock); if (dev->dev_port_count == 0x0000ffff) { - printk(KERN_WARNING "Reached dev->dev_port_count ==" + pr_warn("Reached dev->dev_port_count ==" " 0x0000ffff\n"); spin_unlock(&dev->se_port_lock); return ERR_PTR(-ENOSPC); @@ -532,7 +532,7 @@ again: * 3h to FFFFh Relative port 3 through 65 535 */ port->sep_rtpi = dev->dev_rpti_counter++; - if (!(port->sep_rtpi)) + if (!port->sep_rtpi) goto again; list_for_each_entry(port_tmp, &dev->dev_sep_list, sep_list) { @@ -570,7 +570,7 @@ static void core_export_port( if (su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { tg_pt_gp_mem = core_alua_allocate_tg_pt_gp_mem(port); if (IS_ERR(tg_pt_gp_mem) || !tg_pt_gp_mem) { - printk(KERN_ERR "Unable to allocate t10_alua_tg_pt" + pr_err("Unable to allocate t10_alua_tg_pt" "_gp_member_t\n"); return; } @@ -578,7 +578,7 @@ static void core_export_port( __core_alua_attach_tg_pt_gp_mem(tg_pt_gp_mem, su_dev->t10_alua.default_tg_pt_gp); spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); - printk(KERN_INFO "%s/%s: Adding to default ALUA Target Port" + pr_debug("%s/%s: Adding to default ALUA Target Port" " Group: alua/default_tg_pt_gp\n", dev->transport->name, tpg->se_tpg_tfo->get_fabric_name()); } @@ -663,8 +663,8 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd) list_for_each_entry(se_task, &se_cmd->t_task_list, t_list) break; - if (!(se_task)) { - printk(KERN_ERR "Unable to locate struct se_task for struct se_cmd\n"); + if (!se_task) { + pr_err("Unable to locate struct se_task for struct se_cmd\n"); return PYX_TRANSPORT_LU_COMM_FAILURE; } @@ -675,7 +675,7 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd) * coming via a target_core_mod PASSTHROUGH op, and not through * a $FABRIC_MOD. In that case, report LUN=0 only. */ - if (!(se_sess)) { + if (!se_sess) { int_to_scsilun(0, (struct scsi_lun *)&buf[offset]); lun_count = 1; goto done; @@ -893,12 +893,12 @@ void se_dev_set_default_attribs( int se_dev_set_task_timeout(struct se_device *dev, u32 task_timeout) { if (task_timeout > DA_TASK_TIMEOUT_MAX) { - printk(KERN_ERR "dev[%p]: Passed task_timeout: %u larger then" + pr_err("dev[%p]: Passed task_timeout: %u larger then" " DA_TASK_TIMEOUT_MAX\n", dev, task_timeout); return -EINVAL; } else { dev->se_sub_dev->se_dev_attrib.task_timeout = task_timeout; - printk(KERN_INFO "dev[%p]: Set SE Device task_timeout: %u\n", + pr_debug("dev[%p]: Set SE Device task_timeout: %u\n", dev, task_timeout); } @@ -910,7 +910,7 @@ int se_dev_set_max_unmap_lba_count( u32 max_unmap_lba_count) { dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count = max_unmap_lba_count; - printk(KERN_INFO "dev[%p]: Set max_unmap_lba_count: %u\n", + pr_debug("dev[%p]: Set max_unmap_lba_count: %u\n", dev, dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count); return 0; } @@ -921,7 +921,7 @@ int se_dev_set_max_unmap_block_desc_count( { dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count = max_unmap_block_desc_count; - printk(KERN_INFO "dev[%p]: Set max_unmap_block_desc_count: %u\n", + pr_debug("dev[%p]: Set max_unmap_block_desc_count: %u\n", dev, dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count); return 0; } @@ -931,7 +931,7 @@ int se_dev_set_unmap_granularity( u32 unmap_granularity) { dev->se_sub_dev->se_dev_attrib.unmap_granularity = unmap_granularity; - printk(KERN_INFO "dev[%p]: Set unmap_granularity: %u\n", + pr_debug("dev[%p]: Set unmap_granularity: %u\n", dev, dev->se_sub_dev->se_dev_attrib.unmap_granularity); return 0; } @@ -941,7 +941,7 @@ int se_dev_set_unmap_granularity_alignment( u32 unmap_granularity_alignment) { dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment = unmap_granularity_alignment; - printk(KERN_INFO "dev[%p]: Set unmap_granularity_alignment: %u\n", + pr_debug("dev[%p]: Set unmap_granularity_alignment: %u\n", dev, dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment); return 0; } @@ -949,19 +949,19 @@ int se_dev_set_unmap_granularity_alignment( int se_dev_set_emulate_dpo(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } if (dev->transport->dpo_emulated == NULL) { - printk(KERN_ERR "dev->transport->dpo_emulated is NULL\n"); + pr_err("dev->transport->dpo_emulated is NULL\n"); return -EINVAL; } if (dev->transport->dpo_emulated(dev) == 0) { - printk(KERN_ERR "dev->transport->dpo_emulated not supported\n"); + pr_err("dev->transport->dpo_emulated not supported\n"); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.emulate_dpo = flag; - printk(KERN_INFO "dev[%p]: SE Device Page Out (DPO) Emulation" + pr_debug("dev[%p]: SE Device Page Out (DPO) Emulation" " bit: %d\n", dev, dev->se_sub_dev->se_dev_attrib.emulate_dpo); return 0; } @@ -969,19 +969,19 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag) int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } if (dev->transport->fua_write_emulated == NULL) { - printk(KERN_ERR "dev->transport->fua_write_emulated is NULL\n"); + pr_err("dev->transport->fua_write_emulated is NULL\n"); return -EINVAL; } if (dev->transport->fua_write_emulated(dev) == 0) { - printk(KERN_ERR "dev->transport->fua_write_emulated not supported\n"); + pr_err("dev->transport->fua_write_emulated not supported\n"); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.emulate_fua_write = flag; - printk(KERN_INFO "dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", + pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", dev, dev->se_sub_dev->se_dev_attrib.emulate_fua_write); return 0; } @@ -989,19 +989,19 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) int se_dev_set_emulate_fua_read(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } if (dev->transport->fua_read_emulated == NULL) { - printk(KERN_ERR "dev->transport->fua_read_emulated is NULL\n"); + pr_err("dev->transport->fua_read_emulated is NULL\n"); return -EINVAL; } if (dev->transport->fua_read_emulated(dev) == 0) { - printk(KERN_ERR "dev->transport->fua_read_emulated not supported\n"); + pr_err("dev->transport->fua_read_emulated not supported\n"); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.emulate_fua_read = flag; - printk(KERN_INFO "dev[%p]: SE Device Forced Unit Access READs: %d\n", + pr_debug("dev[%p]: SE Device Forced Unit Access READs: %d\n", dev, dev->se_sub_dev->se_dev_attrib.emulate_fua_read); return 0; } @@ -1009,19 +1009,19 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int flag) int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } if (dev->transport->write_cache_emulated == NULL) { - printk(KERN_ERR "dev->transport->write_cache_emulated is NULL\n"); + pr_err("dev->transport->write_cache_emulated is NULL\n"); return -EINVAL; } if (dev->transport->write_cache_emulated(dev) == 0) { - printk(KERN_ERR "dev->transport->write_cache_emulated not supported\n"); + pr_err("dev->transport->write_cache_emulated not supported\n"); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.emulate_write_cache = flag; - printk(KERN_INFO "dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", + pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", dev, dev->se_sub_dev->se_dev_attrib.emulate_write_cache); return 0; } @@ -1029,19 +1029,19 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1) && (flag != 2)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } if (atomic_read(&dev->dev_export_obj.obj_access_count)) { - printk(KERN_ERR "dev[%p]: Unable to change SE Device" + pr_err("dev[%p]: Unable to change SE Device" " UA_INTRLCK_CTRL while dev_export_obj: %d count" " exists\n", dev, atomic_read(&dev->dev_export_obj.obj_access_count)); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl = flag; - printk(KERN_INFO "dev[%p]: SE Device UA_INTRLCK_CTRL flag: %d\n", + pr_debug("dev[%p]: SE Device UA_INTRLCK_CTRL flag: %d\n", dev, dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl); return 0; @@ -1050,18 +1050,18 @@ int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *dev, int flag) int se_dev_set_emulate_tas(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } if (atomic_read(&dev->dev_export_obj.obj_access_count)) { - printk(KERN_ERR "dev[%p]: Unable to change SE Device TAS while" + pr_err("dev[%p]: Unable to change SE Device TAS while" " dev_export_obj: %d count exists\n", dev, atomic_read(&dev->dev_export_obj.obj_access_count)); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.emulate_tas = flag; - printk(KERN_INFO "dev[%p]: SE Device TASK_ABORTED status bit: %s\n", + pr_debug("dev[%p]: SE Device TASK_ABORTED status bit: %s\n", dev, (dev->se_sub_dev->se_dev_attrib.emulate_tas) ? "Enabled" : "Disabled"); return 0; @@ -1070,20 +1070,20 @@ int se_dev_set_emulate_tas(struct se_device *dev, int flag) int se_dev_set_emulate_tpu(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } /* * We expect this value to be non-zero when generic Block Layer * Discard supported is detected iblock_create_virtdevice(). */ - if (!(dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count)) { - printk(KERN_ERR "Generic Block Discard not supported\n"); + if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { + pr_err("Generic Block Discard not supported\n"); return -ENOSYS; } dev->se_sub_dev->se_dev_attrib.emulate_tpu = flag; - printk(KERN_INFO "dev[%p]: SE Device Thin Provisioning UNMAP bit: %d\n", + pr_debug("dev[%p]: SE Device Thin Provisioning UNMAP bit: %d\n", dev, flag); return 0; } @@ -1091,20 +1091,20 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag) int se_dev_set_emulate_tpws(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } /* * We expect this value to be non-zero when generic Block Layer * Discard supported is detected iblock_create_virtdevice(). */ - if (!(dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count)) { - printk(KERN_ERR "Generic Block Discard not supported\n"); + if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { + pr_err("Generic Block Discard not supported\n"); return -ENOSYS; } dev->se_sub_dev->se_dev_attrib.emulate_tpws = flag; - printk(KERN_INFO "dev[%p]: SE Device Thin Provisioning WRITE_SAME: %d\n", + pr_debug("dev[%p]: SE Device Thin Provisioning WRITE_SAME: %d\n", dev, flag); return 0; } @@ -1112,11 +1112,11 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag) int se_dev_set_enforce_pr_isids(struct se_device *dev, int flag) { if ((flag != 0) && (flag != 1)) { - printk(KERN_ERR "Illegal value %d\n", flag); + pr_err("Illegal value %d\n", flag); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.enforce_pr_isids = flag; - printk(KERN_INFO "dev[%p]: SE Device enforce_pr_isids bit: %s\n", dev, + pr_debug("dev[%p]: SE Device enforce_pr_isids bit: %s\n", dev, (dev->se_sub_dev->se_dev_attrib.enforce_pr_isids) ? "Enabled" : "Disabled"); return 0; } @@ -1141,20 +1141,20 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) u32 orig_queue_depth = dev->queue_depth; if (atomic_read(&dev->dev_export_obj.obj_access_count)) { - printk(KERN_ERR "dev[%p]: Unable to change SE Device TCQ while" + pr_err("dev[%p]: Unable to change SE Device TCQ while" " dev_export_obj: %d count exists\n", dev, atomic_read(&dev->dev_export_obj.obj_access_count)); return -EINVAL; } - if (!(queue_depth)) { - printk(KERN_ERR "dev[%p]: Illegal ZERO value for queue" + if (!queue_depth) { + pr_err("dev[%p]: Illegal ZERO value for queue" "_depth\n", dev); return -EINVAL; } if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { if (queue_depth > dev->se_sub_dev->se_dev_attrib.hw_queue_depth) { - printk(KERN_ERR "dev[%p]: Passed queue_depth: %u" + pr_err("dev[%p]: Passed queue_depth: %u" " exceeds TCM/SE_Device TCQ: %u\n", dev, queue_depth, dev->se_sub_dev->se_dev_attrib.hw_queue_depth); @@ -1163,7 +1163,7 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) } else { if (queue_depth > dev->se_sub_dev->se_dev_attrib.queue_depth) { if (queue_depth > dev->se_sub_dev->se_dev_attrib.hw_queue_depth) { - printk(KERN_ERR "dev[%p]: Passed queue_depth:" + pr_err("dev[%p]: Passed queue_depth:" " %u exceeds TCM/SE_Device MAX" " TCQ: %u\n", dev, queue_depth, dev->se_sub_dev->se_dev_attrib.hw_queue_depth); @@ -1178,7 +1178,7 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) else if (queue_depth < orig_queue_depth) atomic_sub(orig_queue_depth - queue_depth, &dev->depth_left); - printk(KERN_INFO "dev[%p]: SE Device TCQ Depth changed to: %u\n", + pr_debug("dev[%p]: SE Device TCQ Depth changed to: %u\n", dev, queue_depth); return 0; } @@ -1188,41 +1188,41 @@ int se_dev_set_max_sectors(struct se_device *dev, u32 max_sectors) int force = 0; /* Force setting for VDEVS */ if (atomic_read(&dev->dev_export_obj.obj_access_count)) { - printk(KERN_ERR "dev[%p]: Unable to change SE Device" + pr_err("dev[%p]: Unable to change SE Device" " max_sectors while dev_export_obj: %d count exists\n", dev, atomic_read(&dev->dev_export_obj.obj_access_count)); return -EINVAL; } - if (!(max_sectors)) { - printk(KERN_ERR "dev[%p]: Illegal ZERO value for" + if (!max_sectors) { + pr_err("dev[%p]: Illegal ZERO value for" " max_sectors\n", dev); return -EINVAL; } if (max_sectors < DA_STATUS_MAX_SECTORS_MIN) { - printk(KERN_ERR "dev[%p]: Passed max_sectors: %u less than" + pr_err("dev[%p]: Passed max_sectors: %u less than" " DA_STATUS_MAX_SECTORS_MIN: %u\n", dev, max_sectors, DA_STATUS_MAX_SECTORS_MIN); return -EINVAL; } if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { if (max_sectors > dev->se_sub_dev->se_dev_attrib.hw_max_sectors) { - printk(KERN_ERR "dev[%p]: Passed max_sectors: %u" + pr_err("dev[%p]: Passed max_sectors: %u" " greater than TCM/SE_Device max_sectors:" " %u\n", dev, max_sectors, dev->se_sub_dev->se_dev_attrib.hw_max_sectors); return -EINVAL; } } else { - if (!(force) && (max_sectors > + if (!force && (max_sectors > dev->se_sub_dev->se_dev_attrib.hw_max_sectors)) { - printk(KERN_ERR "dev[%p]: Passed max_sectors: %u" + pr_err("dev[%p]: Passed max_sectors: %u" " greater than TCM/SE_Device max_sectors" ": %u, use force=1 to override.\n", dev, max_sectors, dev->se_sub_dev->se_dev_attrib.hw_max_sectors); return -EINVAL; } if (max_sectors > DA_STATUS_MAX_SECTORS_MAX) { - printk(KERN_ERR "dev[%p]: Passed max_sectors: %u" + pr_err("dev[%p]: Passed max_sectors: %u" " greater than DA_STATUS_MAX_SECTORS_MAX:" " %u\n", dev, max_sectors, DA_STATUS_MAX_SECTORS_MAX); @@ -1231,7 +1231,7 @@ int se_dev_set_max_sectors(struct se_device *dev, u32 max_sectors) } dev->se_sub_dev->se_dev_attrib.max_sectors = max_sectors; - printk("dev[%p]: SE Device max_sectors changed to %u\n", + pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", dev, max_sectors); return 0; } @@ -1239,25 +1239,25 @@ int se_dev_set_max_sectors(struct se_device *dev, u32 max_sectors) int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) { if (atomic_read(&dev->dev_export_obj.obj_access_count)) { - printk(KERN_ERR "dev[%p]: Unable to change SE Device" + pr_err("dev[%p]: Unable to change SE Device" " optimal_sectors while dev_export_obj: %d count exists\n", dev, atomic_read(&dev->dev_export_obj.obj_access_count)); return -EINVAL; } if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { - printk(KERN_ERR "dev[%p]: Passed optimal_sectors cannot be" + pr_err("dev[%p]: Passed optimal_sectors cannot be" " changed for TCM/pSCSI\n", dev); return -EINVAL; } if (optimal_sectors > dev->se_sub_dev->se_dev_attrib.max_sectors) { - printk(KERN_ERR "dev[%p]: Passed optimal_sectors %u cannot be" + pr_err("dev[%p]: Passed optimal_sectors %u cannot be" " greater than max_sectors: %u\n", dev, optimal_sectors, dev->se_sub_dev->se_dev_attrib.max_sectors); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.optimal_sectors = optimal_sectors; - printk(KERN_INFO "dev[%p]: SE Device optimal_sectors changed to %u\n", + pr_debug("dev[%p]: SE Device optimal_sectors changed to %u\n", dev, optimal_sectors); return 0; } @@ -1265,7 +1265,7 @@ int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) int se_dev_set_block_size(struct se_device *dev, u32 block_size) { if (atomic_read(&dev->dev_export_obj.obj_access_count)) { - printk(KERN_ERR "dev[%p]: Unable to change SE Device block_size" + pr_err("dev[%p]: Unable to change SE Device block_size" " while dev_export_obj: %d count exists\n", dev, atomic_read(&dev->dev_export_obj.obj_access_count)); return -EINVAL; @@ -1275,21 +1275,21 @@ int se_dev_set_block_size(struct se_device *dev, u32 block_size) (block_size != 1024) && (block_size != 2048) && (block_size != 4096)) { - printk(KERN_ERR "dev[%p]: Illegal value for block_device: %u" + pr_err("dev[%p]: Illegal value for block_device: %u" " for SE device, must be 512, 1024, 2048 or 4096\n", dev, block_size); return -EINVAL; } if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { - printk(KERN_ERR "dev[%p]: Not allowed to change block_size for" + pr_err("dev[%p]: Not allowed to change block_size for" " Physical Device, use for Linux/SCSI to change" " block_size for underlying hardware\n", dev); return -EINVAL; } dev->se_sub_dev->se_dev_attrib.block_size = block_size; - printk(KERN_INFO "dev[%p]: SE Device block_size changed to %u\n", + pr_debug("dev[%p]: SE Device block_size changed to %u\n", dev, block_size); return 0; } @@ -1304,13 +1304,13 @@ struct se_lun *core_dev_add_lun( u32 lun_access = 0; if (atomic_read(&dev->dev_access_obj.obj_access_count) != 0) { - printk(KERN_ERR "Unable to export struct se_device while dev_access_obj: %d\n", + pr_err("Unable to export struct se_device while dev_access_obj: %d\n", atomic_read(&dev->dev_access_obj.obj_access_count)); return NULL; } lun_p = core_tpg_pre_addlun(tpg, lun); - if ((IS_ERR(lun_p)) || !(lun_p)) + if ((IS_ERR(lun_p)) || !lun_p) return NULL; if (dev->dev_flags & DF_READ_ONLY) @@ -1321,7 +1321,7 @@ struct se_lun *core_dev_add_lun( if (core_tpg_post_addlun(tpg, lun_p, lun_access, dev) < 0) return NULL; - printk(KERN_INFO "%s_TPG[%u]_LUN[%u] - Activated %s Logical Unit from" + pr_debug("%s_TPG[%u]_LUN[%u] - Activated %s Logical Unit from" " CORE HBA: %u\n", tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg), lun_p->unpacked_lun, tpg->se_tpg_tfo->get_fabric_name(), hba->hba_id); @@ -1357,12 +1357,12 @@ int core_dev_del_lun( int ret = 0; lun = core_tpg_pre_dellun(tpg, unpacked_lun, &ret); - if (!(lun)) + if (!lun) return ret; core_tpg_post_dellun(tpg, lun); - printk(KERN_INFO "%s_TPG[%u]_LUN[%u] - Deactivated %s Logical Unit from" + pr_debug("%s_TPG[%u]_LUN[%u] - Deactivated %s Logical Unit from" " device object\n", tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg), unpacked_lun, tpg->se_tpg_tfo->get_fabric_name()); @@ -1376,7 +1376,7 @@ struct se_lun *core_get_lun_from_tpg(struct se_portal_group *tpg, u32 unpacked_l spin_lock(&tpg->tpg_lun_lock); if (unpacked_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { - printk(KERN_ERR "%s LUN: %u exceeds TRANSPORT_MAX_LUNS" + pr_err("%s LUN: %u exceeds TRANSPORT_MAX_LUNS" "_PER_TPG-1: %u for Target Portal Group: %hu\n", tpg->se_tpg_tfo->get_fabric_name(), unpacked_lun, TRANSPORT_MAX_LUNS_PER_TPG-1, @@ -1387,7 +1387,7 @@ struct se_lun *core_get_lun_from_tpg(struct se_portal_group *tpg, u32 unpacked_l lun = &tpg->tpg_lun_list[unpacked_lun]; if (lun->lun_status != TRANSPORT_LUN_STATUS_FREE) { - printk(KERN_ERR "%s Logical Unit Number: %u is not free on" + pr_err("%s Logical Unit Number: %u is not free on" " Target Portal Group: %hu, ignoring request.\n", tpg->se_tpg_tfo->get_fabric_name(), unpacked_lun, tpg->se_tpg_tfo->tpg_get_tag(tpg)); @@ -1409,7 +1409,7 @@ static struct se_lun *core_dev_get_lun(struct se_portal_group *tpg, u32 unpacked spin_lock(&tpg->tpg_lun_lock); if (unpacked_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { - printk(KERN_ERR "%s LUN: %u exceeds TRANSPORT_MAX_LUNS_PER" + pr_err("%s LUN: %u exceeds TRANSPORT_MAX_LUNS_PER" "_TPG-1: %u for Target Portal Group: %hu\n", tpg->se_tpg_tfo->get_fabric_name(), unpacked_lun, TRANSPORT_MAX_LUNS_PER_TPG-1, @@ -1420,7 +1420,7 @@ static struct se_lun *core_dev_get_lun(struct se_portal_group *tpg, u32 unpacked lun = &tpg->tpg_lun_list[unpacked_lun]; if (lun->lun_status != TRANSPORT_LUN_STATUS_ACTIVE) { - printk(KERN_ERR "%s Logical Unit Number: %u is not active on" + pr_err("%s Logical Unit Number: %u is not active on" " Target Portal Group: %hu, ignoring request.\n", tpg->se_tpg_tfo->get_fabric_name(), unpacked_lun, tpg->se_tpg_tfo->tpg_get_tag(tpg)); @@ -1442,19 +1442,19 @@ struct se_lun_acl *core_dev_init_initiator_node_lun_acl( struct se_node_acl *nacl; if (strlen(initiatorname) >= TRANSPORT_IQN_LEN) { - printk(KERN_ERR "%s InitiatorName exceeds maximum size.\n", + pr_err("%s InitiatorName exceeds maximum size.\n", tpg->se_tpg_tfo->get_fabric_name()); *ret = -EOVERFLOW; return NULL; } nacl = core_tpg_get_initiator_node_acl(tpg, initiatorname); - if (!(nacl)) { + if (!nacl) { *ret = -EINVAL; return NULL; } lacl = kzalloc(sizeof(struct se_lun_acl), GFP_KERNEL); - if (!(lacl)) { - printk(KERN_ERR "Unable to allocate memory for struct se_lun_acl.\n"); + if (!lacl) { + pr_err("Unable to allocate memory for struct se_lun_acl.\n"); *ret = -ENOMEM; return NULL; } @@ -1477,8 +1477,8 @@ int core_dev_add_initiator_node_lun_acl( struct se_node_acl *nacl; lun = core_dev_get_lun(tpg, unpacked_lun); - if (!(lun)) { - printk(KERN_ERR "%s Logical Unit Number: %u is not active on" + if (!lun) { + pr_err("%s Logical Unit Number: %u is not active on" " Target Portal Group: %hu, ignoring request.\n", tpg->se_tpg_tfo->get_fabric_name(), unpacked_lun, tpg->se_tpg_tfo->tpg_get_tag(tpg)); @@ -1486,7 +1486,7 @@ int core_dev_add_initiator_node_lun_acl( } nacl = lacl->se_lun_nacl; - if (!(nacl)) + if (!nacl) return -EINVAL; if ((lun->lun_access & TRANSPORT_LUNFLAGS_READ_ONLY) && @@ -1505,7 +1505,7 @@ int core_dev_add_initiator_node_lun_acl( smp_mb__after_atomic_inc(); spin_unlock(&lun->lun_acl_lock); - printk(KERN_INFO "%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for " + pr_debug("%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for " " InitiatorNode: %s\n", tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg), unpacked_lun, lacl->mapped_lun, (lun_access & TRANSPORT_LUNFLAGS_READ_WRITE) ? "RW" : "RO", @@ -1530,7 +1530,7 @@ int core_dev_del_initiator_node_lun_acl( struct se_node_acl *nacl; nacl = lacl->se_lun_nacl; - if (!(nacl)) + if (!nacl) return -EINVAL; spin_lock(&lun->lun_acl_lock); @@ -1544,7 +1544,7 @@ int core_dev_del_initiator_node_lun_acl( lacl->se_lun = NULL; - printk(KERN_INFO "%s_TPG[%hu]_LUN[%u] - Removed ACL for" + pr_debug("%s_TPG[%hu]_LUN[%u] - Removed ACL for" " InitiatorNode: %s Mapped LUN: %u\n", tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg), lun->unpacked_lun, @@ -1557,7 +1557,7 @@ void core_dev_free_initiator_node_lun_acl( struct se_portal_group *tpg, struct se_lun_acl *lacl) { - printk("%s_TPG[%hu] - Freeing ACL for %s InitiatorNode: %s" + pr_debug("%s_TPG[%hu] - Freeing ACL for %s InitiatorNode: %s" " Mapped LUN: %u\n", tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg), tpg->se_tpg_tfo->get_fabric_name(), @@ -1575,7 +1575,7 @@ int core_dev_setup_virtual_lun0(void) char buf[16]; int ret; - hba = core_alloc_hba("rd_dr", 0, HBA_FLAGS_INTERNAL_USE); + hba = core_alloc_hba("rd_mcp", 0, HBA_FLAGS_INTERNAL_USE); if (IS_ERR(hba)) return PTR_ERR(hba); @@ -1583,8 +1583,8 @@ int core_dev_setup_virtual_lun0(void) t = hba->transport; se_dev = kzalloc(sizeof(struct se_subsystem_dev), GFP_KERNEL); - if (!(se_dev)) { - printk(KERN_ERR "Unable to allocate memory for" + if (!se_dev) { + pr_err("Unable to allocate memory for" " struct se_subsystem_dev\n"); ret = -ENOMEM; goto out; @@ -1606,8 +1606,8 @@ int core_dev_setup_virtual_lun0(void) se_dev->se_dev_hba = hba; se_dev->se_dev_su_ptr = t->allocate_virtdevice(hba, "virt_lun0"); - if (!(se_dev->se_dev_su_ptr)) { - printk(KERN_ERR "Unable to locate subsystem dependent pointer" + if (!se_dev->se_dev_su_ptr) { + pr_err("Unable to locate subsystem dependent pointer" " from allocate_virtdevice()\n"); ret = -ENOMEM; goto out; @@ -1643,7 +1643,7 @@ void core_dev_release_virtual_lun0(void) struct se_hba *hba = lun0_hba; struct se_subsystem_dev *su_dev = lun0_su_dev; - if (!(hba)) + if (!hba) return; if (g_lun0_dev) |