diff options
author | Andy Grover <agrover@redhat.com> | 2011-06-08 13:36:43 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 05:37:48 -0400 |
commit | 6708bb27bb2703da238f21f516034263348af5be (patch) | |
tree | a23e1f9eab22933d773d6b6ad6263d6751379a00 /drivers/target/loopback | |
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/loopback')
-rw-r--r-- | drivers/target/loopback/Kconfig | 6 | ||||
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 94 | ||||
-rw-r--r-- | drivers/target/loopback/tcm_loop.h | 6 |
3 files changed, 47 insertions, 59 deletions
diff --git a/drivers/target/loopback/Kconfig b/drivers/target/loopback/Kconfig index 57dcbc2d711b..abe8ecbcdf06 100644 --- a/drivers/target/loopback/Kconfig +++ b/drivers/target/loopback/Kconfig | |||
@@ -3,9 +3,3 @@ config LOOPBACK_TARGET | |||
3 | help | 3 | help |
4 | Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LLD | 4 | Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LLD |
5 | fabric loopback module. | 5 | fabric loopback module. |
6 | |||
7 | config LOOPBACK_TARGET_CDB_DEBUG | ||
8 | bool "TCM loopback fabric module CDB debug code" | ||
9 | depends on LOOPBACK_TARGET | ||
10 | help | ||
11 | 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 99603bc45786..aa2d67997235 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( | |||
79 | 79 | ||
80 | tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); | 80 | tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); |
81 | if (!tl_cmd) { | 81 | if (!tl_cmd) { |
82 | printk(KERN_ERR "Unable to allocate struct tcm_loop_cmd\n"); | 82 | pr_err("Unable to allocate struct tcm_loop_cmd\n"); |
83 | set_host_byte(sc, DID_ERROR); | 83 | set_host_byte(sc, DID_ERROR); |
84 | return NULL; | 84 | return NULL; |
85 | } | 85 | } |
@@ -281,7 +281,7 @@ static int tcm_loop_queuecommand( | |||
281 | struct tcm_loop_hba *tl_hba; | 281 | struct tcm_loop_hba *tl_hba; |
282 | struct tcm_loop_tpg *tl_tpg; | 282 | struct tcm_loop_tpg *tl_tpg; |
283 | 283 | ||
284 | TL_CDB_DEBUG("tcm_loop_queuecommand() %d:%d:%d:%d got CDB: 0x%02x" | 284 | pr_debug("tcm_loop_queuecommand() %d:%d:%d:%d got CDB: 0x%02x" |
285 | " scsi_buf_len: %u\n", sc->device->host->host_no, | 285 | " scsi_buf_len: %u\n", sc->device->host->host_no, |
286 | sc->device->id, sc->device->channel, sc->device->lun, | 286 | sc->device->id, sc->device->channel, sc->device->lun, |
287 | sc->cmnd[0], scsi_bufflen(sc)); | 287 | sc->cmnd[0], scsi_bufflen(sc)); |
@@ -331,7 +331,7 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) | |||
331 | */ | 331 | */ |
332 | tl_nexus = tl_hba->tl_nexus; | 332 | tl_nexus = tl_hba->tl_nexus; |
333 | if (!tl_nexus) { | 333 | if (!tl_nexus) { |
334 | printk(KERN_ERR "Unable to perform device reset without" | 334 | pr_err("Unable to perform device reset without" |
335 | " active I_T Nexus\n"); | 335 | " active I_T Nexus\n"); |
336 | return FAILED; | 336 | return FAILED; |
337 | } | 337 | } |
@@ -344,13 +344,13 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) | |||
344 | 344 | ||
345 | tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL); | 345 | tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL); |
346 | if (!tl_cmd) { | 346 | if (!tl_cmd) { |
347 | printk(KERN_ERR "Unable to allocate memory for tl_cmd\n"); | 347 | pr_err("Unable to allocate memory for tl_cmd\n"); |
348 | return FAILED; | 348 | return FAILED; |
349 | } | 349 | } |
350 | 350 | ||
351 | tl_tmr = kzalloc(sizeof(struct tcm_loop_tmr), GFP_KERNEL); | 351 | tl_tmr = kzalloc(sizeof(struct tcm_loop_tmr), GFP_KERNEL); |
352 | if (!tl_tmr) { | 352 | if (!tl_tmr) { |
353 | printk(KERN_ERR "Unable to allocate memory for tl_tmr\n"); | 353 | pr_err("Unable to allocate memory for tl_tmr\n"); |
354 | goto release; | 354 | goto release; |
355 | } | 355 | } |
356 | init_waitqueue_head(&tl_tmr->tl_tmr_wait); | 356 | init_waitqueue_head(&tl_tmr->tl_tmr_wait); |
@@ -435,7 +435,7 @@ static int tcm_loop_driver_probe(struct device *dev) | |||
435 | sh = scsi_host_alloc(&tcm_loop_driver_template, | 435 | sh = scsi_host_alloc(&tcm_loop_driver_template, |
436 | sizeof(struct tcm_loop_hba)); | 436 | sizeof(struct tcm_loop_hba)); |
437 | if (!sh) { | 437 | if (!sh) { |
438 | printk(KERN_ERR "Unable to allocate struct scsi_host\n"); | 438 | pr_err("Unable to allocate struct scsi_host\n"); |
439 | return -ENODEV; | 439 | return -ENODEV; |
440 | } | 440 | } |
441 | tl_hba->sh = sh; | 441 | tl_hba->sh = sh; |
@@ -454,7 +454,7 @@ static int tcm_loop_driver_probe(struct device *dev) | |||
454 | 454 | ||
455 | error = scsi_add_host(sh, &tl_hba->dev); | 455 | error = scsi_add_host(sh, &tl_hba->dev); |
456 | if (error) { | 456 | if (error) { |
457 | printk(KERN_ERR "%s: scsi_add_host failed\n", __func__); | 457 | pr_err("%s: scsi_add_host failed\n", __func__); |
458 | scsi_host_put(sh); | 458 | scsi_host_put(sh); |
459 | return -ENODEV; | 459 | return -ENODEV; |
460 | } | 460 | } |
@@ -495,7 +495,7 @@ static int tcm_loop_setup_hba_bus(struct tcm_loop_hba *tl_hba, int tcm_loop_host | |||
495 | 495 | ||
496 | ret = device_register(&tl_hba->dev); | 496 | ret = device_register(&tl_hba->dev); |
497 | if (ret) { | 497 | if (ret) { |
498 | printk(KERN_ERR "device_register() failed for" | 498 | pr_err("device_register() failed for" |
499 | " tl_hba->dev: %d\n", ret); | 499 | " tl_hba->dev: %d\n", ret); |
500 | return -ENODEV; | 500 | return -ENODEV; |
501 | } | 501 | } |
@@ -513,24 +513,24 @@ static int tcm_loop_alloc_core_bus(void) | |||
513 | 513 | ||
514 | tcm_loop_primary = root_device_register("tcm_loop_0"); | 514 | tcm_loop_primary = root_device_register("tcm_loop_0"); |
515 | if (IS_ERR(tcm_loop_primary)) { | 515 | if (IS_ERR(tcm_loop_primary)) { |
516 | printk(KERN_ERR "Unable to allocate tcm_loop_primary\n"); | 516 | pr_err("Unable to allocate tcm_loop_primary\n"); |
517 | return PTR_ERR(tcm_loop_primary); | 517 | return PTR_ERR(tcm_loop_primary); |
518 | } | 518 | } |
519 | 519 | ||
520 | ret = bus_register(&tcm_loop_lld_bus); | 520 | ret = bus_register(&tcm_loop_lld_bus); |
521 | if (ret) { | 521 | if (ret) { |
522 | printk(KERN_ERR "bus_register() failed for tcm_loop_lld_bus\n"); | 522 | pr_err("bus_register() failed for tcm_loop_lld_bus\n"); |
523 | goto dev_unreg; | 523 | goto dev_unreg; |
524 | } | 524 | } |
525 | 525 | ||
526 | ret = driver_register(&tcm_loop_driverfs); | 526 | ret = driver_register(&tcm_loop_driverfs); |
527 | if (ret) { | 527 | if (ret) { |
528 | printk(KERN_ERR "driver_register() failed for" | 528 | pr_err("driver_register() failed for" |
529 | "tcm_loop_driverfs\n"); | 529 | "tcm_loop_driverfs\n"); |
530 | goto bus_unreg; | 530 | goto bus_unreg; |
531 | } | 531 | } |
532 | 532 | ||
533 | printk(KERN_INFO "Initialized TCM Loop Core Bus\n"); | 533 | pr_debug("Initialized TCM Loop Core Bus\n"); |
534 | return ret; | 534 | return ret; |
535 | 535 | ||
536 | bus_unreg: | 536 | bus_unreg: |
@@ -546,7 +546,7 @@ static void tcm_loop_release_core_bus(void) | |||
546 | bus_unregister(&tcm_loop_lld_bus); | 546 | bus_unregister(&tcm_loop_lld_bus); |
547 | root_device_unregister(tcm_loop_primary); | 547 | root_device_unregister(tcm_loop_primary); |
548 | 548 | ||
549 | printk(KERN_INFO "Releasing TCM Loop Core BUS\n"); | 549 | pr_debug("Releasing TCM Loop Core BUS\n"); |
550 | } | 550 | } |
551 | 551 | ||
552 | static char *tcm_loop_get_fabric_name(void) | 552 | 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) | |||
574 | case SCSI_PROTOCOL_ISCSI: | 574 | case SCSI_PROTOCOL_ISCSI: |
575 | return iscsi_get_fabric_proto_ident(se_tpg); | 575 | return iscsi_get_fabric_proto_ident(se_tpg); |
576 | default: | 576 | default: |
577 | printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" | 577 | pr_err("Unknown tl_proto_id: 0x%02x, using" |
578 | " SAS emulation\n", tl_hba->tl_proto_id); | 578 | " SAS emulation\n", tl_hba->tl_proto_id); |
579 | break; | 579 | break; |
580 | } | 580 | } |
@@ -630,7 +630,7 @@ static u32 tcm_loop_get_pr_transport_id( | |||
630 | return iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg, | 630 | return iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg, |
631 | format_code, buf); | 631 | format_code, buf); |
632 | default: | 632 | default: |
633 | printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" | 633 | pr_err("Unknown tl_proto_id: 0x%02x, using" |
634 | " SAS emulation\n", tl_hba->tl_proto_id); | 634 | " SAS emulation\n", tl_hba->tl_proto_id); |
635 | break; | 635 | break; |
636 | } | 636 | } |
@@ -660,7 +660,7 @@ static u32 tcm_loop_get_pr_transport_id_len( | |||
660 | return iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg, | 660 | return iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg, |
661 | format_code); | 661 | format_code); |
662 | default: | 662 | default: |
663 | printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" | 663 | pr_err("Unknown tl_proto_id: 0x%02x, using" |
664 | " SAS emulation\n", tl_hba->tl_proto_id); | 664 | " SAS emulation\n", tl_hba->tl_proto_id); |
665 | break; | 665 | break; |
666 | } | 666 | } |
@@ -694,7 +694,7 @@ static char *tcm_loop_parse_pr_out_transport_id( | |||
694 | return iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len, | 694 | return iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len, |
695 | port_nexus_ptr); | 695 | port_nexus_ptr); |
696 | default: | 696 | default: |
697 | printk(KERN_ERR "Unknown tl_proto_id: 0x%02x, using" | 697 | pr_err("Unknown tl_proto_id: 0x%02x, using" |
698 | " SAS emulation\n", tl_hba->tl_proto_id); | 698 | " SAS emulation\n", tl_hba->tl_proto_id); |
699 | break; | 699 | break; |
700 | } | 700 | } |
@@ -743,7 +743,7 @@ static struct se_node_acl *tcm_loop_tpg_alloc_fabric_acl( | |||
743 | 743 | ||
744 | tl_nacl = kzalloc(sizeof(struct tcm_loop_nacl), GFP_KERNEL); | 744 | tl_nacl = kzalloc(sizeof(struct tcm_loop_nacl), GFP_KERNEL); |
745 | if (!tl_nacl) { | 745 | if (!tl_nacl) { |
746 | printk(KERN_ERR "Unable to allocate struct tcm_loop_nacl\n"); | 746 | pr_err("Unable to allocate struct tcm_loop_nacl\n"); |
747 | return NULL; | 747 | return NULL; |
748 | } | 748 | } |
749 | 749 | ||
@@ -853,7 +853,7 @@ static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) | |||
853 | struct tcm_loop_cmd, tl_se_cmd); | 853 | struct tcm_loop_cmd, tl_se_cmd); |
854 | struct scsi_cmnd *sc = tl_cmd->sc; | 854 | struct scsi_cmnd *sc = tl_cmd->sc; |
855 | 855 | ||
856 | TL_CDB_DEBUG("tcm_loop_queue_data_in() called for scsi_cmnd: %p" | 856 | pr_debug("tcm_loop_queue_data_in() called for scsi_cmnd: %p" |
857 | " cdb: 0x%02x\n", sc, sc->cmnd[0]); | 857 | " cdb: 0x%02x\n", sc, sc->cmnd[0]); |
858 | 858 | ||
859 | sc->result = SAM_STAT_GOOD; | 859 | sc->result = SAM_STAT_GOOD; |
@@ -868,7 +868,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) | |||
868 | struct tcm_loop_cmd, tl_se_cmd); | 868 | struct tcm_loop_cmd, tl_se_cmd); |
869 | struct scsi_cmnd *sc = tl_cmd->sc; | 869 | struct scsi_cmnd *sc = tl_cmd->sc; |
870 | 870 | ||
871 | TL_CDB_DEBUG("tcm_loop_queue_status() called for scsi_cmnd: %p" | 871 | pr_debug("tcm_loop_queue_status() called for scsi_cmnd: %p" |
872 | " cdb: 0x%02x\n", sc, sc->cmnd[0]); | 872 | " cdb: 0x%02x\n", sc, sc->cmnd[0]); |
873 | 873 | ||
874 | if (se_cmd->sense_buffer && | 874 | if (se_cmd->sense_buffer && |
@@ -943,7 +943,7 @@ static int tcm_loop_port_link( | |||
943 | */ | 943 | */ |
944 | scsi_add_device(tl_hba->sh, 0, tl_tpg->tl_tpgt, lun->unpacked_lun); | 944 | scsi_add_device(tl_hba->sh, 0, tl_tpg->tl_tpgt, lun->unpacked_lun); |
945 | 945 | ||
946 | printk(KERN_INFO "TCM_Loop_ConfigFS: Port Link Successful\n"); | 946 | pr_debug("TCM_Loop_ConfigFS: Port Link Successful\n"); |
947 | return 0; | 947 | return 0; |
948 | } | 948 | } |
949 | 949 | ||
@@ -961,7 +961,7 @@ static void tcm_loop_port_unlink( | |||
961 | sd = scsi_device_lookup(tl_hba->sh, 0, tl_tpg->tl_tpgt, | 961 | sd = scsi_device_lookup(tl_hba->sh, 0, tl_tpg->tl_tpgt, |
962 | se_lun->unpacked_lun); | 962 | se_lun->unpacked_lun); |
963 | if (!sd) { | 963 | if (!sd) { |
964 | printk(KERN_ERR "Unable to locate struct scsi_device for %d:%d:" | 964 | pr_err("Unable to locate struct scsi_device for %d:%d:" |
965 | "%d\n", 0, tl_tpg->tl_tpgt, se_lun->unpacked_lun); | 965 | "%d\n", 0, tl_tpg->tl_tpgt, se_lun->unpacked_lun); |
966 | return; | 966 | return; |
967 | } | 967 | } |
@@ -974,7 +974,7 @@ static void tcm_loop_port_unlink( | |||
974 | atomic_dec(&tl_tpg->tl_tpg_port_count); | 974 | atomic_dec(&tl_tpg->tl_tpg_port_count); |
975 | smp_mb__after_atomic_dec(); | 975 | smp_mb__after_atomic_dec(); |
976 | 976 | ||
977 | printk(KERN_INFO "TCM_Loop_ConfigFS: Port Unlink Successful\n"); | 977 | pr_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n"); |
978 | } | 978 | } |
979 | 979 | ||
980 | /* End items for tcm_loop_port_cit */ | 980 | /* End items for tcm_loop_port_cit */ |
@@ -991,14 +991,14 @@ static int tcm_loop_make_nexus( | |||
991 | int ret = -ENOMEM; | 991 | int ret = -ENOMEM; |
992 | 992 | ||
993 | if (tl_tpg->tl_hba->tl_nexus) { | 993 | if (tl_tpg->tl_hba->tl_nexus) { |
994 | printk(KERN_INFO "tl_tpg->tl_hba->tl_nexus already exists\n"); | 994 | pr_debug("tl_tpg->tl_hba->tl_nexus already exists\n"); |
995 | return -EEXIST; | 995 | return -EEXIST; |
996 | } | 996 | } |
997 | se_tpg = &tl_tpg->tl_se_tpg; | 997 | se_tpg = &tl_tpg->tl_se_tpg; |
998 | 998 | ||
999 | tl_nexus = kzalloc(sizeof(struct tcm_loop_nexus), GFP_KERNEL); | 999 | tl_nexus = kzalloc(sizeof(struct tcm_loop_nexus), GFP_KERNEL); |
1000 | if (!tl_nexus) { | 1000 | if (!tl_nexus) { |
1001 | printk(KERN_ERR "Unable to allocate struct tcm_loop_nexus\n"); | 1001 | pr_err("Unable to allocate struct tcm_loop_nexus\n"); |
1002 | return -ENOMEM; | 1002 | return -ENOMEM; |
1003 | } | 1003 | } |
1004 | /* | 1004 | /* |
@@ -1027,7 +1027,7 @@ static int tcm_loop_make_nexus( | |||
1027 | __transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, | 1027 | __transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, |
1028 | tl_nexus->se_sess, tl_nexus); | 1028 | tl_nexus->se_sess, tl_nexus); |
1029 | tl_tpg->tl_hba->tl_nexus = tl_nexus; | 1029 | tl_tpg->tl_hba->tl_nexus = tl_nexus; |
1030 | printk(KERN_INFO "TCM_Loop_ConfigFS: Established I_T Nexus to emulated" | 1030 | pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" |
1031 | " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), | 1031 | " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), |
1032 | name); | 1032 | name); |
1033 | return 0; | 1033 | return 0; |
@@ -1053,13 +1053,13 @@ static int tcm_loop_drop_nexus( | |||
1053 | return -ENODEV; | 1053 | return -ENODEV; |
1054 | 1054 | ||
1055 | if (atomic_read(&tpg->tl_tpg_port_count)) { | 1055 | if (atomic_read(&tpg->tl_tpg_port_count)) { |
1056 | printk(KERN_ERR "Unable to remove TCM_Loop I_T Nexus with" | 1056 | pr_err("Unable to remove TCM_Loop I_T Nexus with" |
1057 | " active TPG port count: %d\n", | 1057 | " active TPG port count: %d\n", |
1058 | atomic_read(&tpg->tl_tpg_port_count)); | 1058 | atomic_read(&tpg->tl_tpg_port_count)); |
1059 | return -EPERM; | 1059 | return -EPERM; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | printk(KERN_INFO "TCM_Loop_ConfigFS: Removing I_T Nexus to emulated" | 1062 | pr_debug("TCM_Loop_ConfigFS: Removing I_T Nexus to emulated" |
1063 | " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), | 1063 | " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba), |
1064 | tl_nexus->se_sess->se_node_acl->initiatorname); | 1064 | tl_nexus->se_sess->se_node_acl->initiatorname); |
1065 | /* | 1065 | /* |
@@ -1115,7 +1115,7 @@ static ssize_t tcm_loop_tpg_store_nexus( | |||
1115 | * tcm_loop_make_nexus() | 1115 | * tcm_loop_make_nexus() |
1116 | */ | 1116 | */ |
1117 | if (strlen(page) >= TL_WWN_ADDR_LEN) { | 1117 | if (strlen(page) >= TL_WWN_ADDR_LEN) { |
1118 | printk(KERN_ERR "Emulated NAA Sas Address: %s, exceeds" | 1118 | pr_err("Emulated NAA Sas Address: %s, exceeds" |
1119 | " max: %d\n", page, TL_WWN_ADDR_LEN); | 1119 | " max: %d\n", page, TL_WWN_ADDR_LEN); |
1120 | return -EINVAL; | 1120 | return -EINVAL; |
1121 | } | 1121 | } |
@@ -1124,7 +1124,7 @@ static ssize_t tcm_loop_tpg_store_nexus( | |||
1124 | ptr = strstr(i_port, "naa."); | 1124 | ptr = strstr(i_port, "naa."); |
1125 | if (ptr) { | 1125 | if (ptr) { |
1126 | if (tl_hba->tl_proto_id != SCSI_PROTOCOL_SAS) { | 1126 | if (tl_hba->tl_proto_id != SCSI_PROTOCOL_SAS) { |
1127 | printk(KERN_ERR "Passed SAS Initiator Port %s does not" | 1127 | pr_err("Passed SAS Initiator Port %s does not" |
1128 | " match target port protoid: %s\n", i_port, | 1128 | " match target port protoid: %s\n", i_port, |
1129 | tcm_loop_dump_proto_id(tl_hba)); | 1129 | tcm_loop_dump_proto_id(tl_hba)); |
1130 | return -EINVAL; | 1130 | return -EINVAL; |
@@ -1135,7 +1135,7 @@ static ssize_t tcm_loop_tpg_store_nexus( | |||
1135 | ptr = strstr(i_port, "fc."); | 1135 | ptr = strstr(i_port, "fc."); |
1136 | if (ptr) { | 1136 | if (ptr) { |
1137 | if (tl_hba->tl_proto_id != SCSI_PROTOCOL_FCP) { | 1137 | if (tl_hba->tl_proto_id != SCSI_PROTOCOL_FCP) { |
1138 | printk(KERN_ERR "Passed FCP Initiator Port %s does not" | 1138 | pr_err("Passed FCP Initiator Port %s does not" |
1139 | " match target port protoid: %s\n", i_port, | 1139 | " match target port protoid: %s\n", i_port, |
1140 | tcm_loop_dump_proto_id(tl_hba)); | 1140 | tcm_loop_dump_proto_id(tl_hba)); |
1141 | return -EINVAL; | 1141 | return -EINVAL; |
@@ -1146,7 +1146,7 @@ static ssize_t tcm_loop_tpg_store_nexus( | |||
1146 | ptr = strstr(i_port, "iqn."); | 1146 | ptr = strstr(i_port, "iqn."); |
1147 | if (ptr) { | 1147 | if (ptr) { |
1148 | if (tl_hba->tl_proto_id != SCSI_PROTOCOL_ISCSI) { | 1148 | if (tl_hba->tl_proto_id != SCSI_PROTOCOL_ISCSI) { |
1149 | printk(KERN_ERR "Passed iSCSI Initiator Port %s does not" | 1149 | pr_err("Passed iSCSI Initiator Port %s does not" |
1150 | " match target port protoid: %s\n", i_port, | 1150 | " match target port protoid: %s\n", i_port, |
1151 | tcm_loop_dump_proto_id(tl_hba)); | 1151 | tcm_loop_dump_proto_id(tl_hba)); |
1152 | return -EINVAL; | 1152 | return -EINVAL; |
@@ -1154,7 +1154,7 @@ static ssize_t tcm_loop_tpg_store_nexus( | |||
1154 | port_ptr = &i_port[0]; | 1154 | port_ptr = &i_port[0]; |
1155 | goto check_newline; | 1155 | goto check_newline; |
1156 | } | 1156 | } |
1157 | printk(KERN_ERR "Unable to locate prefix for emulated Initiator Port:" | 1157 | pr_err("Unable to locate prefix for emulated Initiator Port:" |
1158 | " %s\n", i_port); | 1158 | " %s\n", i_port); |
1159 | return -EINVAL; | 1159 | return -EINVAL; |
1160 | /* | 1160 | /* |
@@ -1194,7 +1194,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( | |||
1194 | 1194 | ||
1195 | tpgt_str = strstr(name, "tpgt_"); | 1195 | tpgt_str = strstr(name, "tpgt_"); |
1196 | if (!tpgt_str) { | 1196 | if (!tpgt_str) { |
1197 | printk(KERN_ERR "Unable to locate \"tpgt_#\" directory" | 1197 | pr_err("Unable to locate \"tpgt_#\" directory" |
1198 | " group\n"); | 1198 | " group\n"); |
1199 | return ERR_PTR(-EINVAL); | 1199 | return ERR_PTR(-EINVAL); |
1200 | } | 1200 | } |
@@ -1202,7 +1202,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( | |||
1202 | tpgt = (unsigned short int) simple_strtoul(tpgt_str, &end_ptr, 0); | 1202 | tpgt = (unsigned short int) simple_strtoul(tpgt_str, &end_ptr, 0); |
1203 | 1203 | ||
1204 | if (tpgt >= TL_TPGS_PER_HBA) { | 1204 | if (tpgt >= TL_TPGS_PER_HBA) { |
1205 | printk(KERN_ERR "Passed tpgt: %hu exceeds TL_TPGS_PER_HBA:" | 1205 | pr_err("Passed tpgt: %hu exceeds TL_TPGS_PER_HBA:" |
1206 | " %u\n", tpgt, TL_TPGS_PER_HBA); | 1206 | " %u\n", tpgt, TL_TPGS_PER_HBA); |
1207 | return ERR_PTR(-EINVAL); | 1207 | return ERR_PTR(-EINVAL); |
1208 | } | 1208 | } |
@@ -1218,7 +1218,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( | |||
1218 | if (ret < 0) | 1218 | if (ret < 0) |
1219 | return ERR_PTR(-ENOMEM); | 1219 | return ERR_PTR(-ENOMEM); |
1220 | 1220 | ||
1221 | printk(KERN_INFO "TCM_Loop_ConfigFS: Allocated Emulated %s" | 1221 | pr_debug("TCM_Loop_ConfigFS: Allocated Emulated %s" |
1222 | " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), | 1222 | " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), |
1223 | config_item_name(&wwn->wwn_group.cg_item), tpgt); | 1223 | config_item_name(&wwn->wwn_group.cg_item), tpgt); |
1224 | 1224 | ||
@@ -1245,7 +1245,7 @@ void tcm_loop_drop_naa_tpg( | |||
1245 | */ | 1245 | */ |
1246 | core_tpg_deregister(se_tpg); | 1246 | core_tpg_deregister(se_tpg); |
1247 | 1247 | ||
1248 | printk(KERN_INFO "TCM_Loop_ConfigFS: Deallocated Emulated %s" | 1248 | pr_debug("TCM_Loop_ConfigFS: Deallocated Emulated %s" |
1249 | " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), | 1249 | " Target Port %s,t,0x%04x\n", tcm_loop_dump_proto_id(tl_hba), |
1250 | config_item_name(&wwn->wwn_group.cg_item), tpgt); | 1250 | config_item_name(&wwn->wwn_group.cg_item), tpgt); |
1251 | } | 1251 | } |
@@ -1266,7 +1266,7 @@ struct se_wwn *tcm_loop_make_scsi_hba( | |||
1266 | 1266 | ||
1267 | tl_hba = kzalloc(sizeof(struct tcm_loop_hba), GFP_KERNEL); | 1267 | tl_hba = kzalloc(sizeof(struct tcm_loop_hba), GFP_KERNEL); |
1268 | if (!tl_hba) { | 1268 | if (!tl_hba) { |
1269 | printk(KERN_ERR "Unable to allocate struct tcm_loop_hba\n"); | 1269 | pr_err("Unable to allocate struct tcm_loop_hba\n"); |
1270 | return ERR_PTR(-ENOMEM); | 1270 | return ERR_PTR(-ENOMEM); |
1271 | } | 1271 | } |
1272 | /* | 1272 | /* |
@@ -1286,7 +1286,7 @@ struct se_wwn *tcm_loop_make_scsi_hba( | |||
1286 | } | 1286 | } |
1287 | ptr = strstr(name, "iqn."); | 1287 | ptr = strstr(name, "iqn."); |
1288 | if (!ptr) { | 1288 | if (!ptr) { |
1289 | printk(KERN_ERR "Unable to locate prefix for emulated Target " | 1289 | pr_err("Unable to locate prefix for emulated Target " |
1290 | "Port: %s\n", name); | 1290 | "Port: %s\n", name); |
1291 | ret = -EINVAL; | 1291 | ret = -EINVAL; |
1292 | goto out; | 1292 | goto out; |
@@ -1295,7 +1295,7 @@ struct se_wwn *tcm_loop_make_scsi_hba( | |||
1295 | 1295 | ||
1296 | check_len: | 1296 | check_len: |
1297 | if (strlen(name) >= TL_WWN_ADDR_LEN) { | 1297 | if (strlen(name) >= TL_WWN_ADDR_LEN) { |
1298 | printk(KERN_ERR "Emulated NAA %s Address: %s, exceeds" | 1298 | pr_err("Emulated NAA %s Address: %s, exceeds" |
1299 | " max: %d\n", name, tcm_loop_dump_proto_id(tl_hba), | 1299 | " max: %d\n", name, tcm_loop_dump_proto_id(tl_hba), |
1300 | TL_WWN_ADDR_LEN); | 1300 | TL_WWN_ADDR_LEN); |
1301 | ret = -EINVAL; | 1301 | ret = -EINVAL; |
@@ -1314,7 +1314,7 @@ check_len: | |||
1314 | 1314 | ||
1315 | sh = tl_hba->sh; | 1315 | sh = tl_hba->sh; |
1316 | tcm_loop_hba_no_cnt++; | 1316 | tcm_loop_hba_no_cnt++; |
1317 | printk(KERN_INFO "TCM_Loop_ConfigFS: Allocated emulated Target" | 1317 | pr_debug("TCM_Loop_ConfigFS: Allocated emulated Target" |
1318 | " %s Address: %s at Linux/SCSI Host ID: %d\n", | 1318 | " %s Address: %s at Linux/SCSI Host ID: %d\n", |
1319 | tcm_loop_dump_proto_id(tl_hba), name, sh->host_no); | 1319 | tcm_loop_dump_proto_id(tl_hba), name, sh->host_no); |
1320 | 1320 | ||
@@ -1337,7 +1337,7 @@ void tcm_loop_drop_scsi_hba( | |||
1337 | */ | 1337 | */ |
1338 | device_unregister(&tl_hba->dev); | 1338 | device_unregister(&tl_hba->dev); |
1339 | 1339 | ||
1340 | printk(KERN_INFO "TCM_Loop_ConfigFS: Deallocated emulated Target" | 1340 | pr_debug("TCM_Loop_ConfigFS: Deallocated emulated Target" |
1341 | " SAS Address: %s at Linux/SCSI Host ID: %d\n", | 1341 | " SAS Address: %s at Linux/SCSI Host ID: %d\n", |
1342 | config_item_name(&wwn->wwn_group.cg_item), host_no); | 1342 | config_item_name(&wwn->wwn_group.cg_item), host_no); |
1343 | } | 1343 | } |
@@ -1373,7 +1373,7 @@ static int tcm_loop_register_configfs(void) | |||
1373 | */ | 1373 | */ |
1374 | fabric = target_fabric_configfs_init(THIS_MODULE, "loopback"); | 1374 | fabric = target_fabric_configfs_init(THIS_MODULE, "loopback"); |
1375 | if (IS_ERR(fabric)) { | 1375 | if (IS_ERR(fabric)) { |
1376 | printk(KERN_ERR "tcm_loop_register_configfs() failed!\n"); | 1376 | pr_err("tcm_loop_register_configfs() failed!\n"); |
1377 | return PTR_ERR(fabric); | 1377 | return PTR_ERR(fabric); |
1378 | } | 1378 | } |
1379 | /* | 1379 | /* |
@@ -1464,7 +1464,7 @@ static int tcm_loop_register_configfs(void) | |||
1464 | */ | 1464 | */ |
1465 | ret = target_fabric_configfs_register(fabric); | 1465 | ret = target_fabric_configfs_register(fabric); |
1466 | if (ret < 0) { | 1466 | if (ret < 0) { |
1467 | printk(KERN_ERR "target_fabric_configfs_register() for" | 1467 | pr_err("target_fabric_configfs_register() for" |
1468 | " TCM_Loop failed!\n"); | 1468 | " TCM_Loop failed!\n"); |
1469 | target_fabric_configfs_free(fabric); | 1469 | target_fabric_configfs_free(fabric); |
1470 | return -1; | 1470 | return -1; |
@@ -1473,7 +1473,7 @@ static int tcm_loop_register_configfs(void) | |||
1473 | * Setup our local pointer to *fabric. | 1473 | * Setup our local pointer to *fabric. |
1474 | */ | 1474 | */ |
1475 | tcm_loop_fabric_configfs = fabric; | 1475 | tcm_loop_fabric_configfs = fabric; |
1476 | printk(KERN_INFO "TCM_LOOP[0] - Set fabric ->" | 1476 | pr_debug("TCM_LOOP[0] - Set fabric ->" |
1477 | " tcm_loop_fabric_configfs\n"); | 1477 | " tcm_loop_fabric_configfs\n"); |
1478 | return 0; | 1478 | return 0; |
1479 | } | 1479 | } |
@@ -1485,7 +1485,7 @@ static void tcm_loop_deregister_configfs(void) | |||
1485 | 1485 | ||
1486 | target_fabric_configfs_deregister(tcm_loop_fabric_configfs); | 1486 | target_fabric_configfs_deregister(tcm_loop_fabric_configfs); |
1487 | tcm_loop_fabric_configfs = NULL; | 1487 | tcm_loop_fabric_configfs = NULL; |
1488 | printk(KERN_INFO "TCM_LOOP[0] - Cleared" | 1488 | pr_debug("TCM_LOOP[0] - Cleared" |
1489 | " tcm_loop_fabric_configfs\n"); | 1489 | " tcm_loop_fabric_configfs\n"); |
1490 | } | 1490 | } |
1491 | 1491 | ||
@@ -1498,7 +1498,7 @@ static int __init tcm_loop_fabric_init(void) | |||
1498 | __alignof__(struct tcm_loop_cmd), | 1498 | __alignof__(struct tcm_loop_cmd), |
1499 | 0, NULL); | 1499 | 0, NULL); |
1500 | if (!tcm_loop_cmd_cache) { | 1500 | if (!tcm_loop_cmd_cache) { |
1501 | printk(KERN_ERR "kmem_cache_create() for" | 1501 | pr_debug("kmem_cache_create() for" |
1502 | " tcm_loop_cmd_cache failed\n"); | 1502 | " tcm_loop_cmd_cache failed\n"); |
1503 | return -ENOMEM; | 1503 | return -ENOMEM; |
1504 | } | 1504 | } |
diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h index 7e9f7ab45548..6b76c7a22bb0 100644 --- a/drivers/target/loopback/tcm_loop.h +++ b/drivers/target/loopback/tcm_loop.h | |||
@@ -16,12 +16,6 @@ | |||
16 | */ | 16 | */ |
17 | #define TL_SCSI_MAX_CMD_LEN 32 | 17 | #define TL_SCSI_MAX_CMD_LEN 32 |
18 | 18 | ||
19 | #ifdef CONFIG_LOOPBACK_TARGET_CDB_DEBUG | ||
20 | # define TL_CDB_DEBUG(x...) printk(KERN_INFO x) | ||
21 | #else | ||
22 | # define TL_CDB_DEBUG(x...) | ||
23 | #endif | ||
24 | |||
25 | struct tcm_loop_cmd { | 19 | struct tcm_loop_cmd { |
26 | /* State of Linux/SCSI CDB+Data descriptor */ | 20 | /* State of Linux/SCSI CDB+Data descriptor */ |
27 | u32 sc_cmd_state; | 21 | u32 sc_cmd_state; |