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 | |
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')
28 files changed, 1385 insertions, 2037 deletions
diff --git a/drivers/target/loopback/Kconfig b/drivers/target/loopback/Kconfig index 57dcbc2d711..abe8ecbcdf0 100644 --- a/drivers/target/loopback/Kconfig +++ b/drivers/target/loopback/Kconfig @@ -3,9 +3,3 @@ config LOOPBACK_TARGET help Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LLD fabric loopback module. - -config LOOPBACK_TARGET_CDB_DEBUG - bool "TCM loopback fabric module CDB debug code" - depends on LOOPBACK_TARGET - help - Say Y here to enable the TCM loopback fabric module CDB debug code diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 99603bc4578..aa2d6799723 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -79,7 +79,7 @@ static struct se_cmd *tcm_loop_allocate_core_cmd( tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); if (!tl_cmd) { - printk(KERN_ERR "Unable to allocate struct tcm_loop_cmd\n"); + pr_err("Unable to allocate struct tcm_loop_cmd\n"); set_host_byte(sc, DID_ERROR); return NULL; } @@ -281,7 +281,7 @@ static int tcm_loop_queuecommand( struct tcm_loop_hba *tl_hba; struct tcm_loop_tpg *tl_tpg; - TL_CDB_DEBUG("tcm_loop_queuecommand() %d:%d:%d:%d got CDB: 0x%02x" + pr_debug("tcm_loop_queuecommand() %d:%d:%d:%d got CDB: 0x%02x" " scsi_buf_len: %u\n", sc->device->host->host_no, sc->device->id, sc->device->channel, sc->device->lun, sc->cmnd[0], scsi_bufflen(sc)); @@ -331,7 +331,7 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) */ tl_nexus = tl_hba->tl_nexus; if (!tl_nexus) { - printk(KERN_ERR "Unable to perform device reset without" + pr_err("Unable to perform device reset without" " active I_T Nexus\n"); return FAILED; } @@ -344,13 +344,13 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL); if (!tl_cmd) { - printk(KERN_ERR "Unable to allocate memory for tl_cmd\n"); + pr_err("Unable to allocate memory for tl_cmd\n"); return FAILED; } tl_tmr = kzalloc(sizeof(struct tcm_loop_tmr), GFP_KERNEL); if (!tl_tmr) { - printk(KERN_ERR "Unable to allocate memory for tl_tmr\n"); + pr_err("Unable to allocate memory for tl_tmr\n"); goto release; } init_waitqueue_head(&tl_tmr->tl_tmr_wait); @@ -435,7 +435,7 @@ static int tcm_loop_driver_probe(struct device *dev) sh = scsi_host_alloc(&tcm_loop_driver_template, sizeof(struct tcm_loop_hba)); if (!sh) { - printk(KERN_ERR "Unable to allocate struct scsi_host\n"); + pr_err("Unable to allocate struct scsi_host\n"); return -ENODEV; } tl_hba->sh = sh; @@ -454,7 +454,7 @@ static int tcm_loop_driver_probe(struct device *dev) error = scsi_add_host(sh, &tl_hba->dev); if (error) { - printk(KERN_ERR "%s: scsi_add_host failed\n", __func__); + pr_err("%s: scsi_add_host failed\n", __func__); scsi_host_put(sh); return -ENODEV; } @@ -495,7 +495,7 @@ static int tcm_loop_setup_hba_bus(struct tcm_loop_hba *tl_hba, int tcm_loop_host ret = device_register(&tl_hba->dev); if (ret) { - printk(KERN_ERR "device_register() failed for" + pr_err("device_register() failed for" " tl_hba->dev: %d\n", ret); return -ENODEV; } @@ -513,24 +513,24 @@ static int tcm_loop_alloc_core_bus(void) tcm_loop_primary = root_device_register("tcm_loop_0"); if (IS_ERR(tcm_loop_primary)) { - printk(KERN_ERR "Unable to allocate tcm_loop_primary\n"); + pr_err("Unable to allocate tcm_loop_primary\n"); return PTR_ERR(tcm_loop_primary); } ret = bus_register(&tcm_loop_lld_bus); if (ret) { - printk(KERN_ERR "bus_register() failed for tcm_loop_lld_bus\n"); + pr_err("bus_register() failed for tcm_loop_lld_bus\n"); goto dev_unreg; } ret = driver_register(&tcm_loop_driverfs); if (ret) { - printk(KERN_ERR "driver_register() failed for" + pr_err("driver_register() failed for" "tcm_loop_driverfs\n"); goto bus_unreg; } - printk(KERN_INFO "Initialized TCM Loop Core Bus\n"); + pr_debug("Initialized TCM Loop Core Bus\n"); return ret; bus_unreg: @@ -546,7 +546,7 @@ static void tcm_loop_release_core_bus(void) bus_unregister(&tcm_loop_lld_bus); root_device_unregister(tcm_loop_primary); - printk(KERN_INFO "Releasing TCM Loop Core BUS\n"); + pr_debug("Releasing TCM Loop Core BUS\n"); } static char *tcm_loop_get_fabric_name(void) @@ -574,7 +574,7 @@ static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) case SCSI_PROTOCOL_ISCSI: return iscsi_get_fabric_proto_ident(se_tpg); default: - printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" + pr_err("Unknown tl_proto_id: 0x%02x, using" " SAS emulation\n", tl_hba->tl_proto_id); break; } @@ -630,7 +630,7 @@ static u32 tcm_loop_get_pr_transport_id( return iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg, format_code, buf); default: - printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" + pr_err("Unknown tl_proto_id: 0x%02x, using" " SAS emulation\n", tl_hba->tl_proto_id); break; } @@ -660,7 +660,7 @@ static u32 tcm_loop_get_pr_transport_id_len( return iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg, format_code); default: - printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" + pr_err("Unknown tl_proto_id: 0x%02x, using" " SAS emulation\n", tl_hba->tl_proto_id); break; } @@ -694,7 +694,7 @@ static char *tcm_loop_parse_pr_out_transport_id( return iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len, port_nexus_ptr); default: - printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" + pr_err("Unknown tl_proto_id: 0x%02x, using" " SAS emulation\n", tl_hba->tl_proto_id); break; } @@ -743,7 +743,7 @@ static struct se_node_acl *tcm_loop_tpg_alloc_fabric_acl( tl_nacl = kzalloc(sizeof(struct tcm_loop_nacl), GFP_KERNEL); if (!tl_nacl) { - printk(KERN_ERR "Unable to allocate struct tcm_loop_nacl\n"); + pr_err("Unable to allocate struct tcm_loop_nacl\n"); return NULL; } @@ -853,7 +853,7 @@ static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) struct tcm_loop_cmd, tl_se_cmd); struct scsi_cmnd *sc = tl_cmd->sc; - TL_CDB_DEBUG("tcm_loop_queue_data_in() called for scsi_cmnd: %p" + pr_debug("tcm_loop_queue_data_in() called for scsi_cmnd: %p" " cdb: 0x%02x\n", sc, sc->cmnd[0]); sc->result = SAM_STAT_GOOD; @@ -868,7 +868,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) struct tcm_loop_cmd, tl_se_cmd); struct scsi_cmnd *sc = tl_cmd->sc; - TL_CDB_DEBUG("tcm_loop_queue_status() called for scsi_cmnd: %p" + pr_debug("tcm_loop_queue_status() called for scsi_cmnd: %p" " cdb: 0x%02x\n", sc, sc->cmnd[0]); if (se_cmd->sense_buffer && @@ -943,7 +943,7 @@ static int tcm_loop_port_link( */ scsi_add_device(tl_hba->sh, 0, tl_tpg->tl_tpgt, lun->unpacked_lun); - printk(KERN_INFO "TCM_Loop_ConfigFS: Port Link Successful\n"); + pr_debug("TCM_Loop_ConfigFS: Port Link Successful\n"); return 0; } @@ -961,7 +961,7 @@ static void tcm_loop_port_unlink( sd = scsi_device_lookup(tl_hba->sh, 0, tl_tpg->tl_tpgt, se_lun->unpacked_lun); if (!sd) { - printk(KERN_ERR "Unable to locate struct scsi_device for %d:%d:" + pr_err("Unable to locate struct scsi_device for %d:%d:" "%d\n", 0, tl_tpg->tl_tpgt, se_lun->unpacked_lun); return; } @@ -974,7 +974,7 @@ static void tcm_loop_port_unlink( atomic_dec(&tl_tpg->tl_tpg_port_count); smp_mb__after_atomic_dec(); - printk(KERN_INFO "TCM_Loop_ConfigFS: Port Unlink Successful\n"); + pr_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n"); } /* End items for tcm_loop_port_cit */ @@ -991,14 +991,14 @@ static int tcm_loop_make_nexus( int ret = -ENOMEM; if (tl_tpg->tl_hba->tl_nexus) { - printk(KERN_INFO "tl_tpg->tl_hba->tl_nexus already exists\n"); + pr_debug("tl_tpg->tl_hba->tl_nexus already exists\n"); return -EEXIST; } se_tpg = &tl_tpg->tl_se_tpg; tl_nexus = kzalloc(sizeof(struct tcm_loop_nexus), GFP_KERNEL); if (!tl_nexus) { - printk(KERN_ERR "Unable to allocate struct tcm_loop_nexus\n"); + pr_err("Unable to allocate struct tcm_loop_nexus\n"); return -ENOMEM; } /* @@ -1027,7 +1027,7 @@ static int tcm_loop_make_nexus( __transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, tl_nexus->se_sess, tl_nexus); tl_tpg->tl_hba->tl_nexus = tl_nexus; - printk(KERN_INFO "TCM_Loop_ConfigFS: Established I_T Nexus to emulated" + pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), name); return 0; @@ -1053,13 +1053,13 @@ static int tcm_loop_drop_nexus( return -ENODEV; if (atomic_read(&tpg->tl_tpg_port_count)) { - printk(KERN_ERR "Unable to remove TCM_Loop I_T Nexus with" + pr_err("Unable to remove TCM_Loop I_T Nexus with" " active TPG port count: %d\n", atomic_read(&tpg->tl_tpg_port_count)); return -EPERM; } - printk(KERN_INFO "TCM_Loop_ConfigFS: Removing I_T Nexus to emulated" + pr_debug("TCM_Loop_ConfigFS: Removing I_T Nexus to emulated" " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), tl_nexus->se_sess->se_node_acl->initiatorname); /* @@ -1115,7 +1115,7 @@ static ssize_t tcm_loop_tpg_store_nexus( * tcm_loop_make_nexus() */ if (strlen(page) >= TL_WWN_ADDR_LEN) { - printk(KERN_ERR "Emulated NAA Sas Address: %s, exceeds" + pr_err("Emulated NAA Sas Address: %s, exceeds" " max: %d\n", page, TL_WWN_ADDR_LEN); return -EINVAL; } @@ -1124,7 +1124,7 @@ static ssize_t tcm_loop_tpg_store_nexus( ptr = strstr(i_port, "naa."); if (ptr) { if (tl_hba->tl_proto_id != SCSI_PROTOCOL_SAS) { - printk(KERN_ERR "Passed SAS Initiator Port %s does not" + pr_err("Passed SAS Initiator Port %s does not" " match target port protoid: %s\n", i_port, tcm_loop_dump_proto_id(tl_hba)); return -EINVAL; @@ -1135,7 +1135,7 @@ static ssize_t tcm_loop_tpg_store_nexus( ptr = strstr(i_port, "fc."); if (ptr) { if (tl_hba->tl_proto_id != SCSI_PROTOCOL_FCP) { - printk(KERN_ERR "Passed FCP Initiator Port %s does not" + pr_err("Passed FCP Initiator Port %s does not" " match target port protoid: %s\n", i_port, tcm_loop_dump_proto_id(tl_hba)); return -EINVAL; @@ -1146,7 +1146,7 @@ static ssize_t tcm_loop_tpg_store_nexus( ptr = strstr(i_port, "iqn."); if (ptr) { if (tl_hba->tl_proto_id != SCSI_PROTOCOL_ISCSI) { - printk(KERN_ERR "Passed iSCSI Initiator Port %s does not" + pr_err("Passed iSCSI Initiator Port %s does not" " match target port protoid: %s\n", i_port, tcm_loop_dump_proto_id(tl_hba)); return -EINVAL; @@ -1154,7 +1154,7 @@ static ssize_t tcm_loop_tpg_store_nexus( port_ptr = &i_port[0]; goto check_newline; } - printk(KERN_ERR "Unable to locate prefix for emulated Initiator Port:" + pr_err("Unable to locate prefix for emulated Initiator Port:" " %s\n", i_port); return -EINVAL; /* @@ -1194,7 +1194,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( tpgt_str = strstr(name, "tpgt_"); if (!tpgt_str) { - printk(KERN_ERR "Unable to locate \"tpgt_#\" directory" + pr_err("Unable to locate \"tpgt_#\" directory" " group\n"); return ERR_PTR(-EINVAL); } @@ -1202,7 +1202,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( tpgt = (unsigned short int) simple_strtoul(tpgt_str, &end_ptr, 0); if (tpgt >= TL_TPGS_PER_HBA) { - printk(KERN_ERR "Passed tpgt: %hu exceeds TL_TPGS_PER_HBA:" + pr_err("Passed tpgt: %hu exceeds TL_TPGS_PER_HBA:" " %u\n", tpgt, TL_TPGS_PER_HBA); return ERR_PTR(-EINVAL); } @@ -1218,7 +1218,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( if (ret < 0) return ERR_PTR(-ENOMEM); - printk(KERN_INFO "TCM_Loop_ConfigFS: Allocated Emulated %s" + pr_debug("TCM_Loop_ConfigFS: Allocated Emulated %s" " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), config_item_name(&wwn->wwn_group.cg_item), tpgt); @@ -1245,7 +1245,7 @@ void tcm_loop_drop_naa_tpg( */ core_tpg_deregister(se_tpg); - printk(KERN_INFO "TCM_Loop_ConfigFS: Deallocated Emulated %s" + pr_debug("TCM_Loop_ConfigFS: Deallocated Emulated %s" " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), config_item_name(&wwn->wwn_group.cg_item), tpgt); } @@ -1266,7 +1266,7 @@ struct se_wwn *tcm_loop_make_scsi_hba( tl_hba = kzalloc(sizeof(struct tcm_loop_hba), GFP_KERNEL); if (!tl_hba) { - printk(KERN_ERR "Unable to allocate struct tcm_loop_hba\n"); + pr_err("Unable to allocate struct tcm_loop_hba\n"); return ERR_PTR(-ENOMEM); } /* @@ -1286,7 +1286,7 @@ struct se_wwn *tcm_loop_make_scsi_hba( } ptr = strstr(name, "iqn."); if (!ptr) { - printk(KERN_ERR "Unable to locate prefix for emulated Target " + pr_err("Unable to locate prefix for emulated Target " "Port: %s\n", name); ret = -EINVAL; goto out; @@ -1295,7 +1295,7 @@ struct se_wwn *tcm_loop_make_scsi_hba( check_len: if (strlen(name) >= TL_WWN_ADDR_LEN) { - printk(KERN_ERR "Emulated NAA %s Address: %s, exceeds" + pr_err("Emulated NAA %s Address: %s, exceeds" " max: %d\n", name, tcm_loop_dump_proto_id(tl_hba), TL_WWN_ADDR_LEN); ret = -EINVAL; @@ -1314,7 +1314,7 @@ check_len: sh = tl_hba->sh; tcm_loop_hba_no_cnt++; - printk(KERN_INFO "TCM_Loop_ConfigFS: Allocated emulated Target" + pr_debug("TCM_Loop_ConfigFS: Allocated emulated Target" " %s Address: %s at Linux/SCSI Host ID: %d\n", tcm_loop_dump_proto_id(tl_hba), name, sh->host_no); @@ -1337,7 +1337,7 @@ void tcm_loop_drop_scsi_hba( */ device_unregister(&tl_hba->dev); - printk(KERN_INFO "TCM_Loop_ConfigFS: Deallocated emulated Target" + pr_debug("TCM_Loop_ConfigFS: Deallocated emulated Target" " SAS Address: %s at Linux/SCSI Host ID: %d\n", config_item_name(&wwn->wwn_group.cg_item), host_no); } @@ -1373,7 +1373,7 @@ static int tcm_loop_register_configfs(void) */ fabric = target_fabric_configfs_init(THIS_MODULE, "loopback"); if (IS_ERR(fabric)) { - printk(KERN_ERR "tcm_loop_register_configfs() failed!\n"); + pr_err("tcm_loop_register_configfs() failed!\n"); return PTR_ERR(fabric); } /* @@ -1464,7 +1464,7 @@ static int tcm_loop_register_configfs(void) */ ret = target_fabric_configfs_register(fabric); if (ret < 0) { - printk(KERN_ERR "target_fabric_configfs_register() for" + pr_err("target_fabric_configfs_register() for" " TCM_Loop failed!\n"); target_fabric_configfs_free(fabric); return -1; @@ -1473,7 +1473,7 @@ static int tcm_loop_register_configfs(void) * Setup our local pointer to *fabric. */ tcm_loop_fabric_configfs = fabric; - printk(KERN_INFO "TCM_LOOP[0] - Set fabric ->" + pr_debug("TCM_LOOP[0] - Set fabric ->" " tcm_loop_fabric_configfs\n"); return 0; } @@ -1485,7 +1485,7 @@ static void tcm_loop_deregister_configfs(void) target_fabric_configfs_deregister(tcm_loop_fabric_configfs); tcm_loop_fabric_configfs = NULL; - printk(KERN_INFO "TCM_LOOP[0] - Cleared" + pr_debug("TCM_LOOP[0] - Cleared" " tcm_loop_fabric_configfs\n"); } @@ -1498,7 +1498,7 @@ static int __init tcm_loop_fabric_init(void) __alignof__(struct tcm_loop_cmd), 0, NULL); if (!tcm_loop_cmd_cache) { - printk(KERN_ERR "kmem_cache_create() for" + pr_debug("kmem_cache_create() for" " tcm_loop_cmd_cache failed\n"); return -ENOMEM; } diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h index 7e9f7ab4554..6b76c7a22bb 100644 --- a/drivers/target/loopback/tcm_loop.h +++ b/drivers/target/loopback/tcm_loop.h @@ -16,12 +16,6 @@ */ #define TL_SCSI_MAX_CMD_LEN 32 -#ifdef CONFIG_LOOPBACK_TARGET_CDB_DEBUG -# define TL_CDB_DEBUG(x...) printk(KERN_INFO x) -#else -# define TL_CDB_DEBUG(x...) -#endif - struct tcm_loop_cmd { /* State of Linux/SCSI CDB+Data descriptor */ u32 sc_cmd_state; diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index dba412ff371..98c98a3a025 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c @@ -167,7 +167,7 @@ int core_emulate_set_target_port_groups(struct se_cmd *cmd) int alua_access_state, primary = 0, rc; u16 tg_pt_id, rtpi; - if (!(l_port)) + if (!l_port) return PYX_TRANSPORT_LU_COMM_FAILURE; buf = transport_kmap_first_data_page(cmd); @@ -177,24 +177,24 @@ int core_emulate_set_target_port_groups(struct se_cmd *cmd) * for the local tg_pt_gp. */ l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; - if (!(l_tg_pt_gp_mem)) { - printk(KERN_ERR "Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); + if (!l_tg_pt_gp_mem) { + pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; goto out; } spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); l_tg_pt_gp = l_tg_pt_gp_mem->tg_pt_gp; - if (!(l_tg_pt_gp)) { + if (!l_tg_pt_gp) { spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); - printk(KERN_ERR "Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); + pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; goto out; } rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA); spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); - if (!(rc)) { - printk(KERN_INFO "Unable to process SET_TARGET_PORT_GROUPS" + if (!rc) { + pr_debug("Unable to process SET_TARGET_PORT_GROUPS" " while TPGS_EXPLICT_ALUA is disabled\n"); rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; goto out; @@ -249,7 +249,7 @@ int core_emulate_set_target_port_groups(struct se_cmd *cmd) list_for_each_entry(tg_pt_gp, &su_dev->t10_alua.tg_pt_gps_list, tg_pt_gp_list) { - if (!(tg_pt_gp->tg_pt_gp_valid_id)) + if (!tg_pt_gp->tg_pt_gp_valid_id) continue; if (tg_pt_id != tg_pt_gp->tg_pt_gp_id) @@ -498,7 +498,7 @@ static int core_alua_state_check( struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; int out_alua_state, nonop_delay_msecs; - if (!(port)) + if (!port) return 0; /* * First, check for a struct se_port specific secondary ALUA target port @@ -506,7 +506,7 @@ static int core_alua_state_check( */ if (atomic_read(&port->sep_tg_pt_secondary_offline)) { *alua_ascq = ASCQ_04H_ALUA_OFFLINE; - printk(KERN_INFO "ALUA: Got secondary offline status for local" + pr_debug("ALUA: Got secondary offline status for local" " target port\n"); *alua_ascq = ASCQ_04H_ALUA_OFFLINE; return 1; @@ -548,7 +548,7 @@ static int core_alua_state_check( */ case ALUA_ACCESS_STATE_OFFLINE: default: - printk(KERN_ERR "Unknown ALUA access state: 0x%02x\n", + pr_err("Unknown ALUA access state: 0x%02x\n", out_alua_state); return -EINVAL; } @@ -580,7 +580,7 @@ static int core_alua_check_transition(int state, int *primary) *primary = 0; break; default: - printk(KERN_ERR "Unknown ALUA access state: 0x%02x\n", state); + pr_err("Unknown ALUA access state: 0x%02x\n", state); return -EINVAL; } @@ -638,7 +638,7 @@ int core_alua_check_nonop_delay( * The ALUA Active/NonOptimized access state delay can be disabled * in via configfs with a value of zero */ - if (!(cmd->alua_nonop_delay)) + if (!cmd->alua_nonop_delay) return 0; /* * struct se_cmd->alua_nonop_delay gets set by a target port group @@ -667,7 +667,7 @@ static int core_alua_write_tpg_metadata( file = filp_open(path, flags, 0600); if (IS_ERR(file) || !file || !file->f_dentry) { - printk(KERN_ERR "filp_open(%s) for ALUA metadata failed\n", + pr_err("filp_open(%s) for ALUA metadata failed\n", path); return -ENODEV; } @@ -681,7 +681,7 @@ static int core_alua_write_tpg_metadata( set_fs(old_fs); if (ret < 0) { - printk(KERN_ERR "Error writing ALUA metadata file: %s\n", path); + pr_err("Error writing ALUA metadata file: %s\n", path); filp_close(file, NULL); return -EIO; } @@ -778,7 +778,7 @@ static int core_alua_do_transition_tg_pt( * se_deve->se_lun_acl pointer may be NULL for a * entry created without explict Node+MappedLUN ACLs */ - if (!(lacl)) + if (!lacl) continue; if (explict && @@ -820,7 +820,7 @@ static int core_alua_do_transition_tg_pt( */ atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, new_state); - printk(KERN_INFO "Successful %s ALUA transition TG PT Group: %s ID: %hu" + pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu" " from primary access state %s to %s\n", (explict) ? "explict" : "implict", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), tg_pt_gp->tg_pt_gp_id, core_alua_dump_state(old_state), @@ -851,8 +851,8 @@ int core_alua_do_port_transition( return -EINVAL; md_buf = kzalloc(l_tg_pt_gp->tg_pt_gp_md_buf_len, GFP_KERNEL); - if (!(md_buf)) { - printk("Unable to allocate buf for ALUA metadata\n"); + if (!md_buf) { + pr_err("Unable to allocate buf for ALUA metadata\n"); return -ENOMEM; } @@ -867,7 +867,7 @@ int core_alua_do_port_transition( * we only do transition on the passed *l_tp_pt_gp, and not * on all of the matching target port groups IDs in default_lu_gp. */ - if (!(lu_gp->lu_gp_id)) { + if (!lu_gp->lu_gp_id) { /* * core_alua_do_transition_tg_pt() will always return * success. @@ -899,7 +899,7 @@ int core_alua_do_port_transition( &su_dev->t10_alua.tg_pt_gps_list, tg_pt_gp_list) { - if (!(tg_pt_gp->tg_pt_gp_valid_id)) + if (!tg_pt_gp->tg_pt_gp_valid_id) continue; /* * If the target behavior port asymmetric access state @@ -941,7 +941,7 @@ int core_alua_do_port_transition( } spin_unlock(&lu_gp->lu_gp_lock); - printk(KERN_INFO "Successfully processed LU Group: %s all ALUA TG PT" + pr_debug("Successfully processed LU Group: %s all ALUA TG PT" " Group IDs: %hu %s transition to primary state: %s\n", config_item_name(&lu_gp->lu_gp_group.cg_item), l_tg_pt_gp->tg_pt_gp_id, (explict) ? "explict" : "implict", @@ -1001,9 +1001,9 @@ static int core_alua_set_tg_pt_secondary_state( spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; - if (!(tg_pt_gp)) { + if (!tg_pt_gp) { spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); - printk(KERN_ERR "Unable to complete secondary state" + pr_err("Unable to complete secondary state" " transition\n"); return -EINVAL; } @@ -1022,7 +1022,7 @@ static int core_alua_set_tg_pt_secondary_state( ALUA_STATUS_ALTERED_BY_EXPLICT_STPG : ALUA_STATUS_ALTERED_BY_IMPLICT_ALUA; - printk(KERN_INFO "Successful %s ALUA transition TG PT Group: %s ID: %hu" + pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu" " to secondary access state: %s\n", (explict) ? "explict" : "implict", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), tg_pt_gp->tg_pt_gp_id, (offline) ? "OFFLINE" : "ONLINE"); @@ -1040,8 +1040,8 @@ static int core_alua_set_tg_pt_secondary_state( */ if (port->sep_tg_pt_secondary_write_md) { md_buf = kzalloc(md_buf_len, GFP_KERNEL); - if (!(md_buf)) { - printk(KERN_ERR "Unable to allocate md_buf for" + if (!md_buf) { + pr_err("Unable to allocate md_buf for" " secondary ALUA access metadata\n"); return -ENOMEM; } @@ -1062,8 +1062,8 @@ core_alua_allocate_lu_gp(const char *name, int def_group) struct t10_alua_lu_gp *lu_gp; lu_gp = kmem_cache_zalloc(t10_alua_lu_gp_cache, GFP_KERNEL); - if (!(lu_gp)) { - printk(KERN_ERR "Unable to allocate struct t10_alua_lu_gp\n"); + if (!lu_gp) { + pr_err("Unable to allocate struct t10_alua_lu_gp\n"); return ERR_PTR(-ENOMEM); } INIT_LIST_HEAD(&lu_gp->lu_gp_node); @@ -1088,14 +1088,14 @@ int core_alua_set_lu_gp_id(struct t10_alua_lu_gp *lu_gp, u16 lu_gp_id) * The lu_gp->lu_gp_id may only be set once.. */ if (lu_gp->lu_gp_valid_id) { - printk(KERN_WARNING "ALUA LU Group already has a valid ID," + pr_warn("ALUA LU Group already has a valid ID," " ignoring request\n"); return -EINVAL; } spin_lock(&lu_gps_lock); if (alua_lu_gps_count == 0x0000ffff) { - printk(KERN_ERR "Maximum ALUA alua_lu_gps_count:" + pr_err("Maximum ALUA alua_lu_gps_count:" " 0x0000ffff reached\n"); spin_unlock(&lu_gps_lock); kmem_cache_free(t10_alua_lu_gp_cache, lu_gp); @@ -1107,10 +1107,10 @@ again: list_for_each_entry(lu_gp_tmp, &lu_gps_list, lu_gp_node) { if (lu_gp_tmp->lu_gp_id == lu_gp_id_tmp) { - if (!(lu_gp_id)) + if (!lu_gp_id) goto again; - printk(KERN_WARNING "ALUA Logical Unit Group ID: %hu" + pr_warn("ALUA Logical Unit Group ID: %hu" " already exists, ignoring request\n", lu_gp_id); spin_unlock(&lu_gps_lock); @@ -1133,8 +1133,8 @@ core_alua_allocate_lu_gp_mem(struct se_device *dev) struct t10_alua_lu_gp_member *lu_gp_mem; lu_gp_mem = kmem_cache_zalloc(t10_alua_lu_gp_mem_cache, GFP_KERNEL); - if (!(lu_gp_mem)) { - printk(KERN_ERR "Unable to allocate struct t10_alua_lu_gp_member\n"); + if (!lu_gp_mem) { + pr_err("Unable to allocate struct t10_alua_lu_gp_member\n"); return ERR_PTR(-ENOMEM); } INIT_LIST_HEAD(&lu_gp_mem->lu_gp_mem_list); @@ -1218,7 +1218,7 @@ void core_alua_free_lu_gp_mem(struct se_device *dev) return; lu_gp_mem = dev->dev_alua_lu_gp_mem; - if (!(lu_gp_mem)) + if (!lu_gp_mem) return; while (atomic_read(&lu_gp_mem->lu_gp_mem_ref_cnt)) @@ -1226,7 +1226,7 @@ void core_alua_free_lu_gp_mem(struct se_device *dev) spin_lock(&lu_gp_mem->lu_gp_mem_lock); lu_gp = lu_gp_mem->lu_gp; - if ((lu_gp)) { + if (lu_gp) { spin_lock(&lu_gp->lu_gp_lock); if (lu_gp_mem->lu_gp_assoc) { list_del(&lu_gp_mem->lu_gp_mem_list); @@ -1248,10 +1248,10 @@ struct t10_alua_lu_gp *core_alua_get_lu_gp_by_name(const char *name) spin_lock(&lu_gps_lock); list_for_each_entry(lu_gp, &lu_gps_list, lu_gp_node) { - if (!(lu_gp->lu_gp_valid_id)) + if (!lu_gp->lu_gp_valid_id) continue; ci = &lu_gp->lu_gp_group.cg_item; - if (!(strcmp(config_item_name(ci), name))) { + if (!strcmp(config_item_name(ci), name)) { atomic_inc(&lu_gp->lu_gp_ref_cnt); spin_unlock(&lu_gps_lock); return lu_gp; @@ -1307,8 +1307,8 @@ struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp( struct t10_alua_tg_pt_gp *tg_pt_gp; tg_pt_gp = kmem_cache_zalloc(t10_alua_tg_pt_gp_cache, GFP_KERNEL); - if (!(tg_pt_gp)) { - printk(KERN_ERR "Unable to allocate struct t10_alua_tg_pt_gp\n"); + if (!tg_pt_gp) { + pr_err("Unable to allocate struct t10_alua_tg_pt_gp\n"); return NULL; } INIT_LIST_HEAD(&tg_pt_gp->tg_pt_gp_list); @@ -1356,14 +1356,14 @@ int core_alua_set_tg_pt_gp_id( * The tg_pt_gp->tg_pt_gp_id may only be set once.. */ if (tg_pt_gp->tg_pt_gp_valid_id) { - printk(KERN_WARNING "ALUA TG PT Group already has a valid ID," + pr_warn("ALUA TG PT Group already has a valid ID," " ignoring request\n"); return -EINVAL; } spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); if (su_dev->t10_alua.alua_tg_pt_gps_count == 0x0000ffff) { - printk(KERN_ERR "Maximum ALUA alua_tg_pt_gps_count:" + pr_err("Maximum ALUA alua_tg_pt_gps_count:" " 0x0000ffff reached\n"); spin_unlock(&su_dev->t10_alua.tg_pt_gps_lock); kmem_cache_free(t10_alua_tg_pt_gp_cache, tg_pt_gp); @@ -1376,10 +1376,10 @@ again: list_for_each_entry(tg_pt_gp_tmp, &su_dev->t10_alua.tg_pt_gps_list, tg_pt_gp_list) { if (tg_pt_gp_tmp->tg_pt_gp_id == tg_pt_gp_id_tmp) { - if (!(tg_pt_gp_id)) + if (!tg_pt_gp_id) goto again; - printk(KERN_ERR "ALUA Target Port Group ID: %hu already" + pr_err("ALUA Target Port Group ID: %hu already" " exists, ignoring request\n", tg_pt_gp_id); spin_unlock(&su_dev->t10_alua.tg_pt_gps_lock); return -EINVAL; @@ -1403,8 +1403,8 @@ str |