Skip to contentSkip to conversation

Improve SCSI target logs

PATCH New Anastasia Kovaleva 2 participants 13 messages Nov 29, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Improve SCSI target logs

This patch series address two main issues of the current logs in SCSI target (discussed in [1]):

1. Absence of a common prefix for the subsystem to make it possible to filter them out to a separate file.
2. Absence of an I-T-L nexus in a log message to understand what is that log for.

Patches 2 - 6 of the series are automated. So, we also included fixes [PATCH 04] of other style errors and warnings that checkpatch can fix. We've been using these logs for almost an year and didn't encounter any kind of problems.

Code style of all patches was made by git clang-format with these additional parameters:

+AllowAllArgumentsOnNextLine: false
+ColumnLimit: 100
+PenaltyBreakOpenParenthesis: 12000
+PenaltyBreakBeforeFirstCallParameter: 12000
+PenaltyBreakString: 12000

In general, logs present in the following format:
target <file_prefix>: General log Message
target <file_prefix> (<iqn_initiator> -> <RTPI>): Session Log Message target <file_prefix> (<iqn_initiator> -> <RTPI>/<MappedLun>): Command Log Message target <file_prefix> <fabric_name>_tpg[<tpg_tag>](<tpg_rtpi>/<LUN>): Lun Log Message

Examples:
target sbp: initiator already logged-in
target core (iqn.2001-09.com.example:foobar-1 -> 1): ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: 2281488 target core (iqn.2001-09.com.example:foobar-1 -> 1/99): Unknown PERSISTENT_RESERVE_OUT service action: 0x11 target core iSCSI_tpg[1](1/99): Unable to extract alua_tg_pt_status

[1] - https://lore.kernel.org/target-devel/[email protected]/

Anastasia Kovaleva (10):
target: core: Improve SCSI target logs
target: Use new log wrappers
target: Fix quoted strings splitting
target: Fix some obvious style problems
target: Add log prefix to all tcm files
target: Remove old prefixes from log messages
target: core: Extend CaW logging
target: core: Use extended logs where possible
target: Use __func__ in logs
target: iscsi: Improve a log message

 drivers/target/iscsi/cxgbit/cxgbit_cm.c       | 191 +++---
 drivers/target/iscsi/cxgbit/cxgbit_ddp.c      |  19 +-
 drivers/target/iscsi/cxgbit/cxgbit_main.c     |  47 +-
 drivers/target/iscsi/cxgbit/cxgbit_target.c   | 115 ++--
 drivers/target/iscsi/iscsi_target.c           | 559 +++++++--------
 drivers/target/iscsi/iscsi_target_auth.c      | 123 ++--
 drivers/target/iscsi/iscsi_target_configfs.c  |  91 +--
 .../target/iscsi/iscsi_target_datain_values.c |  20 +-
 drivers/target/iscsi/iscsi_target_device.c    |   4 +-
 drivers/target/iscsi/iscsi_target_erl0.c      | 149 ++--
 drivers/target/iscsi/iscsi_target_erl1.c      | 158 ++---
 drivers/target/iscsi/iscsi_target_erl2.c      |  60 +-
 drivers/target/iscsi/iscsi_target_login.c     | 157 ++---
 drivers/target/iscsi/iscsi_target_nego.c      | 187 +++---
 .../target/iscsi/iscsi_target_nodeattrib.c    |  94 ++-
 .../target/iscsi/iscsi_target_parameters.c    | 354 ++++------
 .../target/iscsi/iscsi_target_seq_pdu_list.c  |  86 +--
 drivers/target/iscsi/iscsi_target_stat.c      |   2 +
 drivers/target/iscsi/iscsi_target_tmr.c       | 121 ++--
 drivers/target/iscsi/iscsi_target_tpg.c       | 172 +++--
 drivers/target/iscsi/iscsi_target_transport.c |   6 +-
 drivers/target/iscsi/iscsi_target_util.c      | 133 ++--
 drivers/target/loopback/tcm_loop.c            | 114 ++--
 drivers/target/sbp/sbp_target.c               | 156 +++--
 drivers/target/target_core_alua.c             | 192 +++---
 drivers/target/target_core_configfs.c         | 533 ++++++---------
 drivers/target/target_core_device.c           |  99 +--
 drivers/target/target_core_fabric_configfs.c  |  65 +-
 drivers/target/target_core_fabric_lib.c       |  27 +-
 drivers/target/target_core_file.c             | 126 ++--
 drivers/target/target_core_hba.c              |  15 +-
 drivers/target/target_core_iblock.c           |  96 ++-
 drivers/target/target_core_pr.c               | 635 ++++++++----------
 drivers/target/target_core_pscsi.c            | 160 ++---
 drivers/target/target_core_rd.c               |  87 ++-
 drivers/target/target_core_sbc.c              | 159 ++---
 drivers/target/target_core_spc.c              |  32 +-
 drivers/target/target_core_stat.c             |   4 +-
 drivers/target/target_core_tmr.c              |  57 +-
 drivers/target/target_core_tpg.c              |  81 +--
 drivers/target/target_core_transport.c        | 226 +++----
 drivers/target/target_core_ua.c               |  27 +-
 drivers/target/target_core_user.c             | 257 ++++---
 drivers/target/target_core_xcopy.c            | 228 +++----
 drivers/target/tcm_fc/tcm_fc.h                |   2 +-
 drivers/target/tcm_fc/tfc_cmd.c               |  47 +-
 drivers/target/tcm_fc/tfc_conf.c              |  18 +-
 drivers/target/tcm_fc/tfc_io.c                |  22 +-
 drivers/target/tcm_fc/tfc_sess.c              |   7 +-
 drivers/target/tcm_remote/tcm_remote.c        |  41 +-
 include/target/target_core_base.h             |  92 +++
 51 files changed, 2847 insertions(+), 3606 deletions(-)
Signature · 1 line
2.40.3
#1 lore raw

PATCH 1/10 target: core: Improve SCSI target logs

Introduce a new logging wrapper.

---
 include/target/target_core_base.h | 92 +++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
include/target/target_core_base.h +92 -0
index 97099a5e3f6c..da4c09d3698b 100644
@@ -11,6 +11,98 @@
 
 #define TARGET_CORE_VERSION		"v5.0"
 
+/*
+ * Unified target core logs
+ */
+#define target_sess_log(LVL, SESS, FMT, ...) \
+	pr_##LVL("target " TARGET_PREFIX " (%s -> %d): " FMT, \
+		(SESS)->se_node_acl->initiatorname, \
+		(SESS)->se_tpg->tpg_rtpi, ##__VA_ARGS__)
+
+#define target_cmd_log(LVL, CMD, FMT, ...) \
+	pr_##LVL("target " TARGET_PREFIX " (%s -> %d/%lld): " FMT, \
+		(CMD)->se_sess->se_node_acl->initiatorname, \
+		(CMD)->se_sess->se_tpg->tpg_rtpi, \
+		(CMD)->orig_fe_lun, ##__VA_ARGS__)
+
+#define target_lun_log(LVL, LUN, FMT, ...) \
+	pr_##LVL("target " TARGET_PREFIX " %s_tpg[%hu](%d/%llu): " FMT, \
+		(LUN)->lun_tpg->se_tpg_tfo->fabric_name, \
+		(LUN)->lun_tpg->se_tpg_tfo->tpg_get_tag(LUN->lun_tpg), \
+		(LUN)->lun_tpg->tpg_rtpi, \
+		(LUN)->unpacked_lun, ##__VA_ARGS__)
+
+#define target_log(LVL, FMT, ...) \
+	pr_##LVL("target " TARGET_PREFIX ": " FMT, ##__VA_ARGS__)
+
+#define target_sess_debug(SESS, FMT, ...)  target_sess_log(debug, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_info(SESS, FMT, ...)   target_sess_log(info, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_notice(SESS, FMT, ...) target_sess_log(notice, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_warn(SESS, FMT, ...)   target_sess_log(warn, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_err(SESS, FMT, ...)    target_sess_log(err, SESS, FMT, ##__VA_ARGS__)
+
+#define target_cmd_debug(CMD, FMT, ...)  target_cmd_log(debug, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_info(CMD, FMT, ...)   target_cmd_log(info, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_notice(CMD, FMT, ...) target_cmd_log(notice, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_warn(CMD, FMT, ...)   target_cmd_log(warn, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_err(CMD, FMT, ...)    target_cmd_log(err, CMD, FMT, ##__VA_ARGS__)
+
+#define target_lun_debug(LUN, FMT, ...)  target_lun_log(debug, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_info(LUN, FMT, ...)   target_lun_log(info, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_notice(LUN, FMT, ...) target_lun_log(notice, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_warn(LUN, FMT, ...)   target_lun_log(warn, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_err(LUN, FMT, ...)    target_lun_log(err, LUN, FMT, ##__VA_ARGS__)
+
+#define target_debug(FMT, ...)  target_log(debug, FMT, ##__VA_ARGS__)
+#define target_info(FMT, ...)   target_log(info, FMT, ##__VA_ARGS__)
+#define target_notice(FMT, ...) target_log(notice, FMT, ##__VA_ARGS__)
+#define target_warn(FMT, ...)   target_log(warn, FMT, ##__VA_ARGS__)
+#define target_err(FMT, ...)    target_log(err, FMT, ##__VA_ARGS__)
+
+#define target_sess_debug_ratelimited(SESS, FMT, ...) \
+	target_sess_log(debug_ratelimited, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_info_ratelimited(SESS, FMT, ...) \
+	target_sess_log(info_ratelimited, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_notice_ratelimited(SESS, FMT, ...) \
+	target_sess_log(notice_ratelimited, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_warn_ratelimited(SESS, FMT, ...) \
+	target_sess_log(warn_ratelimited, SESS, FMT, ##__VA_ARGS__)
+#define target_sess_err_ratelimited(SESS, FMT, ...) \
+	target_sess_log(err_ratelimited, SESS, FMT, ##__VA_ARGS__)
+
+#define target_cmd_debug_ratelimited(CMD, FMT, ...) \
+	target_cmd_log(debug_ratelimited, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_info_ratelimited(CMD, FMT, ...) \
+	target_cmd_log(info_ratelimited, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_notice_ratelimited(CMD, FMT, ...) \
+	target_cmd_log(notice_ratelimited, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_warn_ratelimited(CMD, FMT, ...) \
+	target_cmd_log(warn_ratelimited, CMD, FMT, ##__VA_ARGS__)
+#define target_cmd_err_ratelimited(CMD, FMT, ...) \
+	target_cmd_log(err_ratelimited, CMD, FMT, ##__VA_ARGS__)
+
+#define target_lun_debug_ratelimited(LUN, FMT, ...) \
+	target_lun_log(debug_ratelimited, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_info_ratelimited(LUN, FMT, ...) \
+	target_lun_log(info_ratelimited, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_notice_ratelimited(LUN, FMT, ...) \
+	target_lun_log(notice_ratelimited, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_warn_ratelimited(LUN, FMT, ...) \
+	target_lun_log(warn_ratelimited, LUN, FMT, ##__VA_ARGS__)
+#define target_lun_err_ratelimited(LUN, FMT, ...) \
+	target_lun_log(err_ratelimited, LUN, FMT, ##__VA_ARGS__)
+
+#define target_debug_ratelimited(FMT, ...) \
+	target_log(debug_ratelimited, FMT, ##__VA_ARGS__)
+#define target_info_ratelimited(FMT, ...) \
+	target_log(info_ratelimited, FMT, ##__VA_ARGS__)
+#define target_notice_ratelimited(FMT, ...) \
+	target_log(notice_ratelimited, FMT, ##__VA_ARGS__)
+#define target_warn_ratelimited(FMT, ...) \
+	target_log(warn_ratelimited, FMT, ##__VA_ARGS__)
+#define target_err_ratelimited(FMT, ...) \
+	target_log(err_ratelimited, FMT, ##__VA_ARGS__)
+
 /*
  * Maximum size of a CDB that can be stored in se_cmd without allocating
  * memory dynamically for the CDB.
Signature · 1 line
2.40.3
#2 lore raw

PATCH 2/10 target: Use new log wrappers

In reply to Anastasia Kovaleva

This patch was made with this zsh script:

........................................................................
dir="/path/to/kernel/src/drivers/target" printk_level=("DEBUG" "INFO" "NOTICE" "WARNING" "ERR") level=("debug" "info" "notice" "warn" "err")

for file in $dir/**/*.{c,h}; do

    for (( i=1; i<=${#level[@]}; i++ )); do
        sed -i "s/pr_${level[$i]}/target_${level[$i]}/g" $file
        sed -i "s/printk(KERN_${printk_level[$i]} /target_${level[$i]}(/g" $file
        sed -i "s/printk(\"/target_err(\"/g" $file
    done

done
........................................................................

And then all format strings arguments were aligned by parenthesis by git-clang-format util.

It may not be checked manually.

---
 drivers/target/iscsi/cxgbit/cxgbit_cm.c       | 191 ++---
 drivers/target/iscsi/cxgbit/cxgbit_ddp.c      |  17 +-
 drivers/target/iscsi/cxgbit/cxgbit_main.c     |  45 +-
 drivers/target/iscsi/cxgbit/cxgbit_target.c   | 131 ++--
 drivers/target/iscsi/iscsi_target.c           | 659 ++++++++--------
 drivers/target/iscsi/iscsi_target_auth.c      | 125 ++--
 drivers/target/iscsi/iscsi_target_configfs.c  | 107 ++-
 .../target/iscsi/iscsi_target_datain_values.c |  21 +-
 drivers/target/iscsi/iscsi_target_device.c    |   2 +-
 drivers/target/iscsi/iscsi_target_erl0.c      | 185 ++---
 drivers/target/iscsi/iscsi_target_erl1.c      | 196 ++---
 drivers/target/iscsi/iscsi_target_erl2.c      |  72 +-
 drivers/target/iscsi/iscsi_target_login.c     | 164 ++--
 drivers/target/iscsi/iscsi_target_nego.c      | 225 +++---
 .../target/iscsi/iscsi_target_nodeattrib.c    | 112 +--
 .../target/iscsi/iscsi_target_parameters.c    | 377 +++++-----
 .../target/iscsi/iscsi_target_seq_pdu_list.c  |  98 ++-
 drivers/target/iscsi/iscsi_target_tmr.c       | 150 ++--
 drivers/target/iscsi/iscsi_target_tpg.c       | 194 ++---
 drivers/target/iscsi/iscsi_target_transport.c |   4 +-
 drivers/target/iscsi/iscsi_target_util.c      | 147 ++--
 drivers/target/loopback/tcm_loop.c            | 112 ++-
 drivers/target/sbp/sbp_target.c               | 148 ++--
 drivers/target/target_core_alua.c             | 213 +++---
 drivers/target/target_core_configfs.c         | 612 ++++++++-------
 drivers/target/target_core_device.c           | 119 ++-
 drivers/target/target_core_fabric_configfs.c  |  68 +-
 drivers/target/target_core_fabric_lib.c       |  25 +-
 drivers/target/target_core_file.c             | 140 ++--
 drivers/target/target_core_hba.c              |  18 +-
 drivers/target/target_core_iblock.c           |  98 ++-
 drivers/target/target_core_pr.c               | 702 +++++++++---------
 drivers/target/target_core_pscsi.c            | 185 ++---
 drivers/target/target_core_rd.c               |  92 ++-
 drivers/target/target_core_sbc.c              | 162 ++--
 drivers/target/target_core_spc.c              |  31 +-
 drivers/target/target_core_tmr.c              |  55 +-
 drivers/target/target_core_tpg.c              |  90 ++-
 drivers/target/target_core_transport.c        | 233 +++---
 drivers/target/target_core_ua.c               |  30 +-
 drivers/target/target_core_user.c             | 243 +++---
 drivers/target/target_core_xcopy.c            | 242 +++---
 drivers/target/tcm_fc/tfc_cmd.c               |  48 +-
 drivers/target/tcm_fc/tfc_conf.c              |  14 +-
 drivers/target/tcm_fc/tfc_io.c                |  23 +-
 drivers/target/tcm_fc/tfc_sess.c              |   4 +-
 drivers/target/tcm_remote/tcm_remote.c        |  39 +-
 47 files changed, 3434 insertions(+), 3534 deletions(-)
drivers/target/iscsi/cxgbit/cxgbit_cm.c +80 -111
index d9204c590d9a..2575549cb579 100644
@@ -40,7 +40,7 @@ cxgbit_wake_up(struct cxgbit_wr_wait *wr_waitp, const char *func, u8 ret)
 		wr_waitp->ret = -EIO;
 
 	if (wr_waitp->ret)
-		pr_err("%s: err:%u", func, ret);
+		target_err("%s: err:%u", func, ret);
 
 	complete(&wr_waitp->completion);
 }
@@ -59,14 +59,14 @@ cxgbit_wait_for_reply(struct cxgbit_device *cdev,
 
 	ret = wait_for_completion_timeout(&wr_waitp->completion, timeout * HZ);
 	if (!ret) {
-		pr_info("%s - Device %s not responding tid %u\n",
-			func, pci_name(cdev->lldi.pdev), tid);
+		target_info("%s - Device %s not responding tid %u\n", func,
+			    pci_name(cdev->lldi.pdev), tid);
 		wr_waitp->ret = -ETIMEDOUT;
 	}
 out:
 	if (wr_waitp->ret)
-		pr_info("%s: FW reply %d tid %u\n",
-			pci_name(cdev->lldi.pdev), wr_waitp->ret, tid);
+		target_info("%s: FW reply %d tid %u\n", pci_name(cdev->lldi.pdev), wr_waitp->ret,
+			    tid);
 	return wr_waitp->ret;
 }
 
@@ -149,8 +149,8 @@ cxgbit_create_server6(struct cxgbit_device *cdev, unsigned int stid,
 	int addr_type;
 	int ret;
 
-	pr_debug("%s: dev = %s; stid = %u; sin6_port = %u\n",
-		 __func__, cdev->lldi.ports[0]->name, stid, sin6->sin6_port);
+	target_debug("%s: dev = %s; stid = %u; sin6_port = %u\n", __func__,
+		     cdev->lldi.ports[0]->name, stid, sin6->sin6_port);
 
 	addr_type = ipv6_addr_type((const struct in6_addr *)
 				   &sin6->sin6_addr);
@@ -158,8 +158,8 @@ cxgbit_create_server6(struct cxgbit_device *cdev, unsigned int stid,
 		ret = cxgb4_clip_get(cdev->lldi.ports[0],
 				     (const u32 *)&sin6->sin6_addr.s6_addr, 1);
 		if (ret) {
-			pr_err("Unable to find clip table entry. laddr %pI6. Error:%d.\n",
-			       sin6->sin6_addr.s6_addr, ret);
+			target_err("Unable to find clip table entry. laddr %pI6. Error:%d.\n",
+				   sin6->sin6_addr.s6_addr, ret);
 			return -ENOMEM;
 		}
 	}
@@ -184,9 +184,8 @@ cxgbit_create_server6(struct cxgbit_device *cdev, unsigned int stid,
 			cxgb4_clip_release(cdev->lldi.ports[0],
 				   (const u32 *)&sin6->sin6_addr.s6_addr, 1);
 
-		pr_err("create server6 err %d stid %d laddr %pI6 lport %d\n",
-		       ret, stid, sin6->sin6_addr.s6_addr,
-		       ntohs(sin6->sin6_port));
+		target_err("create server6 err %d stid %d laddr %pI6 lport %d\n", ret, stid,
+			   sin6->sin6_addr.s6_addr, ntohs(sin6->sin6_port));
 	}
 
 	return ret;
@@ -200,8 +199,8 @@ cxgbit_create_server4(struct cxgbit_device *cdev, unsigned int stid,
 				   &cnp->com.local_addr;
 	int ret;
 
-	pr_debug("%s: dev = %s; stid = %u; sin_port = %u\n",
-		 __func__, cdev->lldi.ports[0]->name, stid, sin->sin_port);
+	target_debug("%s: dev = %s; stid = %u; sin_port = %u\n", __func__,
+		     cdev->lldi.ports[0]->name, stid, sin->sin_port);
 
 	cxgbit_get_cnp(cnp);
 	cxgbit_init_wr_wait(&cnp->com.wr_wait);
@@ -220,8 +219,8 @@ cxgbit_create_server4(struct cxgbit_device *cdev, unsigned int stid,
 		cxgbit_put_cnp(cnp);
 
 	if (ret)
-		pr_err("create server failed err %d stid %d laddr %pI4 lport %d\n",
-		       ret, stid, &sin->sin_addr, ntohs(sin->sin_port));
+		target_err("create server failed err %d stid %d laddr %pI4 lport %d\n", ret, stid,
+			   &sin->sin_addr, ntohs(sin->sin_port));
 	return ret;
 }
 
@@ -248,8 +247,7 @@ struct cxgbit_device *cxgbit_find_device(struct net_device *ndev, u8 *port_id)
 static struct net_device *cxgbit_get_real_dev(struct net_device *ndev)
 {
 	if (ndev->priv_flags & IFF_BONDING) {
-		pr_err("Bond devices are not supported. Interface:%s\n",
-		       ndev->name);
+		target_err("Bond devices are not supported. Interface:%s\n", ndev->name);
 		return NULL;
 	}
 
@@ -640,7 +638,7 @@ static void cxgbit_arp_failure_discard(void *handle, struct sk_buff *skb)
 {
 	struct cxgbit_sock *csk = handle;
 
-	pr_debug("%s cxgbit_device %p\n", __func__, handle);
+	target_debug("%s cxgbit_device %p\n", __func__, handle);
 	kfree_skb(skb);
 	cxgbit_put_csk(csk);
 }
@@ -650,7 +648,7 @@ static void cxgbit_abort_arp_failure(void *handle, struct sk_buff *skb)
 	struct cxgbit_device *cdev = handle;
 	struct cpl_abort_req *req = cplhdr(skb);
 
-	pr_debug("%s cdev %p\n", __func__, cdev);
+	target_debug("%s cdev %p\n", __func__, cdev);
 	req->cmd = CPL_ABORT_NO_RST;
 	cxgbit_ofld_send(cdev, skb);
 }
@@ -660,8 +658,7 @@ static int cxgbit_send_abort_req(struct cxgbit_sock *csk)
 	struct sk_buff *skb;
 	u32 len = roundup(sizeof(struct cpl_abort_req), 16);
 
-	pr_debug("%s: csk %p tid %u; state %d\n",
-		 __func__, csk, csk->tid, csk->com.state);
+	target_debug("%s: csk %p tid %u; state %d\n", __func__, csk, csk->tid, csk->com.state);
 
 	__skb_queue_purge(&csk->txq);
 
@@ -720,8 +717,7 @@ static void __cxgbit_free_conn(struct cxgbit_sock *csk)
 	struct iscsit_conn *conn = csk->conn;
 	bool release = false;
 
-	pr_debug("%s: state %d\n",
-		 __func__, csk->com.state);
+	target_debug("%s: state %d\n", __func__, csk->com.state);
 
 	spin_lock_bh(&csk->lock);
 	switch (csk->com.state) {
@@ -742,8 +738,7 @@ static void __cxgbit_free_conn(struct cxgbit_sock *csk)
 		release = true;
 		break;
 	default:
-		pr_err("%s: csk %p; state %d\n",
-		       __func__, csk, csk->com.state);
+		target_err("%s: csk %p; state %d\n", __func__, csk, csk->com.state);
 	}
 	spin_unlock_bh(&csk->lock);
 
@@ -768,10 +763,10 @@ static void cxgbit_set_emss(struct cxgbit_sock *csk, u16 opt)
 	if (csk->emss < 128)
 		csk->emss = 128;
 	if (csk->emss & 7)
-		pr_info("Warning: misaligned mtu idx %u mss %u emss=%u\n",
-			TCPOPT_MSS_G(opt), csk->mss, csk->emss);
-	pr_debug("%s mss_idx %u mss %u emss=%u\n", __func__, TCPOPT_MSS_G(opt),
-		 csk->mss, csk->emss);
+		target_info("Warning: misaligned mtu idx %u mss %u emss=%u\n", TCPOPT_MSS_G(opt),
+			    csk->mss, csk->emss);
+	target_debug("%s mss_idx %u mss %u emss=%u\n", __func__, TCPOPT_MSS_G(opt), csk->mss,
+		     csk->emss);
 }
 
 static void cxgbit_free_skb(struct cxgbit_sock *csk)
@@ -797,7 +792,7 @@ void _cxgbit_free_csk(struct kref *kref)
 
 	csk = container_of(kref, struct cxgbit_sock, kref);
 
-	pr_debug("%s csk %p state %d\n", __func__, csk, csk->com.state);
+	target_debug("%s csk %p state %d\n", __func__, csk, csk->com.state);
 
 	if (csk->com.local_addr.ss_family == AF_INET6) {
 		struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)
@@ -844,8 +839,7 @@ static void cxgbit_set_tcp_window(struct cxgbit_sock *csk, struct port_info *pi)
 		csk->snd_win *= scale;
 	csk->snd_win = min(csk->snd_win, 512U * 1024);
 
-	pr_debug("%s snd_win %d rcv_win %d\n",
-		 __func__, csk->snd_win, csk->rcv_win);
+	target_debug("%s snd_win %d rcv_win %d\n", __func__, csk->snd_win, csk->rcv_win);
 }
 
 #ifdef CONFIG_CHELSIO_T4_DCB
@@ -889,7 +883,7 @@ static u8 cxgbit_get_iscsi_dcb_priority(struct net_device *ndev, u16 local_port)
 		ret = dcb_getapp(ndev, &iscsi_dcb_app);
 	}
 
-	pr_info("iSCSI priority is set to %u\n", cxgbit_select_priority(ret));
+	target_info("iSCSI priority is set to %u\n", cxgbit_select_priority(ret));
 
 	return cxgbit_select_priority(ret);
 }
@@ -1001,7 +995,7 @@ int cxgbit_ofld_send(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	if (!test_bit(CDEV_STATE_UP, &cdev->flags)) {
 		kfree_skb(skb);
-		pr_err("%s - device not up - dropping\n", __func__);
+		target_err("%s - device not up - dropping\n", __func__);
 		return -EIO;
 	}
 
@@ -1032,7 +1026,7 @@ cxgbit_l2t_send(struct cxgbit_device *cdev, struct sk_buff *skb,
 
 	if (!test_bit(CDEV_STATE_UP, &cdev->flags)) {
 		kfree_skb(skb);
-		pr_err("%s - device not up - dropping\n", __func__);
+		target_err("%s - device not up - dropping\n", __func__);
 		return -EIO;
 	}
 
@@ -1140,7 +1134,7 @@ cxgbit_pass_accept_rpl(struct cxgbit_sock *csk, struct cpl_pass_accept_req *req)
 	u32 wscale;
 	u32 win;
 
-	pr_debug("%s csk %p tid %u\n", __func__, csk, csk->tid);
+	target_debug("%s csk %p tid %u\n", __func__, csk, csk->tid);
 
 	skb = alloc_skb(len, GFP_ATOMIC);
 	if (!skb) {
@@ -1231,26 +1225,22 @@ cxgbit_pass_accept_req(struct cxgbit_device *cdev, struct sk_buff *skb)
 	int ret;
 	int iptype;
 
-	pr_debug("%s: cdev = %p; stid = %u; tid = %u\n",
-		 __func__, cdev, stid, tid);
+	target_debug("%s: cdev = %p; stid = %u; tid = %u\n", __func__, cdev, stid, tid);
 
 	cnp = lookup_stid(t, stid);
 	if (!cnp) {
-		pr_err("%s connect request on invalid stid %d\n",
-		       __func__, stid);
+		target_err("%s connect request on invalid stid %d\n", __func__, stid);
 		goto rel_skb;
 	}
 
 	if (cnp->com.state != CSK_STATE_LISTEN) {
-		pr_err("%s - listening parent not in CSK_STATE_LISTEN\n",
-		       __func__);
+		target_err("%s - listening parent not in CSK_STATE_LISTEN\n", __func__);
 		goto reject;
 	}
 
 	csk = lookup_tid(t, tid);
 	if (csk) {
-		pr_err("%s csk not null tid %u\n",
-		       __func__, tid);
+		target_err("%s csk not null tid %u\n", __func__, tid);
 		goto rel_skb;
 	}
 
@@ -1259,22 +1249,20 @@ cxgbit_pass_accept_req(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	/* Find output route */
 	if (iptype == 4)  {
-		pr_debug("%s parent sock %p tid %u laddr %pI4 raddr %pI4 "
-			 "lport %d rport %d peer_mss %d\n"
-			 , __func__, cnp, tid,
-			 local_ip, peer_ip, ntohs(local_port),
-			 ntohs(peer_port), peer_mss);
+		target_debug("%s parent sock %p tid %u laddr %pI4 raddr %pI4 "
+			     "lport %d rport %d peer_mss %d\n",
+			     __func__, cnp, tid, local_ip, peer_ip, ntohs(local_port),
+			     ntohs(peer_port), peer_mss);
 		dst = cxgb_find_route(&cdev->lldi, cxgbit_get_real_dev,
 				      *(__be32 *)local_ip,
 				      *(__be32 *)peer_ip,
 				      local_port, peer_port,
 				      PASS_OPEN_TOS_G(ntohl(req->tos_stid)));
 	} else {
-		pr_debug("%s parent sock %p tid %u laddr %pI6 raddr %pI6 "
-			 "lport %d rport %d peer_mss %d\n"
-			 , __func__, cnp, tid,
-			 local_ip, peer_ip, ntohs(local_port),
-			 ntohs(peer_port), peer_mss);
+		target_debug("%s parent sock %p tid %u laddr %pI6 raddr %pI6 "
+			     "lport %d rport %d peer_mss %d\n",
+			     __func__, cnp, tid, local_ip, peer_ip, ntohs(local_port),
+			     ntohs(peer_port), peer_mss);
 		dst = cxgb_find_route6(&cdev->lldi, cxgbit_get_real_dev,
 				       local_ip, peer_ip,
 				       local_port, peer_port,
@@ -1283,8 +1271,7 @@ cxgbit_pass_accept_req(struct cxgbit_device *cdev, struct sk_buff *skb)
 					&cnp->com.local_addr)->sin6_scope_id);
 	}
 	if (!dst) {
-		pr_err("%s - failed to find dst entry!\n",
-		       __func__);
+		target_err("%s - failed to find dst entry!\n", __func__);
 		goto reject;
 	}
 
@@ -1297,8 +1284,7 @@ cxgbit_pass_accept_req(struct cxgbit_device *cdev, struct sk_buff *skb)
 	ret = cxgbit_offload_init(csk, iptype, peer_ip, ntohs(local_port),
 				  dst, cdev);
 	if (ret) {
-		pr_err("%s - failed to allocate l2t entry!\n",
-		       __func__);
+		target_err("%s - failed to allocate l2t entry!\n", __func__);
 		dst_release(dst);
 		kfree(csk);
 		goto reject;
@@ -1469,17 +1455,17 @@ u32 cxgbit_send_tx_flowc_wr(struct cxgbit_sock *csk)
 #ifdef CONFIG_CHELSIO_T4_DCB
 	flowc->mnemval[index].mnemonic = FW_FLOWC_MNEM_DCBPRIO;
 	if (vlan == VLAN_NONE) {
-		pr_warn("csk %u without VLAN Tag on DCB Link\n", csk->tid);
+		target_warn("csk %u without VLAN Tag on DCB Link\n", csk->tid);
 		flowc->mnemval[index].val = cpu_to_be32(0);
 	} else
 		flowc->mnemval[index].val = cpu_to_be32(
 				(vlan & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT);
 #endif
 
-	pr_debug("%s: csk %p; tx_chan = %u; rss_qid = %u; snd_seq = %u;"
-		 " rcv_seq = %u; snd_win = %u; emss = %u\n",
-		 __func__, csk, csk->tx_chan, csk->rss_qid, csk->snd_nxt,
-		 csk->rcv_nxt, csk->snd_win, csk->emss);
+	target_debug("%s: csk %p; tx_chan = %u; rss_qid = %u; snd_seq = %u;"
+		     " rcv_seq = %u; snd_win = %u; emss = %u\n",
+		     __func__, csk, csk->tx_chan, csk->rss_qid, csk->snd_nxt, csk->rcv_nxt,
+		     csk->snd_win, csk->emss);
 	set_wr_txq(skb, CPL_PRIORITY_DATA, csk->txq_idx);
 	cxgbit_ofld_send(csk->com.cdev, skb);
 	return flowclen16;
@@ -1491,8 +1477,8 @@ cxgbit_send_tcb_skb(struct cxgbit_sock *csk, struct sk_buff *skb)
 	spin_lock_bh(&csk->lock);
 	if (unlikely(csk->com.state != CSK_STATE_ESTABLISHED)) {
 		spin_unlock_bh(&csk->lock);
-		pr_err("%s: csk 0x%p, tid %u, state %u\n",
-		       __func__, csk, csk->tid, csk->com.state);
+		target_err("%s: csk 0x%p, tid %u, state %u\n", __func__, csk, csk->tid,
+			   csk->com.state);
 		__kfree_skb(skb);
 		return -1;
 	}
@@ -1583,11 +1569,10 @@ cxgbit_pass_open_rpl(struct cxgbit_device *cdev, struct sk_buff *skb)
 	unsigned int stid = GET_TID(rpl);
 	struct cxgbit_np *cnp = lookup_stid(t, stid);
 
-	pr_debug("%s: cnp = %p; stid = %u; status = %d\n",
-		 __func__, cnp, stid, rpl->status);
+	target_debug("%s: cnp = %p; stid = %u; status = %d\n", __func__, cnp, stid, rpl->status);
 
 	if (!cnp) {
-		pr_info("%s stid %d lookup failure\n", __func__, stid);
+		target_info("%s stid %d lookup failure\n", __func__, stid);
 		goto rel_skb;
 	}
 
@@ -1605,11 +1590,10 @@ cxgbit_close_listsrv_rpl(struct cxgbit_device *cdev, struct sk_buff *skb)
 	unsigned int stid = GET_TID(rpl);
 	struct cxgbit_np *cnp = lookup_stid(t, stid);
 
-	pr_debug("%s: cnp = %p; stid = %u; status = %d\n",
-		 __func__, cnp, stid, rpl->status);
+	target_debug("%s: cnp = %p; stid = %u; status = %d\n", __func__, cnp, stid, rpl->status);
 
 	if (!cnp) {
-		pr_info("%s stid %d lookup failure\n", __func__, stid);
+		target_info("%s stid %d lookup failure\n", __func__, stid);
 		goto rel_skb;
 	}
 
@@ -1633,13 +1617,12 @@ cxgbit_pass_establish(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	csk = lookup_tid(t, tid);
 	if (unlikely(!csk)) {
-		pr_err("can't find connection for tid %u.\n", tid);
+		target_err("can't find connection for tid %u.\n", tid);
 		goto rel_skb;
 	}
 	cnp = csk->cnp;
 
-	pr_debug("%s: csk %p; tid %u; cnp %p\n",
-		 __func__, csk, tid, cnp);
+	target_debug("%s: csk %p; tid %u; cnp %p\n", __func__, csk, tid, cnp);
 
 	csk->write_seq = snd_isn;
 	csk->snd_una = snd_isn;
@@ -1670,8 +1653,7 @@ static void cxgbit_queue_rx_skb(struct cxgbit_sock *csk, struct sk_buff *skb)
 
 static void cxgbit_peer_close(struct cxgbit_sock *csk, struct sk_buff *skb)
 {
-	pr_debug("%s: csk %p; tid %u; state %d\n",
-		 __func__, csk, csk->tid, csk->com.state);
+	target_debug("%s: csk %p; tid %u; state %d\n", __func__, csk, csk->tid, csk->com.state);
 
 	switch (csk->com.state) {
 	case CSK_STATE_ESTABLISHED:
@@ -1689,8 +1671,7 @@ static void cxgbit_peer_close(struct cxgbit_sock *csk, struct sk_buff *skb)
 	case CSK_STATE_ABORTING:
 		break;
 	default:
-		pr_info("%s: cpl_peer_close in bad state %d\n",
-			__func__, csk->com.state);
+		target_info("%s: cpl_peer_close in bad state %d\n", __func__, csk->com.state);
 	}
 
 	__kfree_skb(skb);
@@ -1698,8 +1679,7 @@ static void cxgbit_peer_close(struct cxgbit_sock *csk, struct sk_buff *skb)
 
 static void cxgbit_close_con_rpl(struct cxgbit_sock *csk, struct sk_buff *skb)
 {
-	pr_debug("%s: csk %p; tid %u; state %d\n",
-		 __func__, csk, csk->tid, csk->com.state);
+	target_debug("%s: csk %p; tid %u; state %d\n", __func__, csk, csk->tid, csk->com.state);
 
 	switch (csk->com.state) {
 	case CSK_STATE_CLOSING:
@@ -1713,8 +1693,7 @@ static void cxgbit_close_con_rpl(struct cxgbit_sock *csk, struct sk_buff *skb)
 	case CSK_STATE_DEAD:
 		break;
 	default:
-		pr_info("%s: cpl_close_con_rpl in bad state %d\n",
-			__func__, csk->com.state);
+		target_info("%s: cpl_close_con_rpl in bad state %d\n", __func__, csk->com.state);
 	}
 
 	__kfree_skb(skb);
@@ -1729,12 +1708,10 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb)
 	bool wakeup_thread = false;
 	u32 len = roundup(sizeof(struct cpl_abort_rpl), 16);
 
-	pr_debug("%s: csk %p; tid %u; state %d\n",
-		 __func__, csk, tid, csk->com.state);
+	target_debug("%s: csk %p; tid %u; state %d\n", __func__, csk, tid, csk->com.state);
 
 	if (cxgb_is_neg_adv(hdr->status)) {
-		pr_err("%s: got neg advise %d on tid %u\n",
-		       __func__, hdr->status, tid);
+		target_err("%s: got neg advise %d on tid %u\n", __func__, hdr->status, tid);
 		goto rel_skb;
 	}
 
@@ -1756,8 +1733,7 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb)
 	case CSK_STATE_ABORTING:
 		break;
 	default:
-		pr_info("%s: cpl_abort_req_rss in bad state %d\n",
-			__func__, csk->com.state);
+		target_info("%s: cpl_abort_req_rss in bad state %d\n", __func__, csk->com.state);
 		csk->com.state = CSK_STATE_DEAD;
 	}
 
@@ -1786,8 +1762,7 @@ static void cxgbit_abort_rpl_rss(struct cxgbit_sock *csk, struct sk_buff *skb)
 {
 	struct cpl_abort_rpl_rss *rpl = cplhdr(skb);
 
-	pr_debug("%s: csk %p; tid %u; state %d\n",
-		 __func__, csk, csk->tid, csk->com.state);
+	target_debug("%s: csk %p; tid %u; state %d\n", __func__, csk, csk->tid, csk->com.state);
 
 	switch (csk->com.state) {
 	case CSK_STATE_ABORTING:
@@ -1798,8 +1773,7 @@ static void cxgbit_abort_rpl_rss(struct cxgbit_sock *csk, struct sk_buff *skb)
 		cxgbit_put_csk(csk);
 		break;
 	default:
-		pr_info("%s: cpl_abort_rpl_rss in state %d\n",
-			__func__, csk->com.state);
+		target_info("%s: cpl_abort_rpl_rss in state %d\n", __func__, csk->com.state);
 	}
 
 	__kfree_skb(skb);
@@ -1811,8 +1785,8 @@ static bool cxgbit_credit_err(const struct cxgbit_sock *csk)
 	u32 credit = 0;
 
 	if (unlikely(csk->wr_cred > csk->wr_max_cred)) {
-		pr_err("csk 0x%p, tid %u, credit %u > %u\n",
-		       csk, csk->tid, csk->wr_cred, csk->wr_max_cred);
+		target_err("csk 0x%p, tid %u, credit %u > %u\n", csk, csk->tid, csk->wr_cred,
+			   csk->wr_max_cred);
 		return true;
 	}
 
@@ -1822,9 +1796,8 @@ static bool cxgbit_credit_err(const struct cxgbit_sock *csk)
 	}
 
 	if (unlikely((csk->wr_cred + credit) != csk->wr_max_cred)) {
-		pr_err("csk 0x%p, tid %u, credit %u + %u != %u.\n",
-		       csk, csk->tid, csk->wr_cred,
-		       credit, csk->wr_max_cred);
+		target_err("csk 0x%p, tid %u, credit %u + %u != %u.\n", csk, csk->tid, csk->wr_cred,
+			   credit, csk->wr_max_cred);
 
 		return true;
 	}
@@ -1847,18 +1820,15 @@ static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb)
 		u32 csum;
 
 		if (unlikely(!p)) {
-			pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n",
-			       csk, csk->tid, credits,
-			       csk->wr_cred, csk->wr_una_cred);
+			target_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n", csk, csk->tid, credits,
+				   csk->wr_cred, csk->wr_una_cred);
 			break;
 		}
 
 		csum = (__force u32)p->csum;
 		if (unlikely(credits < csum)) {
-			pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n",
-				csk,  csk->tid,
-				credits, csk->wr_cred, csk->wr_una_cred,
-				csum);
+			target_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n", csk, csk->tid, credits,
+				    csk->wr_cred, csk->wr_una_cred, csum);
 			p->csum = (__force __wsum)(csum - credits);
 			break;
 		}
@@ -1875,9 +1845,8 @@ static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb)
 
 	if (rpl->seq_vld & CPL_FW4_ACK_FLAGS_SEQVAL) {
 		if (unlikely(before(snd_una, csk->snd_una))) {
-			pr_warn("csk 0x%p,%u, snd_una %u/%u.",
-				csk, csk->tid, snd_una,
-				csk->snd_una);
+			target_warn("csk 0x%p,%u, snd_una %u/%u.", csk, csk->tid, snd_una,
+				    csk->snd_una);
 			goto rel_skb;
 		}
 
@@ -1904,7 +1873,7 @@ static void cxgbit_set_tcb_rpl(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	csk = lookup_tid(t, tid);
 	if (unlikely(!csk)) {
-		pr_err("can't find connection for tid %u.\n", tid);
+		target_err("can't find connection for tid %u.\n", tid);
 		goto rel_skb;
 	} else {
 		cxgbit_wake_up(&csk->com.wr_wait, __func__, rpl->status);
@@ -1925,7 +1894,7 @@ static void cxgbit_rx_data(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	csk = lookup_tid(t, tid);
 	if (unlikely(!csk)) {
-		pr_err("can't find conn. for tid %u.\n", tid);
+		target_err("can't find conn. for tid %u.\n", tid);
 		goto rel_skb;
 	}
 
@@ -1989,7 +1958,7 @@ static void cxgbit_rx_cpl(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	csk = lookup_tid(t, tid);
 	if (unlikely(!csk)) {
-		pr_err("can't find conn. for tid %u.\n", tid);
+		target_err("can't find conn. for tid %u.\n", tid);
 		goto rel_skb;
 	}
 
drivers/target/iscsi/cxgbit/cxgbit_ddp.c +8 -9
index 17fd0d8cc490..3fd56f1484d8 100644
@@ -179,9 +179,8 @@ cxgbit_ddp_reserve(struct cxgbit_sock *csk, struct cxgbi_task_tag_info *ttinfo,
 	int ret;
 
 	if ((xferlen < DDP_THRESHOLD) || (!sgcnt)) {
-		pr_debug("ppm 0x%p, pgidx %u, xfer %u, sgcnt %u, NO ddp.\n",
-			 ppm, ppm->tformat.pgsz_idx_dflt,
-			 xferlen, ttinfo->nents);
+		target_debug("ppm 0x%p, pgidx %u, xfer %u, sgcnt %u, NO ddp.\n", ppm,
+			     ppm->tformat.pgsz_idx_dflt, xferlen, ttinfo->nents);
 		return -EINVAL;
 	}
 
@@ -204,8 +203,8 @@ cxgbit_ddp_reserve(struct cxgbit_sock *csk, struct cxgbi_task_tag_info *ttinfo,
 	ret = dma_map_sg(&ppm->pdev->dev, sgl, sgcnt, DMA_FROM_DEVICE);
 	sgl->offset = sg_offset;
 	if (!ret) {
-		pr_debug("%s: 0x%x, xfer %u, sgl %u dma mapping err.\n",
-			 __func__, 0, xferlen, sgcnt);
+		target_debug("%s: 0x%x, xfer %u, sgl %u dma mapping err.\n", __func__, 0, xferlen,
+			     sgcnt);
 		goto rel_ppods;
 	}
 
@@ -247,8 +246,8 @@ cxgbit_get_r2t_ttt(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
 
 	ret = cxgbit_ddp_reserve(csk, ttinfo, cmd->se_cmd.data_length);
 	if (ret < 0) {
-		pr_debug("csk 0x%p, cmd 0x%p, xfer len %u, sgcnt %u no ddp.\n",
-			 csk, cmd, cmd->se_cmd.data_length, ttinfo->nents);
+		target_debug("csk 0x%p, cmd 0x%p, xfer len %u, sgcnt %u no ddp.\n", csk, cmd,
+			     cmd->se_cmd.data_length, ttinfo->nents);
 
 		ttinfo->sgl = NULL;
 		ttinfo->nents = 0;
@@ -256,7 +255,7 @@ cxgbit_get_r2t_ttt(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
 		ccmd->release = true;
 	}
 out:
-	pr_debug("cdev 0x%p, cmd 0x%p, tag 0x%x\n", cdev, cmd, ttinfo->tag);
+	target_debug("cdev 0x%p, cmd 0x%p, tag 0x%x\n", cdev, cmd, ttinfo->tag);
 	r2t->targ_xfer_tag = ttinfo->tag;
 }
 
@@ -301,7 +300,7 @@ int cxgbit_ddp_init(struct cxgbit_device *cdev)
 	int ret, i;
 
 	if (!lldi->vr->iscsi.size) {
-		pr_warn("%s, iscsi NOT enabled, check config!\n", ndev->name);
+		target_warn("%s, iscsi NOT enabled, check config!\n", ndev->name);
 		return -EACCES;
 	}
 
drivers/target/iscsi/cxgbit/cxgbit_main.c +19 -26

127 lines not on this page · raw message

drivers/target/iscsi/cxgbit/cxgbit_target.c +64 -67

284 lines not on this page · raw message

drivers/target/iscsi/iscsi_target.c +336 -323

1,391 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_auth.c +62 -63

396 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_configfs.c +53 -54

257 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_datain_values.c +9 -12
index 2d44781be3c6..84ba97e935e1 100644

Lines of this file are not shown. View the raw message.

drivers/target/iscsi/iscsi_target_device.c +1 -1
index b565ce3b2677..466f27c93ca3 100644

Lines of this file are not shown. View the raw message.

drivers/target/iscsi/iscsi_target_erl0.c +96 -89

185 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_erl1.c +100 -96

196 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_erl2.c +38 -34

72 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_login.c +82 -82

164 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_nego.c +114 -111

225 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_nodeattrib.c +58 -54

112 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_parameters.c +169 -208

377 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_seq_pdu_list.c +48 -50

98 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_tmr.c +77 -73

150 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_tpg.c +99 -95

194 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_transport.c +2 -2
index 27c85f260459..0658388e9518 100644

Lines of this file are not shown. View the raw message.

drivers/target/iscsi/iscsi_target_util.c +73 -74

147 lines not on this page · raw message

drivers/target/loopback/tcm_loop.c +53 -59

112 lines not on this page · raw message

drivers/target/sbp/sbp_target.c +68 -80

148 lines not on this page · raw message

drivers/target/target_core_alua.c +105 -108

213 lines not on this page · raw message

drivers/target/target_core_configfs.c +305 -307

612 lines not on this page · raw message

drivers/target/target_core_device.c +56 -63

119 lines not on this page · raw message

drivers/target/target_core_fabric_configfs.c +34 -34

68 lines not on this page · raw message

drivers/target/target_core_fabric_lib.c +13 -12
index 6600ae44f29d..9e619e0028ce 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_file.c +69 -71

140 lines not on this page · raw message

drivers/target/target_core_hba.c +10 -8
index d508b343ba7b..02501fd45b24 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_iblock.c +48 -50

98 lines not on this page · raw message

drivers/target/target_core_pr.c +353 -349

702 lines not on this page · raw message

drivers/target/target_core_pscsi.c +95 -90

185 lines not on this page · raw message

drivers/target/target_core_rd.c +45 -47

92 lines not on this page · raw message

drivers/target/target_core_sbc.c +83 -79

162 lines not on this page · raw message

drivers/target/target_core_spc.c +15 -16
index 50290abc07bc..7c5c117389cc 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_tmr.c +26 -29

55 lines not on this page · raw message

drivers/target/target_core_tpg.c +44 -46

90 lines not on this page · raw message

drivers/target/target_core_transport.c +115 -118

233 lines not on this page · raw message

drivers/target/target_core_ua.c +15 -15
index 4276690fb6cb..825039a5be08 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_user.c +111 -132

243 lines not on this page · raw message

drivers/target/target_core_xcopy.c +126 -116

242 lines not on this page · raw message

drivers/target/tcm_fc/tfc_cmd.c +22 -26

48 lines not on this page · raw message

drivers/target/tcm_fc/tfc_conf.c +6 -8
index 5ee03d1cba2b..df2414b8c0cd 100644

Lines of this file are not shown. View the raw message.

drivers/target/tcm_fc/tfc_io.c +11 -12
index bbe2e29612fa..cc772793149e 100644

Lines of this file are not shown. View the raw message.

drivers/target/tcm_fc/tfc_sess.c +1 -3
index 593540da9346..e69b6211886e 100644

Lines of this file are not shown. View the raw message.

drivers/target/tcm_remote/tcm_remote.c +17 -22
index cb8db2558056..fe88c27f1b58 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.40.3

Part of the diff is not shown here. View the raw message.

#3 lore raw

PATCH 3/10 target: Fix quoted strings splitting

In reply to Anastasia Kovaleva

Fix splitted strings and some other obvious style problems related to quoted strings. This patch was made automatically with this command:

./scripts/checkpatch.pl --test-only=quoted --fix-inplace -f ./drivers/target/**/*.{c,h}

and then carefully checked manually.

Note: The checkpatch script should be run several times due to its algorithm. It will fix splitting only once even if the string was split on 3 or more lines.

Note: Some functions were manually changed. In some logs there were typos, in others the script made mistakes. Functions, where logs were changed manually:

iscsit_build_sendtargets_response
lio_target_nacl_info_show
core_alua_show_tg_pt_gp_info
item_to_hba
target_pr_res_pr_all_tgt_pts_show
target_pr_res_pr_holder_tg_port_show
target_tg_pt_gp_members_show
core_scsi3_update_aptpl_buf
pscsi_show_configfs_dev_params
rd_show_configfs_dev_params
transport_dump_vpd_proto_id
transport_dump_vpd_ident
MODULE_PARM_DESC global_max_data_area_mb
ft_del_wwn
target_set_nacl_queue_depth

Then all format strings arguments were aligned by parenthesis by git-clang-format util.

It may not be checked manually.

---
 drivers/target/iscsi/cxgbit/cxgbit_cm.c       |   6 +-
 drivers/target/iscsi/cxgbit/cxgbit_target.c   |  48 +--
 drivers/target/iscsi/iscsi_target.c           | 312 ++++++------------
 drivers/target/iscsi/iscsi_target_auth.c      |  12 +-
 drivers/target/iscsi/iscsi_target_configfs.c  |  43 +--
 .../target/iscsi/iscsi_target_datain_values.c |   7 +-
 drivers/target/iscsi/iscsi_target_erl0.c      |  95 ++----
 drivers/target/iscsi/iscsi_target_erl1.c      |  96 ++----
 drivers/target/iscsi/iscsi_target_erl2.c      |  38 +--
 drivers/target/iscsi/iscsi_target_login.c     |  54 +--
 drivers/target/iscsi/iscsi_target_nego.c      | 103 ++----
 .../target/iscsi/iscsi_target_nodeattrib.c    |  72 ++--
 .../target/iscsi/iscsi_target_parameters.c    |  97 ++----
 .../target/iscsi/iscsi_target_seq_pdu_list.c  |  40 +--
 drivers/target/iscsi/iscsi_target_tmr.c       |  79 ++---
 drivers/target/iscsi/iscsi_target_tpg.c       |  87 ++---
 drivers/target/iscsi/iscsi_target_util.c      |  57 ++--
 drivers/target/target_core_alua.c             |  77 ++---
 drivers/target/target_core_configfs.c         | 230 +++++--------
 drivers/target/target_core_device.c           |  38 +--
 drivers/target/target_core_fabric_configfs.c  |  16 +-
 drivers/target/target_core_fabric_lib.c       |   6 +-
 drivers/target/target_core_file.c             |  49 +--
 drivers/target/target_core_hba.c              |   8 +-
 drivers/target/target_core_iblock.c           |  15 +-
 drivers/target/target_core_pr.c               | 305 ++++++-----------
 drivers/target/target_core_pscsi.c            |  84 ++---
 drivers/target/target_core_rd.c               |  30 +-
 drivers/target/target_core_sbc.c              |  61 ++--
 drivers/target/target_core_spc.c              |   9 +-
 drivers/target/target_core_tmr.c              |   9 +-
 drivers/target/target_core_tpg.c              |  28 +-
 drivers/target/target_core_transport.c        |  67 ++--
 drivers/target/target_core_ua.c               |  11 +-
 drivers/target/target_core_xcopy.c            |  65 ++--
 drivers/target/tcm_fc/tfc_cmd.c               |  11 +-
 drivers/target/tcm_fc/tfc_io.c                |  11 +-
 37 files changed, 760 insertions(+), 1616 deletions(-)
drivers/target/iscsi/cxgbit/cxgbit_cm.c +2 -4
index 2575549cb579..036e275de088 100644
@@ -1249,8 +1249,7 @@ cxgbit_pass_accept_req(struct cxgbit_device *cdev, struct sk_buff *skb)
 
 	/* Find output route */
 	if (iptype == 4)  {
-		target_debug("%s parent sock %p tid %u laddr %pI4 raddr %pI4 "
-			     "lport %d rport %d peer_mss %d\n",
+		target_debug("%s parent sock %p tid %u laddr %pI4 raddr %pI4 lport %d rport %d peer_mss %d\n",
 			     __func__, cnp, tid, local_ip, peer_ip, ntohs(local_port),
 			     ntohs(peer_port), peer_mss);
 		dst = cxgb_find_route(&cdev->lldi, cxgbit_get_real_dev,
@@ -1259,8 +1258,7 @@ cxgbit_pass_accept_req(struct cxgbit_device *cdev, struct sk_buff *skb)
 				      local_port, peer_port,
 				      PASS_OPEN_TOS_G(ntohl(req->tos_stid)));
 	} else {
-		target_debug("%s parent sock %p tid %u laddr %pI6 raddr %pI6 "
-			     "lport %d rport %d peer_mss %d\n",
+		target_debug("%s parent sock %p tid %u laddr %pI6 raddr %pI6 lport %d rport %d peer_mss %d\n",
 			     __func__, cnp, tid, local_ip, peer_ip, ntohs(local_port),
 			     ntohs(peer_port), peer_mss);
 		dst = cxgb_find_route6(&cdev->lldi, cxgbit_get_real_dev,
drivers/target/iscsi/cxgbit/cxgbit_target.c +15 -33

119 lines not on this page · raw message

drivers/target/iscsi/iscsi_target.c +97 -215

823 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_auth.c +4 -8
index 694b2ec612cd..8308a1947605 100644
@@ -146,8 +146,7 @@ static struct iscsi_chap *chap_server_open(
 
 	if (!(auth->naf_flags & NAF_USERID_SET) ||
 	    !(auth->naf_flags & NAF_PASSWORD_SET)) {
-		target_err("CHAP user or password not set for"
-			   " Initiator ACL\n");
+		target_err("CHAP user or password not set for Initiator ACL\n");
 		return NULL;
 	}
 
@@ -401,8 +400,7 @@ static int chap_server_compute_hash(
 		target_debug("[server] %s Digests do not match!\n\n", chap->digest_name);
 		goto out;
 	} else
-		target_debug("[server] %s Digests match, CHAP connection"
-			     " successful.\n\n",
+		target_debug("[server] %s Digests match, CHAP connection successful.\n\n",
 			     chap->digest_name);
 	/*
 	 * One way authentication has succeeded, return now if mutual
@@ -501,8 +499,7 @@ static int chap_server_compute_hash(
 	if (initiatorchg_len == chap->challenge_len &&
 				!memcmp(initiatorchg_binhex, chap->challenge,
 				initiatorchg_len)) {
-		target_err("initiator CHAP_C matches target CHAP_C, failing"
-			   " login attempt\n");
+		target_err("initiator CHAP_C matches target CHAP_C, failing login attempt\n");
 		goto out;
 	}
 	/*
@@ -525,8 +522,7 @@ static int chap_server_compute_hash(
 	ret = crypto_shash_update(desc, auth->password_mutual,
 				  strlen(auth->password_mutual));
 	if (ret < 0) {
-		target_err("crypto_shash_update() failed for"
-			   " password_mutual\n");
+		target_err("crypto_shash_update() failed for password_mutual\n");
 		goto out;
 	}
 	/*
drivers/target/iscsi/iscsi_target_configfs.c +13 -30

121 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_datain_values.c +2 -5
index 84ba97e935e1..57e887945de4 100644
@@ -23,8 +23,7 @@ struct iscsi_datain_req *iscsit_allocate_datain_req(void)
 
 	dr = kmem_cache_zalloc(lio_dr_cache, GFP_ATOMIC);
 	if (!dr) {
-		target_err("Unable to allocate memory for"
-			   " struct iscsi_datain_req\n");
+		target_err("Unable to allocate memory for struct iscsi_datain_req\n");
 		return NULL;
 	}
 	INIT_LIST_HEAD(&dr->cmd_datain_node);
@@ -63,9 +62,7 @@ void iscsit_free_all_datain_reqs(struct iscsit_cmd *cmd)
 struct iscsi_datain_req *iscsit_get_datain_req(struct iscsit_cmd *cmd)
 {
 	if (list_empty(&cmd->datain_list)) {
-		target_err("cmd->datain_list is empty for ITT:"
-			   " 0x%08x\n",
-			   cmd->init_task_tag);
+		target_err("cmd->datain_list is empty for ITT: 0x%08x\n", cmd->init_task_tag);
 		return NULL;
 	}
 
drivers/target/iscsi/iscsi_target_erl0.c +28 -67

247 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_erl1.c +28 -68

244 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_erl2.c +12 -26
index 8b84ff97b0f0..96fb0ea0ad4c 100644
@@ -92,8 +92,7 @@ static int iscsit_attach_inactive_connection_recovery_entry(
 	list_add_tail(&cr->cr_list, &sess->cr_inactive_list);
 
 	sess->conn_recovery_count++;
-	target_debug("Incremented connection recovery count to %u for"
-		     " SID: %u\n",
+	target_debug("Incremented connection recovery count to %u for SID: %u\n",
 		     sess->conn_recovery_count, sess->sid);
 	spin_unlock(&sess->cr_i_lock);
 
@@ -176,8 +175,7 @@ int iscsit_remove_active_connection_recovery_entry(
 	list_del(&cr->cr_list);
 
 	sess->conn_recovery_count--;
-	target_debug("Decremented connection recovery count to %u for"
-		     " SID: %u\n",
+	target_debug("Decremented connection recovery count to %u for SID: %u\n",
 		     sess->conn_recovery_count, sess->sid);
 	spin_unlock(&sess->cr_a_lock);
 
@@ -205,8 +203,7 @@ int iscsit_remove_cmd_from_connection_recovery(
 	struct iscsi_conn_recovery *cr;
 
 	if (!cmd->cr) {
-		target_err("struct iscsi_conn_recovery pointer for ITT: 0x%08x"
-			   " is NULL!\n",
+		target_err("struct iscsi_conn_recovery pointer for ITT: 0x%08x is NULL!\n",
 			   cmd->init_task_tag);
 		BUG();
 	}
@@ -235,8 +232,7 @@ void iscsit_discard_cr_cmds_by_expstatsn(
 		}
 
 		dropped_count++;
-		target_debug("Dropping Acknowledged ITT: 0x%08x, StatSN:"
-			     " 0x%08x, CID: %hu.\n",
+		target_debug("Dropping Acknowledged ITT: 0x%08x, StatSN: 0x%08x, CID: %hu.\n",
 			     cmd->init_task_tag, cmd->stat_sn, cr->cid);
 
 		iscsit_remove_cmd_from_connection_recovery(cmd, sess);
@@ -247,18 +243,15 @@ void iscsit_discard_cr_cmds_by_expstatsn(
 	}
 	spin_unlock(&cr->conn_recovery_cmd_lock);
 
-	target_debug("Dropped %u total acknowledged commands on"
-		     " CID: %hu less than old ExpStatSN: 0x%08x\n",
+	target_debug("Dropped %u total acknowledged commands on CID: %hu less than old ExpStatSN: 0x%08x\n",
 		     dropped_count, cr->cid, exp_statsn);
 
 	if (!cr->cmd_count) {
-		target_debug("No commands to be reassigned for failed"
-			     " connection CID: %hu on SID: %u\n",
+		target_debug("No commands to be reassigned for failed connection CID: %hu on SID: %u\n",
 			     cr->cid, sess->sid);
 		iscsit_remove_inactive_connection_recovery_entry(cr, sess);
 		iscsit_attach_active_connection_recovery_entry(sess, cr);
-		target_debug("iSCSI connection recovery successful for CID:"
-			     " %hu on SID: %u\n",
+		target_debug("iSCSI connection recovery successful for CID: %hu on SID: %u\n",
 			     cr->cid, sess->sid);
 		iscsit_remove_active_connection_recovery_entry(cr, sess);
 	} else {
@@ -282,8 +275,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsit_conn *conn)
 			continue;
 
 		dropped_count++;
-		target_debug("Dropping unacknowledged CmdSN:"
-			     " 0x%08x during connection recovery on CID: %hu\n",
+		target_debug("Dropping unacknowledged CmdSN: 0x%08x during connection recovery on CID: %hu\n",
 			     ooo_cmdsn->cmdsn, conn->cid);
 		iscsit_remove_ooo_cmdsn(sess, ooo_cmdsn);
 	}
@@ -302,8 +294,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsit_conn *conn)
 	}
 	spin_unlock_bh(&conn->cmd_lock);
 
-	target_debug("Dropped %u total unacknowledged commands on CID:"
-		     " %hu for ExpCmdSN: 0x%08x.\n",
+	target_debug("Dropped %u total unacknowledged commands on CID: %hu for ExpCmdSN: 0x%08x.\n",
 		     dropped_count, conn->cid, sess->exp_cmd_sn);
 	return 0;
 }
@@ -322,8 +313,7 @@ int iscsit_prepare_cmds_for_reallegiance(struct iscsit_conn *conn)
 	 */
 	cr = kzalloc(sizeof(struct iscsi_conn_recovery), GFP_KERNEL);
 	if (!cr) {
-		target_err("Unable to allocate memory for"
-			   " struct iscsi_conn_recovery.\n");
+		target_err("Unable to allocate memory for struct iscsi_conn_recovery.\n");
 		return -1;
 	}
 	INIT_LIST_HEAD(&cr->cr_list);
@@ -343,9 +333,7 @@ int iscsit_prepare_cmds_for_reallegiance(struct iscsit_conn *conn)
 
 		if ((cmd->iscsi_opcode != ISCSI_OP_SCSI_CMD) &&
 		    (cmd->iscsi_opcode != ISCSI_OP_NOOP_OUT)) {
-			target_debug("Not performing reallegiance on"
-				     " Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x,"
-				     " CID: %hu\n",
+			target_debug("Not performing reallegiance on Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, CID: %hu\n",
 				     cmd->iscsi_opcode, cmd->init_task_tag, cmd->cmd_sn, conn->cid);
 
 			list_del_init(&cmd->i_conn_node);
@@ -376,9 +364,7 @@ int iscsit_prepare_cmds_for_reallegiance(struct iscsit_conn *conn)
 		}
 
 		cmd_count++;
-		target_debug("Preparing Opcode: 0x%02x, ITT: 0x%08x,"
-			     " CmdSN: 0x%08x, StatSN: 0x%08x, CID: %hu for"
-			     " reallegiance.\n",
+		target_debug("Preparing Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, StatSN: 0x%08x, CID: %hu for reallegiance.\n",
 			     cmd->iscsi_opcode, cmd->init_task_tag, cmd->cmd_sn, cmd->stat_sn,
 			     conn->cid);
 
drivers/target/iscsi/iscsi_target_login.c +18 -36

158 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_nego.c +31 -72

283 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_nodeattrib.c +26 -46

165 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_parameters.c +33 -64

257 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_seq_pdu_list.c +13 -27
index a563b780d8e5..e60d69199504 100644
@@ -27,9 +27,7 @@ static void iscsit_dump_seq_list(struct iscsit_cmd *cmd)
 
 	for (i = 0; i < cmd->seq_count; i++) {
 		seq = &cmd->seq_list[i];
-		target_debug("i: %d, pdu_start: %d, pdu_count: %d,"
-			     " offset: %d, xfer_len: %d, seq_send_order: %d,"
-			     " seq_no: %d\n",
+		target_debug("i: %d, pdu_start: %d, pdu_count: %d, offset: %d, xfer_len: %d, seq_send_order: %d, seq_no: %d\n",
 			     i, seq->pdu_start, seq->pdu_count, seq->offset, seq->xfer_len,
 			     seq->seq_send_order, seq->seq_no);
 	}
@@ -44,9 +42,8 @@ static void iscsit_dump_pdu_list(struct iscsit_cmd *cmd)
 
 	for (i = 0; i < cmd->pdu_count; i++) {
 		pdu = &cmd->pdu_list[i];
-		target_debug("i: %d, offset: %d, length: %d,"
-			     " pdu_send_order: %d, seq_no: %d\n",
-			     i, pdu->offset, pdu->length, pdu->pdu_send_order, pdu->seq_no);
+		target_debug("i: %d, offset: %d, length: %d, pdu_send_order: %d, seq_no: %d\n", i,
+			     pdu->offset, pdu->length, pdu->pdu_send_order, pdu->seq_no);
 	}
 }
 #else
@@ -129,8 +126,7 @@ static int iscsit_randomize_pdu_lists(
 		}
 		array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL);
 		if (!array) {
-			target_err("Unable to allocate memory"
-				   " for random array.\n");
+			target_err("Unable to allocate memory for random array.\n");
 			return -ENOMEM;
 		}
 		iscsit_create_random_array(array, seq_count);
@@ -149,8 +145,7 @@ static int iscsit_randomize_pdu_lists(
 	if (seq_count) {
 		array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL);
 		if (!array) {
-			target_err("Unable to allocate memory for"
-				   " random array.\n");
+			target_err("Unable to allocate memory for random array.\n");
 			return -ENOMEM;
 		}
 		iscsit_create_random_array(array, seq_count);
@@ -575,8 +570,7 @@ struct iscsi_pdu *iscsit_get_pdu_holder(
 		if ((pdu[i].offset == offset) && (pdu[i].length == length))
 			return &pdu[i];
 
-	target_err("Unable to locate PDU holder for ITT: 0x%08x, Offset:"
-		   " %u, Length: %u\n",
+	target_err("Unable to locate PDU holder for ITT: 0x%08x, Offset: %u, Length: %u\n",
 		   cmd->init_task_tag, offset, length);
 	return NULL;
 }
@@ -599,9 +593,7 @@ struct iscsi_pdu *iscsit_get_pdu_holder_for_seq(
 		pdu = &cmd->pdu_list[cmd->pdu_start];
 
 		for (i = 0; pdu[i].seq_no != cmd->seq_no; i++) {
-			target_debug("pdu[i].seq_no: %d, pdu[i].pdu"
-				     "_send_order: %d, pdu[i].offset: %d,"
-				     " pdu[i].length: %d\n",
+			target_debug("pdu[i].seq_no: %d, pdu[i].pdu_send_order: %d, pdu[i].offset: %d, pdu[i].length: %d\n",
 				     pdu[i].seq_no, pdu[i].pdu_send_order, pdu[i].offset,
 				     pdu[i].length);
 
@@ -618,8 +610,7 @@ struct iscsi_pdu *iscsit_get_pdu_holder_for_seq(
 		if (cmd->pdu_start < cmd->pdu_count)
 			goto redo;
 
-		target_err("Command ITT: 0x%08x unable to locate"
-			   " struct iscsi_pdu for cmd->pdu_send_order: %u.\n",
+		target_err("Command ITT: 0x%08x unable to locate struct iscsi_pdu for cmd->pdu_send_order: %u.\n",
 			   cmd->init_task_tag, cmd->pdu_send_order);
 		return NULL;
 	} else {
@@ -628,15 +619,13 @@ struct iscsi_pdu *iscsit_get_pdu_holder_for_seq(
 			return NULL;
 		}
 
-		target_debug("seq->pdu_start: %d, seq->pdu_count: %d,"
-			     " seq->seq_no: %d\n",
+		target_debug("seq->pdu_start: %d, seq->pdu_count: %d, seq->seq_no: %d\n",
 			     seq->pdu_start, seq->pdu_count, seq->seq_no);
 
 		pdu = &cmd->pdu_list[seq->pdu_start];
 
 		if (seq->pdu_send_order == seq->pdu_count) {
-			target_err("Command ITT: 0x%08x seq->pdu_send"
-				   "_order: %u equals seq->pdu_count: %u\n",
+			target_err("Command ITT: 0x%08x seq->pdu_send_order: %u equals seq->pdu_count: %u\n",
 				   cmd->init_task_tag, seq->pdu_send_order, seq->pdu_count);
 			return NULL;
 		}
@@ -648,8 +637,7 @@ struct iscsi_pdu *iscsit_get_pdu_holder_for_seq(
 			}
 		}
 
-		target_err("Command ITT: 0x%08x unable to locate iscsi"
-			   "_pdu_t for seq->pdu_send_order: %u.\n",
+		target_err("Command ITT: 0x%08x unable to locate iscsi_pdu_t for seq->pdu_send_order: %u.\n",
 			   cmd->init_task_tag, seq->pdu_send_order);
 		return NULL;
 	}
@@ -670,8 +658,7 @@ struct iscsi_seq *iscsit_get_seq_holder(
 	}
 
 	for (i = 0; i < cmd->seq_count; i++) {
-		target_debug("seq_list[i].orig_offset: %d, seq_list[i]."
-			     "xfer_len: %d, seq_list[i].seq_no %u\n",
+		target_debug("seq_list[i].orig_offset: %d, seq_list[i].xfer_len: %d, seq_list[i].seq_no %u\n",
 			     cmd->seq_list[i].orig_offset, cmd->seq_list[i].xfer_len,
 			     cmd->seq_list[i].seq_no);
 
@@ -681,8 +668,7 @@ struct iscsi_seq *iscsit_get_seq_holder(
 			return &cmd->seq_list[i];
 	}
 
-	target_err("Unable to locate Sequence holder for ITT: 0x%08x,"
-		   " Offset: %u, Length: %u\n",
+	target_err("Unable to locate Sequence holder for ITT: 0x%08x, Offset: %u, Length: %u\n",
 		   cmd->init_task_tag, offset, length);
 	return NULL;
 }
drivers/target/iscsi/iscsi_target_tmr.c +24 -55

205 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_tpg.c +32 -55

90 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_util.c +19 -38

57 lines not on this page · raw message

drivers/target/target_core_alua.c +24 -53

77 lines not on this page · raw message

drivers/target/target_core_configfs.c +76 -154

230 lines not on this page · raw message

drivers/target/target_core_device.c +12 -26
index 7e530bdab04e..0317d77331c8 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_fabric_configfs.c +5 -11
index c2a4287361bd..f56baa63a278 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_fabric_lib.c +2 -4
index 9e619e0028ce..c0fda2769553 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_file.c +16 -33

49 lines not on this page · raw message

drivers/target/target_core_hba.c +2 -6
index 02501fd45b24..0edb17711a52 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_iblock.c +5 -10
index 843f5903e390..1731fa059d4d 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_pr.c +95 -210

305 lines not on this page · raw message

drivers/target/target_core_pscsi.c +29 -55

84 lines not on this page · raw message

drivers/target/target_core_rd.c +10 -20
index 7d83a4ed93da..974b6527f1ce 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_sbc.c +20 -41

61 lines not on this page · raw message

drivers/target/target_core_spc.c +3 -6
index 7c5c117389cc..f8e6698eede1 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_tmr.c +3 -6
index aa1c099fa92e..09bc8afe5252 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_tpg.c +9 -19
index 90d59ac5e4aa..9992714af597 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_transport.c +22 -45

67 lines not on this page · raw message

drivers/target/target_core_ua.c +3 -8
index 825039a5be08..faa7a3ffec68 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_xcopy.c +21 -44

65 lines not on this page · raw message

drivers/target/tcm_fc/tfc_cmd.c +4 -7
index 9ab560d9f520..2372f08b91c3 100644

Lines of this file are not shown. View the raw message.

drivers/target/tcm_fc/tfc_io.c +2 -9
index cc772793149e..852c2bccf759 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.40.3

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH 4/10 target: Fix some obvious style problems

In reply to Anastasia Kovaleva

Fix obvious style problems, that checkpatch can solve by itself. Patch was made automatically with this command:

./scripts/checkpatch.pl --fix-inplace -f ./drivers/target/**/*.{c,h}

and then carefully checked manually.

Warnings and errors that were fixed are:
WARNING: quoted string split across lines
WARNING: unnecessary whitespace before a quoted newline
WARNING: break quoted strings at a space character
WARNING: Integer promotion: Using 'h' in '%hu' is unnecessary
ERROR: trailing whitespace
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line
WARNING: please, no space before tabs
WARNING: break quoted strings at a space character
WARNING: Missing a blank line after declarations
WARNING: space prohibited between function name and open parenthesis '('
ERROR: space prohibited after that open parenthesis '('
ERROR: space required before the open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
ERROR: do not initialise statics to NULL
WARNING: sizeof buf should be sizeof(buf)
WARNING: space prohibited before semicolon
WARNING: Possible repeated word: 'the'
WARNING: Possible repeated word: 'calling'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Unnecessary typecast of c90 int constant - '(unsigned long long)0' could be '0ULL'
ERROR: spaces required around that '=' (ctx:VxW)
ERROR: space required after that ',' (ctx:VxV)
WARNING: Statements should start on a tabstop
WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
WARNING: Prefer __packed over __attribute__((__packed__))
WARNING: Comparisons should place the constant on the right side of the test

Then all format strings arguments were aligned by parenthesis by git-clang-format util.

Note: The functions, where checkpatch.pl + clang-format made mistakes:
lio_target_nacl_info_show
lio_target_nacl_info_show
iscsit_get_seq_holder_for_datain core_alua_show_tg_pt_gp_info
target_core_item_version_show target_pr_res_pr_holder_tg_port_show target_tg_pt_gp_alua_access_type_store core_scsi3_update_aptpl_buf
core_scsi3_update_aptpl_buf
core_scsi3_update_aptpl_buf
pscsi_show_configfs_dev_params
rd_show_configfs_dev_params
core_tmr_drain_state_list
core_tmr_lun_reset
tcmu_global_max_data_area_op
ft_del_wwn

---
 drivers/target/iscsi/cxgbit/cxgbit_target.c   |  2 +-
 drivers/target/iscsi/iscsi_target.c           | 60 +++++++++----------
 drivers/target/iscsi/iscsi_target_configfs.c  |  4 +-
 drivers/target/iscsi/iscsi_target_erl0.c      |  3 +-
 drivers/target/iscsi/iscsi_target_erl1.c      |  4 +-
 drivers/target/iscsi/iscsi_target_erl2.c      | 16 ++---
 drivers/target/iscsi/iscsi_target_login.c     | 19 +++---
 drivers/target/iscsi/iscsi_target_nego.c      |  5 +-
 .../target/iscsi/iscsi_target_parameters.c    | 18 +++---
 drivers/target/iscsi/iscsi_target_tmr.c       | 10 ++--
 drivers/target/iscsi/iscsi_target_tpg.c       | 45 +++++++-------
 drivers/target/iscsi/iscsi_target_util.c      |  9 +--
 drivers/target/sbp/sbp_target.c               |  6 +-
 drivers/target/target_core_alua.c             | 16 ++---
 drivers/target/target_core_configfs.c         | 20 +++----
 drivers/target/target_core_device.c           |  6 +-
 drivers/target/target_core_fabric_configfs.c  |  3 +-
 drivers/target/target_core_fabric_lib.c       |  2 +-
 drivers/target/target_core_iblock.c           |  2 +-
 drivers/target/target_core_pr.c               | 33 +++++-----
 drivers/target/target_core_pscsi.c            |  2 +-
 drivers/target/target_core_rd.c               |  4 +-
 drivers/target/target_core_sbc.c              |  1 +
 drivers/target/target_core_spc.c              |  2 +-
 drivers/target/target_core_stat.c             |  2 +-
 drivers/target/target_core_tmr.c              |  2 +-
 drivers/target/target_core_tpg.c              |  6 +-
 drivers/target/target_core_transport.c        | 14 ++---
 drivers/target/target_core_user.c             | 12 ++--
 drivers/target/target_core_xcopy.c            | 16 ++---
 drivers/target/tcm_fc/tcm_fc.h                |  2 +-
 drivers/target/tcm_fc/tfc_conf.c              |  2 +-
 drivers/target/tcm_fc/tfc_sess.c              |  1 +
 33 files changed, 182 insertions(+), 167 deletions(-)
drivers/target/iscsi/cxgbit/cxgbit_target.c +1 -1
index 95301f3c62a2..826b951ed7c2 100644
@@ -1312,7 +1312,7 @@ static int cxgbit_rx_login_pdu(struct cxgbit_sock *csk)
 	login_req = (struct iscsi_login_req *)login->req;
 	memcpy(login_req, pdu_cb->hdr, sizeof(*login_req));
 
-	target_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %hu, Length: %u\n",
+	target_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %u, Length: %u\n",
 		     login_req->flags, login_req->itt, login_req->cmdsn, login_req->exp_statsn,
 		     login_req->cid, pdu_cb->dlen);
 	/*
drivers/target/iscsi/iscsi_target.c +29 -31

234 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_configfs.c +2 -2
index bf820981b0da..c0f63c51a6cc 100644
@@ -210,7 +210,7 @@ static struct se_tpg_np *lio_target_call_addnptotpg(
 	if (ret < 0)
 		return ERR_PTR(-EINVAL);
 
-	target_debug("LIO_Target_ConfigFS: REGISTER -> %s TPGT: %hu PORTAL: %s\n",
+	target_debug("LIO_Target_ConfigFS: REGISTER -> %s TPGT: %u PORTAL: %s\n",
 		     config_item_name(&se_tpg->se_tpg_wwn->wwn_group.cg_item), tpg->tpgt, name);
 	/*
 	 * Assume ISCSI_TCP by default.  Other network portals for other
@@ -252,7 +252,7 @@ static void lio_target_call_delnpfromtpg(
 		return;
 
 	se_tpg = &tpg->tpg_se_tpg;
-	target_debug("LIO_Target_ConfigFS: DEREGISTER -> %s TPGT: %hu PORTAL: %pISpc\n",
+	target_debug("LIO_Target_ConfigFS: DEREGISTER -> %s TPGT: %u PORTAL: %pISpc\n",
 		     config_item_name(&se_tpg->se_tpg_wwn->wwn_group.cg_item), tpg->tpgt,
 		     &tpg_np->tpg_np->np_sockaddr);
 
drivers/target/iscsi/iscsi_target_erl0.c +2 -1
index 0607cc3b6f07..c34a04b7e91f 100644
@@ -334,6 +334,7 @@ static int iscsit_dataout_check_datasn(
 		data_sn = cmd->data_sn;
 	else {
 		struct iscsi_seq *seq = cmd->seq_ptr;
+
 		data_sn = seq->data_sn;
 	}
 
@@ -866,7 +867,7 @@ static void iscsit_handle_connection_cleanup(struct iscsit_conn *conn)
 	    !atomic_read(&sess->session_fall_back_to_erl0))
 		iscsit_connection_recovery_transport_reset(conn);
 	else {
-		target_debug("Performing cleanup for failed iSCSI Connection ID: %hu from %s\n",
+		target_debug("Performing cleanup for failed iSCSI Connection ID: %u from %s\n",
 			     conn->cid, sess->sess_ops->InitiatorName);
 		iscsit_close_connection(conn);
 	}
drivers/target/iscsi/iscsi_target_erl1.c +2 -2
index 54dc01d289cf..91b36e46181d 100644
@@ -460,7 +460,7 @@ int iscsit_handle_status_snack(
 	if (!begrun) {
 		begrun = conn->exp_statsn;
 	} else if (conn->exp_statsn > begrun) {
-		target_err("Got Status SNACK Begrun: 0x%08x, RunLength: 0x%08x but already got ExpStatSN: 0x%08x on CID: %hu.\n",
+		target_err("Got Status SNACK Begrun: 0x%08x, RunLength: 0x%08x but already got ExpStatSN: 0x%08x on CID: %u.\n",
 			   begrun, runlength, conn->exp_statsn, conn->cid);
 		return 0;
 	}
@@ -1174,7 +1174,7 @@ void iscsit_start_dataout_timer(
 	if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING)
 		return;
 
-	target_debug("Starting DataOUT timer for ITT: 0x%08x on CID: %hu.\n", cmd->init_task_tag,
+	target_debug("Starting DataOUT timer for ITT: 0x%08x on CID: %u.\n", cmd->init_task_tag,
 		     conn->cid);
 
 	cmd->dataout_timer_flags &= ~ISCSI_TF_STOP;
drivers/target/iscsi/iscsi_target_erl2.c +8 -8
index 96fb0ea0ad4c..b28cf293b9be 100644
@@ -232,7 +232,7 @@ void iscsit_discard_cr_cmds_by_expstatsn(
 		}
 
 		dropped_count++;
-		target_debug("Dropping Acknowledged ITT: 0x%08x, StatSN: 0x%08x, CID: %hu.\n",
+		target_debug("Dropping Acknowledged ITT: 0x%08x, StatSN: 0x%08x, CID: %u.\n",
 			     cmd->init_task_tag, cmd->stat_sn, cr->cid);
 
 		iscsit_remove_cmd_from_connection_recovery(cmd, sess);
@@ -243,15 +243,15 @@ void iscsit_discard_cr_cmds_by_expstatsn(
 	}
 	spin_unlock(&cr->conn_recovery_cmd_lock);
 
-	target_debug("Dropped %u total acknowledged commands on CID: %hu less than old ExpStatSN: 0x%08x\n",
+	target_debug("Dropped %u total acknowledged commands on CID: %u less than old ExpStatSN: 0x%08x\n",
 		     dropped_count, cr->cid, exp_statsn);
 
 	if (!cr->cmd_count) {
-		target_debug("No commands to be reassigned for failed connection CID: %hu on SID: %u\n",
+		target_debug("No commands to be reassigned for failed connection CID: %u on SID: %u\n",
 			     cr->cid, sess->sid);
 		iscsit_remove_inactive_connection_recovery_entry(cr, sess);
 		iscsit_attach_active_connection_recovery_entry(sess, cr);
-		target_debug("iSCSI connection recovery successful for CID: %hu on SID: %u\n",
+		target_debug("iSCSI connection recovery successful for CID: %u on SID: %u\n",
 			     cr->cid, sess->sid);
 		iscsit_remove_active_connection_recovery_entry(cr, sess);
 	} else {
@@ -275,7 +275,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsit_conn *conn)
 			continue;
 
 		dropped_count++;
-		target_debug("Dropping unacknowledged CmdSN: 0x%08x during connection recovery on CID: %hu\n",
+		target_debug("Dropping unacknowledged CmdSN: 0x%08x during connection recovery on CID: %u\n",
 			     ooo_cmdsn->cmdsn, conn->cid);
 		iscsit_remove_ooo_cmdsn(sess, ooo_cmdsn);
 	}
@@ -294,7 +294,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsit_conn *conn)
 	}
 	spin_unlock_bh(&conn->cmd_lock);
 
-	target_debug("Dropped %u total unacknowledged commands on CID: %hu for ExpCmdSN: 0x%08x.\n",
+	target_debug("Dropped %u total unacknowledged commands on CID: %u for ExpCmdSN: 0x%08x.\n",
 		     dropped_count, conn->cid, sess->exp_cmd_sn);
 	return 0;
 }
@@ -333,7 +333,7 @@ int iscsit_prepare_cmds_for_reallegiance(struct iscsit_conn *conn)
 
 		if ((cmd->iscsi_opcode != ISCSI_OP_SCSI_CMD) &&
 		    (cmd->iscsi_opcode != ISCSI_OP_NOOP_OUT)) {
-			target_debug("Not performing reallegiance on Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, CID: %hu\n",
+			target_debug("Not performing reallegiance on Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, CID: %u\n",
 				     cmd->iscsi_opcode, cmd->init_task_tag, cmd->cmd_sn, conn->cid);
 
 			list_del_init(&cmd->i_conn_node);
@@ -364,7 +364,7 @@ int iscsit_prepare_cmds_for_reallegiance(struct iscsit_conn *conn)
 		}
 
 		cmd_count++;
-		target_debug("Preparing Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, StatSN: 0x%08x, CID: %hu for reallegiance.\n",
+		target_debug("Preparing Opcode: 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, StatSN: 0x%08x, CID: %u for reallegiance.\n",
 			     cmd->iscsi_opcode, cmd->init_task_tag, cmd->cmd_sn, cmd->stat_sn,
 			     conn->cid);
 
drivers/target/iscsi/iscsi_target_login.c +10 -9
index 0450408bd9a3..1ba5af73aa01 100644
@@ -207,6 +207,7 @@ static int iscsi_login_set_conn_values(
 	__be16 cid)
 {
 	int ret;
+
 	conn->sess		= sess;
 	conn->cid		= be16_to_cpu(cid);
 	/*
@@ -230,10 +231,10 @@ __printf(2, 3) int iscsi_change_param_sprintf(
 	va_list args;
 	unsigned char buf[64];
 
-	memset(buf, 0, sizeof buf);
+	memset(buf, 0, sizeof(buf));
 
 	va_start(args, fmt);
-	vsnprintf(buf, sizeof buf, fmt, args);
+	vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 
 	if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) {
@@ -571,7 +572,7 @@ int iscsi_login_post_auth_non_zero_tsih(
 	 */
 	conn_ptr = iscsit_get_conn_from_cid_rcfr(sess, cid);
 	if (conn_ptr) {
-		target_err("Connection exists with CID %hu for %s, performing connection reinstatement.\n",
+		target_err("Connection exists with CID %u for %s, performing connection reinstatement.\n",
 			   conn_ptr->cid, sess->sess_ops->InitiatorName);
 
 		iscsit_connection_reinstatement_rcfr(conn_ptr);
@@ -591,7 +592,7 @@ int iscsi_login_post_auth_non_zero_tsih(
 		cr = iscsit_get_inactive_connection_recovery_entry(
 				sess, cid);
 		if (cr) {
-			target_debug("Performing implicit logout for connection recovery on CID: %hu\n",
+			target_debug("Performing implicit logout for connection recovery on CID: %u\n",
 				     conn->cid);
 			iscsit_discard_cr_cmds_by_expstatsn(cr, exp_statsn);
 		}
@@ -757,7 +758,7 @@ void iscsi_post_login_handler(
 	target_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n");
 	sess->session_state = TARG_SESS_STATE_LOGGED_IN;
 
-	target_debug("iSCSI Login successful on CID: %hu from %pISpc to %pISpc,%hu\n", conn->cid,
+	target_debug("iSCSI Login successful on CID: %u from %pISpc to %pISpc,%u\n", conn->cid,
 		     &conn->login_sockaddr, &conn->local_sockaddr, tpg->tpgt);
 
 	spin_lock_bh(&sess->conn_lock);
@@ -776,7 +777,7 @@ void iscsi_post_login_handler(
 	if (tpg->tpg_tiqn)
 		tpg->tpg_tiqn->tiqn_nsessions++;
 
-	target_debug("Incremented number of active iSCSI sessions to %u on iSCSI Target Portal Group: %hu\n",
+	target_debug("Incremented number of active iSCSI sessions to %u on iSCSI Target Portal Group: %u\n",
 		     tpg->nsessions, tpg->tpgt);
 	spin_unlock_bh(&se_tpg->session_lock);
 
@@ -961,7 +962,7 @@ int iscsit_get_login_rx(struct iscsit_conn *conn, struct iscsi_login *login)
 	payload_length	= ntoh24(login_req->dlength);
 	padding = ((-payload_length) & 3);
 
-	target_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %hu, Length: %u\n",
+	target_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %u, Length: %u\n",
 		     login_req->flags, login_req->itt, login_req->cmdsn, login_req->exp_statsn,
 		     login_req->cid, payload_length);
 	/*
@@ -1304,11 +1305,11 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
 	/*
 	 * SessionType: Discovery
 	 *
-	 * 	Locates Default Portal
+	 *	Locates Default Portal
 	 *
 	 * SessionType: Normal
 	 *
-	 * 	Locates Target Portal from NP -> Target IQN
+	 *	Locates Target Portal from NP -> Target IQN
 	 */
 	rc = iscsi_target_locate_portal(np, conn, login);
 	if (rc < 0) {
drivers/target/iscsi/iscsi_target_nego.c +3 -2
index 4f60ec03c95c..523b780211b3 100644
@@ -332,6 +332,7 @@ static int iscsi_target_do_tx_login_io(struct iscsit_conn *conn, struct iscsi_lo
 	 */
 	if (login->login_complete) {
 		int rc = iscsit_start_kthreads(conn);
+
 		if (rc) {
 			iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
 					    ISCSI_LOGIN_STATUS_NO_RESOURCES);
@@ -1220,7 +1221,7 @@ int iscsi_target_locate_portal(
 		goto out;
 	}
 	conn->tpg_np = tpg_np;
-	target_debug("Located Portal Group Object: %hu\n", conn->tpg->tpgt);
+	target_debug("Located Portal Group Object: %u\n", conn->tpg->tpgt);
 	/*
 	 * Setup crc32c modules from libcrypto
 	 */
@@ -1267,7 +1268,7 @@ int iscsi_target_locate_portal(
 	sess->se_sess->se_node_acl = core_tpg_check_initiator_node_acl(
 			&conn->tpg->tpg_se_tpg, i_buf);
 	if (!sess->se_sess->se_node_acl) {
-		target_err("iSCSI Initiator Node: %s is not authorized to access iSCSI target portal group: %hu.\n",
+		target_err("iSCSI Initiator Node: %s is not authorized to access iSCSI target portal group: %u.\n",
 			   i_buf, conn->tpg->tpgt);
 		iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
 				ISCSI_LOGIN_STATUS_TGT_FORBIDDEN);
drivers/target/iscsi/iscsi_target_parameters.c +9 -9
index 4b8429c53904..9c2c70de8d75 100644
@@ -32,7 +32,7 @@ int iscsi_login_rx_data(
 		return -1;
 	}
 
-	return 0 ;
+	return 0;
 }
 
 int iscsi_login_tx_data(
@@ -78,18 +78,18 @@ void iscsi_dump_sess_ops(struct iscsi_sess_ops *sess_ops)
 	target_debug("InitiatorAlias: %s\n", sess_ops->InitiatorAlias);
 	target_debug("TargetName: %s\n", sess_ops->TargetName);
 	target_debug("TargetAlias: %s\n", sess_ops->TargetAlias);
-	target_debug("TargetPortalGroupTag: %hu\n", sess_ops->TargetPortalGroupTag);
-	target_debug("MaxConnections: %hu\n", sess_ops->MaxConnections);
+	target_debug("TargetPortalGroupTag: %u\n", sess_ops->TargetPortalGroupTag);
+	target_debug("MaxConnections: %u\n", sess_ops->MaxConnections);
 	target_debug("InitialR2T: %s\n", (sess_ops->InitialR2T) ? "Yes" : "No");
 	target_debug("ImmediateData: %s\n", (sess_ops->ImmediateData) ? "Yes" : "No");
 	target_debug("MaxBurstLength: %u\n", sess_ops->MaxBurstLength);
 	target_debug("FirstBurstLength: %u\n", sess_ops->FirstBurstLength);
-	target_debug("DefaultTime2Wait: %hu\n", sess_ops->DefaultTime2Wait);
-	target_debug("DefaultTime2Retain: %hu\n", sess_ops->DefaultTime2Retain);
-	target_debug("MaxOutstandingR2T: %hu\n", sess_ops->MaxOutstandingR2T);
+	target_debug("DefaultTime2Wait: %u\n", sess_ops->DefaultTime2Wait);
+	target_debug("DefaultTime2Retain: %u\n", sess_ops->DefaultTime2Retain);
+	target_debug("MaxOutstandingR2T: %u\n", sess_ops->MaxOutstandingR2T);
 	target_debug("DataPDUInOrder: %s\n", (sess_ops->DataPDUInOrder) ? "Yes" : "No");
 	target_debug("DataSequenceInOrder: %s\n", (sess_ops->DataSequenceInOrder) ? "Yes" : "No");
-	target_debug("ErrorRecoveryLevel: %hu\n", sess_ops->ErrorRecoveryLevel);
+	target_debug("ErrorRecoveryLevel: %u\n", sess_ops->ErrorRecoveryLevel);
 	target_debug("SessionType: %s\n", (sess_ops->SessionType) ? "Discovery" : "Normal");
 }
 
@@ -1298,6 +1298,7 @@ static int iscsi_enforce_integrity_rules(
 					&tmpptr, 0);
 			if (FirstBurstLength > MaxBurstLength) {
 				char tmpbuf[11];
+
 				memset(tmpbuf, 0, sizeof(tmpbuf));
 				sprintf(tmpbuf, "%u", MaxBurstLength);
 				if (iscsi_update_param_value(param, tmpbuf))
@@ -1422,8 +1423,7 @@ int iscsi_encode_text_output(
 			*length += 1;
 			output_buf = textbuf + *length;
 			SET_PSTATE_PROPOSER(param);
-			iscsi_check_proposer_for_optional_reply(param,
-							        keys_workaround);
+			iscsi_check_proposer_for_optional_reply(param, keys_workaround);
 			target_debug("Sending key: %s=%s\n", param->name, param->value);
 		}
 	}
drivers/target/iscsi/iscsi_target_tmr.c +5 -5
index c9f55f3cf7e3..0382ec46c68d 100644
@@ -39,7 +39,7 @@ u8 iscsit_tmr_abort_task(
 
 	ref_cmd = iscsit_find_cmd_from_itt(conn, hdr->rtt);
 	if (!ref_cmd) {
-		target_err("Unable to locate RefTaskTag: 0x%08x on CID: %hu.\n", hdr->rtt,
+		target_err("Unable to locate RefTaskTag: 0x%08x on CID: %u.\n", hdr->rtt,
 			   conn->cid);
 		return (iscsi_sna_gte(be32_to_cpu(hdr->refcmdsn), conn->sess->exp_cmd_sn) &&
 			iscsi_sna_lte(be32_to_cpu(hdr->refcmdsn), (u32) atomic_read(&conn->sess->max_cmd_sn))) ?
@@ -111,7 +111,7 @@ u8 iscsit_tmr_task_reassign(
 	struct iscsi_tm *hdr = (struct iscsi_tm *) buf;
 	u64 ret, ref_lun;
 
-	target_debug("Got TASK_REASSIGN TMR ITT: 0x%08x, RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %hu\n",
+	target_debug("Got TASK_REASSIGN TMR ITT: 0x%08x, RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %u\n",
 		     hdr->itt, hdr->rtt, hdr->exp_datasn, conn->cid);
 
 	if (conn->sess->sess_ops->ErrorRecoveryLevel != 2) {
@@ -121,7 +121,7 @@ u8 iscsit_tmr_task_reassign(
 
 	ret = iscsit_find_cmd_for_recovery(conn->sess, &ref_cmd, &cr, hdr->rtt);
 	if (ret == -2) {
-		target_err("Command ITT: 0x%08x is still alligent to CID: %hu\n",
+		target_err("Command ITT: 0x%08x is still alligent to CID: %u\n",
 			   ref_cmd->init_task_tag, cr->cid);
 		return ISCSI_TMF_RSP_TASK_ALLEGIANT;
 	} else if (ret == -1) {
@@ -175,7 +175,7 @@ static void iscsit_task_reassign_remove_cmd(
 	ret = iscsit_remove_cmd_from_connection_recovery(cmd, sess);
 	spin_unlock(&cr->conn_recovery_cmd_lock);
 	if (!ret) {
-		target_debug("iSCSI connection recovery successful for CID: %hu on SID: %u\n",
+		target_debug("iSCSI connection recovery successful for CID: %u on SID: %u\n",
 			     cr->cid, sess->sid);
 		iscsit_remove_active_connection_recovery_entry(cr, sess);
 	}
@@ -425,7 +425,7 @@ static int iscsit_task_reassign_complete(
 	if (ret != 0)
 		return ret;
 
-	target_debug("Completed connection reallegiance for Opcode: 0x%02x, ITT: 0x%08x to CID: %hu.\n",
+	target_debug("Completed connection reallegiance for Opcode: 0x%02x, ITT: 0x%08x to CID: %u.\n",
 		     cmd->iscsi_opcode, cmd->init_task_tag, conn->cid);
 
 	return 0;
drivers/target/iscsi/iscsi_target_tpg.c +22 -23

177 lines not on this page · raw message

drivers/target/iscsi/iscsi_target_util.c +5 -4
index f64f35083b61..04eb268b9bc9 100644
@@ -383,7 +383,7 @@ struct iscsit_cmd *iscsit_find_cmd_from_itt(
 	}
 	spin_unlock_bh(&conn->cmd_lock);
 
-	target_err("Unable to locate ITT: 0x%08x on CID: %hu", init_task_tag, conn->cid);
+	target_err("Unable to locate ITT: 0x%08x on CID: %u", init_task_tag, conn->cid);
 	return NULL;
 }
 EXPORT_SYMBOL(iscsit_find_cmd_from_itt);
@@ -406,7 +406,7 @@ struct iscsit_cmd *iscsit_find_cmd_from_itt_or_dump(
 	}
 	spin_unlock_bh(&conn->cmd_lock);
 
-	target_err("Unable to locate ITT: 0x%08x on CID: %hu, dumping payload\n", init_task_tag,
+	target_err("Unable to locate ITT: 0x%08x on CID: %u, dumping payload\n", init_task_tag,
 		   conn->cid);
 	if (length)
 		iscsit_dump_data_payload(conn, length, 1);
@@ -430,7 +430,7 @@ struct iscsit_cmd *iscsit_find_cmd_from_ttt(
 	}
 	spin_unlock_bh(&conn->cmd_lock);
 
-	target_err("Unable to locate TTT: 0x%08x on CID: %hu\n", targ_xfer_tag, conn->cid);
+	target_err("Unable to locate TTT: 0x%08x on CID: %u\n", targ_xfer_tag, conn->cid);
 	return NULL;
 }
 
@@ -1197,7 +1197,7 @@ int iscsit_fe_sendpage_sg(
 		struct kvec *iov_d = &cmd->iov_data[iov_off];
 
 		tx_sent = tx_data(conn, iov_d, 1, ISCSI_CRC_LEN);
-		if (ISCSI_CRC_LEN != tx_sent) {
+		if (tx_sent != ISCSI_CRC_LEN) {
 			if (tx_sent == -EAGAIN) {
 				target_err("tx_data() returned -EAGAIN\n");
 				goto send_datacrc;
@@ -1301,6 +1301,7 @@ int tx_data(
 
 	while (msg_data_left(&msg)) {
 		int tx_loop = sock_sendmsg(conn->sock, &msg);
+
 		if (tx_loop <= 0) {
 			target_debug("tx_loop: %d total_tx %d\n", tx_loop, total_tx);
 			return tx_loop;
drivers/target/sbp/sbp_target.c +5 -1
index 75914c19c872..4d551eefa4a6 100644
@@ -1351,7 +1351,7 @@ static void sbp_sense_mangle(struct sbp_target_request *req)
 
 	WARN_ON(se_cmd->scsi_sense_length < 18);
 
-	switch (sense[0] & 0x7f) { 		/* sfmt */
+	switch (sense[0] & 0x7f) { /* sfmt */
 	case 0x70: /* current, fixed */
 		status[0] = 0 << 6;
 		break;
@@ -1673,6 +1673,7 @@ static char *sbp_get_fabric_wwn(struct se_portal_group *se_tpg)
 static u16 sbp_get_tag(struct se_portal_group *se_tpg)
 {
 	struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
+
 	return tpg->tport_tpgt;
 }
 
@@ -2133,6 +2134,7 @@ static ssize_t sbp_tpg_attrib_mgt_orb_timeout_show(struct config_item *item,
 	struct se_portal_group *se_tpg = attrib_to_tpg(item);
 	struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
 	struct sbp_tport *tport = tpg->tport;
+
 	return sprintf(page, "%d\n", tport->mgt_orb_timeout);
 }
 
@@ -2168,6 +2170,7 @@ static ssize_t sbp_tpg_attrib_max_reconnect_timeout_show(struct config_item *ite
 	struct se_portal_group *se_tpg = attrib_to_tpg(item);
 	struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
 	struct sbp_tport *tport = tpg->tport;
+
 	return sprintf(page, "%d\n", tport->max_reconnect_timeout);
 }
 
@@ -2203,6 +2206,7 @@ static ssize_t sbp_tpg_attrib_max_logins_per_lun_show(struct config_item *item,
 	struct se_portal_group *se_tpg = attrib_to_tpg(item);
 	struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
 	struct sbp_tport *tport = tpg->tport;
+
 	return sprintf(page, "%d\n", tport->max_logins_per_lun);
 }
 
drivers/target/target_core_alua.c +9 -7
index 20fe346c270a..1caddbc73631 100644
@@ -315,6 +315,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
 
 	while (len < cmd->data_length) {
 		bool found = false;
+
 		alua_access_state = (ptr[0] & 0x0f);
 		/*
 		 * Check the received ALUA access state, and determine if
@@ -470,6 +471,7 @@ static inline sense_reason_t core_alua_state_lba_dependent(
 
 			if (segment_mult) {
 				u64 tmp = lba;
+
 				start_lba = do_div(tmp, segment_size * segment_mult);
 
 				last_lba = first_lba + segment_size - 1;
@@ -496,7 +498,7 @@ static inline sense_reason_t core_alua_state_lba_dependent(
 				    lba_map_mem_list) {
 			if (map_mem->lba_map_mem_alua_pg_id != tg_pt_gp_id)
 				continue;
-			switch(map_mem->lba_map_mem_alua_state) {
+			switch (map_mem->lba_map_mem_alua_state) {
 			case ALUA_ACCESS_STATE_STANDBY:
 				spin_unlock(&dev->t10_alua.lba_map_lock);
 				return TCM_ALUA_TG_PT_STANDBY;
@@ -1144,7 +1146,7 @@ int core_alua_do_port_transition(
 	spin_unlock(&lu_gp->lu_gp_lock);
 
 	if (!rc) {
-		target_debug("Successfully processed LU Group: %s all ALUA TG PT Group IDs: %hu %s transition to primary state: %s\n",
+		target_debug("Successfully processed LU Group: %s all ALUA TG PT Group IDs: %u %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,
 			     (explicit) ? "explicit" : "implicit", core_alua_dump_state(new_state));
 	}
@@ -1229,7 +1231,7 @@ static int core_alua_set_tg_pt_secondary_state(
 			ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG :
 			ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA;
 
-	target_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu to secondary access state: %s\n",
+	target_debug("Successful %s ALUA transition TG PT Group: %s ID: %u to secondary access state: %s\n",
 		     (explicit) ? "explicit" : "implicit",
 		     config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), tg_pt_gp->tg_pt_gp_id,
 		     (offline) ? "OFFLINE" : "ONLINE");
@@ -1404,7 +1406,7 @@ int core_alua_set_lu_gp_id(struct t10_alua_lu_gp *lu_gp, u16 lu_gp_id)
 			if (!lu_gp_id)
 				goto again;
 
-			target_warn("ALUA Logical Unit Group ID: %hu already exists, ignoring request\n",
+			target_warn("ALUA Logical Unit Group ID: %u already exists, ignoring request\n",
 				    lu_gp_id);
 			spin_unlock(&lu_gps_lock);
 			return -EINVAL;
@@ -1669,7 +1671,7 @@ int core_alua_set_tg_pt_gp_id(
 			if (!tg_pt_gp_id)
 				goto again;
 
-			target_err("ALUA Target Port Group ID: %hu already exists, ignoring request\n",
+			target_err("ALUA Target Port Group ID: %u already exists, ignoring request\n",
 				   tg_pt_gp_id);
 			spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
 			return -EINVAL;
@@ -1924,7 +1926,7 @@ ssize_t core_alua_store_tg_pt_gp_info(
 		 * with the default_tg_pt_gp.
 		 */
 		if (!tg_pt_gp_new) {
-			target_debug("Target_Core_ConfigFS: Moving %s/tpgt_%hu/%s from ALUA Target Port Group: alua/%s, ID: %hu back to default_tg_pt_gp\n",
+			target_debug("Target_Core_ConfigFS: Moving %s/tpgt_%u/%s from ALUA Target Port Group: alua/%s, ID: %u back to default_tg_pt_gp\n",
 				     tpg->se_tpg_tfo->tpg_get_wwn(tpg),
 				     tpg->se_tpg_tfo->tpg_get_tag(tpg),
 				     config_item_name(&lun->lun_group.cg_item),
@@ -1942,7 +1944,7 @@ ssize_t core_alua_store_tg_pt_gp_info(
 
 	target_swap_tg_pt_gp(lun, tg_pt_gp, tg_pt_gp_new);
 	spin_unlock(&lun->lun_tg_pt_gp_lock);
-	target_debug("Target_Core_ConfigFS: %s %s/tpgt_%hu/%s to ALUA Target Port Group: alua/%s, ID: %hu\n",
+	target_debug("Target_Core_ConfigFS: %s %s/tpgt_%u/%s to ALUA Target Port Group: alua/%s, ID: %u\n",
 		     (move) ? "Moving" : "Adding", tpg->se_tpg_tfo->tpg_get_wwn(tpg),
 		     tpg->se_tpg_tfo->tpg_get_tag(tpg), config_item_name(&lun->lun_group.cg_item),
 		     config_item_name(&tg_pt_gp_new->tg_pt_gp_group.cg_item),
drivers/target/target_core_configfs.c +10 -10
index 433afdc20dc1..c30a8687e4c3 100644
@@ -166,6 +166,7 @@ static struct target_fabric_configfs *target_core_get_fabric(
 	mutex_lock(&g_tf_lock);
 	list_for_each_entry(tf, &g_tf_list, tf_list) {
 		const char *cmp_name = tf->tf_ops->fabric_alias;
+
 		if (!cmp_name)
 			cmp_name = tf->tf_ops->fabric_name;
 		if (!strcmp(cmp_name, name)) {
@@ -1840,11 +1841,9 @@ static ssize_t target_pr_res_pr_all_tgt_pts_show(struct config_item *item,
 	if (!dev->dev_pr_res_holder) {
 		len = sprintf(page, "No SPC-3 Reservation holder\n");
 	} else if (dev->dev_pr_res_holder->pr_reg_all_tg_pt) {
-		len = sprintf(page, "SPC-3 Reservation: All Target"
-			" Ports registration\n");
+		len = sprintf(page, "SPC-3 Reservation: All Target Ports registration\n");
 	} else {
-		len = sprintf(page, "SPC-3 Reservation: Single"
-			" Target Port registration\n");
+		len = sprintf(page, "SPC-3 Reservation: Single Target Port registration\n");
 	}
 
 	spin_unlock(&dev->dev_reservation_lock);
@@ -2423,7 +2422,7 @@ static ssize_t target_dev_alua_lu_gp_store(struct config_item *item,
 		 * with NULL
 		 */
 		if (!lu_gp_new) {
-			target_debug("Target_Core_ConfigFS: Releasing %s/%s from ALUA LU Group: core/alua/lu_gps/%s, ID: %hu\n",
+			target_debug("Target_Core_ConfigFS: Releasing %s/%s from ALUA LU Group: core/alua/lu_gps/%s, ID: %u\n",
 				     config_item_name(&hba->hba_group.cg_item),
 				     config_item_name(&dev->dev_group.cg_item),
 				     config_item_name(&lu_gp->lu_gp_group.cg_item),
@@ -2446,7 +2445,7 @@ static ssize_t target_dev_alua_lu_gp_store(struct config_item *item,
 	__core_alua_attach_lu_gp_mem(lu_gp_mem, lu_gp_new);
 	spin_unlock(&lu_gp_mem->lu_gp_mem_lock);
 
-	target_debug("Target_Core_ConfigFS: %s %s/%s to ALUA LU Group: core/alua/lu_gps/%s, ID: %hu\n",
+	target_debug("Target_Core_ConfigFS: %s %s/%s to ALUA LU Group: core/alua/lu_gps/%s, ID: %u\n",
 		     (move) ? "Moving" : "Adding", config_item_name(&hba->hba_group.cg_item),
 		     config_item_name(&dev->dev_group.cg_item),
 		     config_item_name(&lu_gp_new->lu_gp_group.cg_item), lu_gp_new->lu_gp_id);
@@ -2692,7 +2691,7 @@ static ssize_t target_lu_gp_lu_gp_id_store(struct config_item *item,
 	if (ret < 0)
 		return -EINVAL;
 
-	target_debug("Target_Core_ConfigFS: Set ALUA Logical Unit Group: core/alua/lu_gps/%s to ID: %hu\n",
+	target_debug("Target_Core_ConfigFS: Set ALUA Logical Unit Group: core/alua/lu_gps/%s to ID: %u\n",
 		     config_item_name(&alua_lu_gp_cg->cg_item), lu_gp->lu_gp_id);
 
 	return count;
@@ -2792,7 +2791,7 @@ static void target_core_alua_drop_lu_gp(
 	struct t10_alua_lu_gp *lu_gp = container_of(to_config_group(item),
 			struct t10_alua_lu_gp, lu_gp_group);
 
-	target_debug("Target_Core_ConfigFS: Releasing ALUA Logical Unit Group: core/alua/lu_gps/%s, ID: %hu\n",
+	target_debug("Target_Core_ConfigFS: Releasing ALUA Logical Unit Group: core/alua/lu_gps/%s, ID: %u\n",
 		     config_item_name(item), lu_gp->lu_gp_id);
 	/*
 	 * core_alua_free_lu_gp() is called from target_core_alua_lu_gp_ops->release()
@@ -2873,6 +2872,7 @@ static ssize_t target_tg_pt_gp_alua_access_status_show(struct config_item *item,
 		char *page)
 {
 	struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item);
+
 	return sprintf(page, "%s\n",
 		core_alua_dump_status(tg_pt_gp->tg_pt_gp_alua_access_status));
 }
@@ -3077,7 +3077,7 @@ static ssize_t target_tg_pt_gp_tg_pt_gp_id_store(struct config_item *item,
 	if (ret < 0)
 		return -EINVAL;
 
-	target_debug("Target_Core_ConfigFS: Set ALUA Target Port Group: core/alua/tg_pt_gps/%s to ID: %hu\n",
+	target_debug("Target_Core_ConfigFS: Set ALUA Target Port Group: core/alua/tg_pt_gps/%s to ID: %u\n",
 		     config_item_name(&alua_tg_pt_gp_cg->cg_item), tg_pt_gp->tg_pt_gp_id);
 
 	return count;
@@ -3209,7 +3209,7 @@ static void target_core_alua_drop_tg_pt_gp(
 	struct t10_alua_tg_pt_gp *tg_pt_gp = container_of(to_config_group(item),
 			struct t10_alua_tg_pt_gp, tg_pt_gp_group);
 
-	target_debug("Target_Core_ConfigFS: Releasing ALUA Target Port Group: alua/tg_pt_gps/%s, ID: %hu\n",
+	target_debug("Target_Core_ConfigFS: Releasing ALUA Target Port Group: alua/tg_pt_gps/%s, ID: %u\n",
 		     config_item_name(item), tg_pt_gp->tg_pt_gp_id);
 	/*
 	 * core_alua_free_tg_pt_gp() is called from target_core_alua_tg_pt_gp_ops->release()
drivers/target/target_core_device.c +3 -3
index 0317d77331c8..ea94ceabfadb 100644
@@ -595,7 +595,7 @@ int core_dev_add_initiator_node_lun_acl(
 			lun_access_ro, nacl, tpg) < 0)
 		return -EINVAL;
 
-	target_debug("%s_TPG[%hu]_LUN[%llu->%llu] - Added %s ACL for  InitiatorNode: %s\n",
+	target_debug("%s_TPG[%u]_LUN[%llu->%llu] - Added %s ACL for  InitiatorNode: %s\n",
 		     tpg->se_tpg_tfo->fabric_name, tpg->se_tpg_tfo->tpg_get_tag(tpg),
 		     lun->unpacked_lun, lacl->mapped_lun, lun_access_ro ? "RO" : "RW",
 		     nacl->initiatorname);
@@ -626,7 +626,7 @@ int core_dev_del_initiator_node_lun_acl(
 		core_disable_device_list_for_node(lun, deve, nacl, tpg);
 	mutex_unlock(&nacl->lun_entry_mutex);
 
-	target_debug("%s_TPG[%hu]_LUN[%llu] - Removed ACL for InitiatorNode: %s Mapped LUN: %llu\n",
+	target_debug("%s_TPG[%u]_LUN[%llu] - Removed ACL for InitiatorNode: %s Mapped LUN: %llu\n",
 		     tpg->se_tpg_tfo->fabric_name, tpg->se_tpg_tfo->tpg_get_tag(tpg),
 		     lun->unpacked_lun, nacl->initiatorname, lacl->mapped_lun);
 
@@ -637,7 +637,7 @@ void core_dev_free_initiator_node_lun_acl(
 	struct se_portal_group *tpg,
 	struct se_lun_acl *lacl)
 {
-	target_debug("%s_TPG[%hu] - Freeing ACL for %s InitiatorNode: %s Mapped LUN: %llu\n",
+	target_debug("%s_TPG[%u] - Freeing ACL for %s InitiatorNode: %s Mapped LUN: %llu\n",
 		     tpg->se_tpg_tfo->fabric_name, tpg->se_tpg_tfo->tpg_get_tag(tpg),
 		     tpg->se_tpg_tfo->fabric_name, lacl->se_lun_nacl->initiatorname,
 		     lacl->mapped_lun);
drivers/target/target_core_fabric_configfs.c +2 -1
index f56baa63a278..f4db86c41790 100644
@@ -404,6 +404,7 @@ static struct config_group *target_fabric_make_nodeacl(
 
 	if (tf->tf_ops->fabric_init_nodeacl) {
 		int ret = tf->tf_ops->fabric_init_nodeacl(se_nacl, name);
+
 		if (ret) {
 			configfs_remove_default_groups(&se_nacl->acl_fabric_stat_group);
 			core_tpg_del_initiator_node_acl(se_nacl);
@@ -860,7 +861,7 @@ static ssize_t target_fabric_tpg_base_rtpi_store(struct config_item *item,
 		return -EINVAL;
 
 	if (se_tpg->enabled) {
-		target_info("%s_TPG[%hu] - Can not change RTPI on enabled TPG",
+		target_info("%s_TPG[%u] - Can not change RTPI on enabled TPG",
 			    se_tpg->se_tpg_tfo->fabric_name,
 			    se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg));
 		return -EINVAL;
drivers/target/target_core_fabric_lib.c +1 -1
index c0fda2769553..36b6301808fe 100644
@@ -103,7 +103,7 @@ static int srp_get_pr_transport_id(
 	unsigned char *buf)
 {
 	const char *p;
-	unsigned len, count, leading_zero_bytes;
+	unsigned int len, count, leading_zero_bytes;
 	int rc;
 
 	p = nacl->initiatorname;
drivers/target/target_core_iblock.c +1 -1
index 1731fa059d4d..60a07baa9729 100644
@@ -731,7 +731,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 	struct scatterlist *sg;
 	u32 sg_num = sgl_nents;
 	blk_opf_t opf;
-	unsigned bio_cnt;
+	unsigned int bio_cnt;
 	int i, rc;
 	struct sg_mapping_iter prot_miter;
 	unsigned int miter_dir;
drivers/target/target_core_pr.c +19 -14
index c2c6fd957dff..8b97beffbf64 100644
@@ -526,17 +526,17 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,
 
 			return 0;
 		}
-       } else if (we && registered_nexus) {
-               /*
-                * Reads are allowed for Write Exclusive locks
-                * from all registrants.
-                */
-               if (cmd->data_direction == DMA_FROM_DEVICE) {
+	} else if (we && registered_nexus) {
+		/*
+		 * Reads are allowed for Write Exclusive locks
+		 * from all registrants.
+		 */
+		if (cmd->data_direction == DMA_FROM_DEVICE) {
 			target_debug("Allowing READ CDB: 0x%02x for %s reservation\n", cdb[0],
 				     core_scsi3_pr_dump_type(pr_reg_type));
 
-                       return 0;
-               }
+			return 0;
+		}
 	}
 	target_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x for %s reservation\n",
 		     transport_dump_cmd_direction(cmd), (registered_nexus) ? "" : "un",
@@ -1357,6 +1357,7 @@ void core_scsi3_free_all_registrations(
 	pr_res_holder = dev->dev_pr_res_holder;
 	if (pr_res_holder != NULL) {
 		struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;
+
 		__core_scsi3_complete_pro_release(dev, pr_res_nacl,
 						  pr_res_holder, 0, 0);
 	}
@@ -2236,7 +2237,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)
 	 * a PERSISTENT RESERVE OUT command with RESERVE service action through
 	 * a registered I_T nexus with the following parameters:
 	 *    a) RESERVATION KEY set to the value of the reservation key that is
-	 * 	 registered with the logical unit for the I_T nexus; and
+	 *	 registered with the logical unit for the I_T nexus; and
 	 */
 	if (res_key != pr_reg->pr_res_key) {
 		target_err("SPC-3 PR RESERVE: Received res_key: 0x%016Lx does not match existing SA REGISTER res_key: 0x%016Lx\n",
@@ -2279,6 +2280,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)
 		 */
 		if (!is_reservation_holder(pr_res_holder, pr_reg)) {
 			struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;
+
 			target_err("SPC-3 PR: Attempted RESERVE from [%s]: %s while reservation already held by [%s]: %s, returning RESERVATION_CONFLICT\n",
 				   cmd->se_tfo->fabric_name, se_sess->se_node_acl->initiatorname,
 				   pr_res_nacl->se_tpg->se_tpg_tfo->fabric_name,
@@ -2298,6 +2300,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)
 		if ((pr_res_holder->pr_res_type != type) ||
 		    (pr_res_holder->pr_res_scope != scope)) {
 			struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;
+
 			target_err("SPC-3 PR: Attempted RESERVE from [%s]: %s trying to change TYPE and/or SCOPE, while reservation already held by [%s]: %s, returning RESERVATION_CONFLICT\n",
 				   cmd->se_tfo->fabric_name, se_sess->se_node_acl->initiatorname,
 				   pr_res_nacl->se_tpg->se_tpg_tfo->fabric_name,
@@ -2514,6 +2517,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope,
 	if ((pr_res_holder->pr_res_type != type) ||
 	    (pr_res_holder->pr_res_scope != scope)) {
 		struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;
+
 		target_err("SPC-3 PR RELEASE: Attempted to release reservation from [%s]: %s with different TYPE and/or SCOPE  while reservation already held by [%s]: %s, returning RESERVATION_CONFLICT\n",
 			   cmd->se_tfo->fabric_name, se_sess->se_node_acl->initiatorname,
 			   pr_res_nacl->se_tpg->se_tpg_tfo->fabric_name,
@@ -2609,7 +2613,7 @@ core_scsi3_emulate_pro_clear(struct se_cmd *cmd, u64 res_key)
 	 * registered I_T nexus with the following parameter:
 	 *
 	 *	a) RESERVATION KEY field set to the value of the reservation key
-	 * 	   that is registered with the logical unit for the I_T nexus.
+	 *	   that is registered with the logical unit for the I_T nexus.
 	 */
 	if (res_key != pr_reg_n->pr_res_key) {
 		target_err("SPC-3 PR REGISTER: Received res_key: 0x%016Lx does not match existing SA REGISTER res_key: 0x%016Lx\n",
@@ -2624,6 +2628,7 @@ core_scsi3_emulate_pro_clear(struct se_cmd *cmd, u64 res_key)
 	pr_res_holder = dev->dev_pr_res_holder;
 	if (pr_res_holder) {
 		struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;
+
 		__core_scsi3_complete_pro_release(dev, pr_res_nacl,
 						  pr_res_holder, 0, 0);
 	}
@@ -3165,7 +3170,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 	spin_unlock(&dev->se_port_lock);
 
 	if (!dest_se_tpg || !dest_tf_ops) {
-		target_err("SPC-3 PR REGISTER_AND_MOVE: Unable to locate fabric ops from Relative Target Port Identifier: %hu\n",
+		target_err("SPC-3 PR REGISTER_AND_MOVE: Unable to locate fabric ops from Relative Target Port Identifier: %u\n",
 			   rtpi);
 		ret = TCM_INVALID_PARAMETER_LIST;
 		goto out_put_pr_reg;
@@ -3263,7 +3268,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 	 */
 	dest_se_deve = core_get_se_deve_from_rtpi(dest_node_acl, rtpi);
 	if (!dest_se_deve) {
-		target_err("Unable to locate %s dest_se_deve from RTPI: %hu\n",
+		target_err("Unable to locate %s dest_se_deve from RTPI: %u\n",
 			   dest_tf_ops->fabric_name, rtpi);
 		ret = TCM_INVALID_PARAMETER_LIST;
 		goto out;
@@ -3297,7 +3302,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 	 * The received on I_T Nexus must be the reservation holder.
 	 *
 	 * From spc4r17 section 5.7.8  Table 50 --
-	 * 	Register behaviors for a REGISTER AND MOVE service action
+	 *	Register behaviors for a REGISTER AND MOVE service action
 	 */
 	if (!is_reservation_holder(pr_res_holder, pr_reg)) {
 		target_warn("SPC-3 PR REGISTER_AND_MOVE: Calling I_T Nexus is not reservation holder\n");
@@ -3392,7 +3397,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 		dest_pr_reg->pr_res_generation = pr_tmpl->pr_generation++;
 	spin_unlock(&dev->dev_reservation_lock);
 
-	target_debug("SPC-3 PR [%s] Service Action: REGISTER_AND_MOVE created new reservation holder TYPE: %s on object RTPI: %hu  PRGeneration: 0x%08x\n",
+	target_debug("SPC-3 PR [%s] Service Action: REGISTER_AND_MOVE created new reservation holder TYPE: %s on object RTPI: %u  PRGeneration: 0x%08x\n",
 		     dest_tf_ops->fabric_name, core_scsi3_pr_dump_type(type), rtpi,
 		     dest_pr_reg->pr_res_generation);
 	target_debug("SPC-3 PR Successfully moved reservation from %s Fabric Node: %s%s -> %s Fabric Node: %s %s\n",
drivers/target/target_core_pscsi.c +1 -1
index 25288d8b82c8..4f300d366edc 100644
@@ -43,7 +43,7 @@ static enum rq_end_io_ret pscsi_req_done(struct request *, blk_status_t);
 
 /*	pscsi_attach_hba():
  *
- * 	pscsi_get_sh() used scsi_host_lookup() to locate struct Scsi_Host.
+ *	pscsi_get_sh() used scsi_host_lookup() to locate struct Scsi_Host.
  *	from the passed SCSI Host ID.
  */
 static int pscsi_attach_hba(struct se_hba *hba, u32 host_id)
drivers/target/target_core_rd.c +2 -2
index 974b6527f1ce..cd14fcb4b0f8 100644
@@ -237,7 +237,7 @@ static int rd_build_prot_space(struct rd_dev *rd_dev, int prot_length, int block
 	/*
 	 * prot_length=8byte dif data
 	 * tot sg needed = rd_page_count * (PGSZ/block_size) *
-	 * 		   (prot_length/block_size) + pad
+	 *		   (prot_length/block_size) + pad
 	 * PGSZ canceled each other.
 	 */
 	total_sg_needed = (rd_dev->rd_page_count * prot_length / block_size) + 1;
@@ -617,7 +617,7 @@ static int rd_init_prot(struct se_device *dev)
 {
 	struct rd_dev *rd_dev = RD_DEV(dev);
 
-        if (!dev->dev_attrib.pi_prot_type)
+	if (!dev->dev_attrib.pi_prot_type)
 		return 0;
 
 	return rd_build_prot_space(rd_dev, dev->prot_length,
drivers/target/target_core_sbc.c +1 -0
index 20756a92a2af..37164a9f7d32 100644
@@ -870,6 +870,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops)
 	case VARIABLE_LENGTH_CMD:
 	{
 		u16 service_action = get_unaligned_be16(&cdb[8]);
+
 		switch (service_action) {
 		case WRITE_SAME_32:
 			sectors = transport_get_sectors_32(cdb);
drivers/target/target_core_spc.c +1 -1
index f8e6698eede1..671d0e3122e6 100644
@@ -1291,7 +1291,7 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd)
 
 	if (buf) {
 		len = cpu_to_be32(lun_count * 8);
-		memcpy(buf, &len, min_t(int, sizeof len, cmd->data_length));
+		memcpy(buf, &len, min_t(int, sizeof(len), cmd->data_length));
 		transport_kunmap_data_sg(cmd);
 	}
 
drivers/target/target_core_stat.c +1 -1
index c42cbde8a31b..b0495d87e951 100644
@@ -214,7 +214,7 @@ static ssize_t target_stat_lu_indx_show(struct config_item *item, char *page)
 static ssize_t target_stat_lu_lun_show(struct config_item *item, char *page)
 {
 	/* FIXME: scsiLuDefaultLun */
-	return snprintf(page, PAGE_SIZE, "%llu\n", (unsigned long long)0);
+	return snprintf(page, PAGE_SIZE, "%llu\n", 0ULL);
 }
 
 static ssize_t target_stat_lu_lu_name_show(struct config_item *item, char *page)
drivers/target/target_core_tmr.c +1 -1
index 09bc8afe5252..0a5a09d63b48 100644
@@ -359,7 +359,7 @@ int core_tmr_lun_reset(
 	struct se_portal_group *tmr_tpg = NULL;
 	struct se_session *tmr_sess = NULL;
 	bool tas;
-        /*
+	/*
 	 * TASK_ABORTED status bit, this is configurable via ConfigFS
 	 * struct se_device attributes.  spc4r17 section 7.4.6 Control mode page
 	 *
drivers/target/target_core_tpg.c +3 -3
index 9992714af597..5af85cd960ef 100644
@@ -207,7 +207,7 @@ static void target_add_node_acl(struct se_node_acl *acl)
 	list_add_tail(&acl->acl_list, &tpg->acl_node_list);
 	mutex_unlock(&tpg->acl_node_mutex);
 
-	target_debug("%s_TPG[%hu] - Added %s ACL with TCQ Depth: %d for %s Initiator Node: %s\n",
+	target_debug("%s_TPG[%u] - Added %s ACL with TCQ Depth: %d for %s Initiator Node: %s\n",
 		     tpg->se_tpg_tfo->fabric_name, tpg->se_tpg_tfo->tpg_get_tag(tpg),
 		     acl->dynamic_node_acl ? "DYNAMIC" : "", acl->queue_depth,
 		     tpg->se_tpg_tfo->fabric_name, acl->initiatorname);
@@ -356,7 +356,7 @@ void core_tpg_del_initiator_node_acl(struct se_node_acl *acl)
 	core_tpg_wait_for_nacl_pr_ref(acl);
 	core_free_device_list_for_node(acl, tpg);
 
-	target_debug("%s_TPG[%hu] - Deleted ACL with TCQ Depth: %d for %s Initiator Node: %s\n",
+	target_debug("%s_TPG[%u] - Deleted ACL with TCQ Depth: %d for %s Initiator Node: %s\n",
 		     tpg->se_tpg_tfo->fabric_name, tpg->se_tpg_tfo->tpg_get_tag(tpg),
 		     acl->queue_depth, tpg->se_tpg_tfo->fabric_name, acl->initiatorname);
 
@@ -438,7 +438,7 @@ static int target_tpg_register_rtpi(struct se_portal_group *se_tpg)
 	if (se_tpg->rtpi_manual) {
 		ret = xa_insert(&tpg_xa, se_tpg->tpg_rtpi, se_tpg, GFP_KERNEL);
 		if (ret) {
-			target_info("%s_TPG[%hu] - Can not set RTPI %#x, it is already busy",
+			target_info("%s_TPG[%u] - Can not set RTPI %#x, it is already busy",
 				    se_tpg->se_tpg_tfo->fabric_name,
 				    se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg), se_tpg->tpg_rtpi);
 			return -EINVAL;
drivers/target/target_core_transport.c +7 -7
index 4bfce006eefd..3d6d0e525bd0 100644
@@ -1079,8 +1079,7 @@ void transport_dump_vpd_proto_id(
 		sprintf(buf+len, "IEEE 1394\n");
 		break;
 	case 0x40:
-		sprintf(buf+len, "SCSI Remote Direct Memory Access"
-				" Protocol\n");
+		sprintf(buf + len, "SCSI Remote Direct Memory Access Protocol\n");
 		break;
 	case 0x50:
 		sprintf(buf+len, "Internet SCSI (iSCSI)\n");
@@ -1089,8 +1088,7 @@ void transport_dump_vpd_proto_id(
 		sprintf(buf+len, "SAS Serial SCSI Protocol\n");
 		break;
 	case 0x70:
-		sprintf(buf+len, "Automation/Drive Interface Transport"
-				" Protocol\n");
+		sprintf(buf + len, "Automation/Drive Interface Transport Protocol\n");
 		break;
 	case 0x80:
 		sprintf(buf+len, "AT Attachment Interface ATA/ATAPI\n");
@@ -1115,7 +1113,7 @@ transport_set_vpd_proto_id(struct t10_vpd *vpd, unsigned char *page_83)
 	 *
 	 * from spc3r23.pdf section 7.5.1
 	 */
-	 if (page_83[1] & 0x80) {
+	if (page_83[1] & 0x80) {
 		vpd->protocol_identifier = (page_83[0] & 0xf0);
 		vpd->protocol_identifier_set = 1;
 		transport_dump_vpd_proto_id(vpd, NULL, 0);
@@ -1259,8 +1257,8 @@ int transport_dump_vpd_ident(
 			&vpd->device_identifier[0]);
 		break;
 	default:
-		sprintf(buf, "T10 VPD Device Identifier encoding unsupported:"
-			" 0x%02x", vpd->device_identifier_code_set);
+		sprintf(buf, "T10 VPD Device Identifier encoding unsupported: 0x%02x",
+			vpd->device_identifier_code_set);
 		ret = -EINVAL;
 		break;
 	}
@@ -1341,6 +1339,7 @@ target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev,
 			cmd->residual_count = (size - mtl);
 		} else if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) {
 			u32 orig_dl = size + cmd->residual_count;
+
 			cmd->residual_count = (orig_dl - mtl);
 		} else {
 			cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT;
@@ -1353,6 +1352,7 @@ target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev,
 		 */
 		if (cmd->prot_length) {
 			u32 sectors = (mtl / dev->dev_attrib.block_size);
+
 			cmd->prot_length = dev->prot_length * sectors;
 		}
 	}
drivers/target/target_core_user.c +6 -6
index 4e4c3fcb9ca8..5d4804b9f851 100644
@@ -260,8 +260,7 @@ static const struct kernel_param_ops tcmu_global_max_data_area_op = {
 	.get = tcmu_get_global_max_data_area,
 };
 
-module_param_cb(global_max_data_area_mb, &tcmu_global_max_data_area_op, NULL,
-		S_IWUSR | S_IRUGO);
+module_param_cb(global_max_data_area_mb, &tcmu_global_max_data_area_op, NULL, 0644);
 MODULE_PARM_DESC(global_max_data_area_mb,
 		 "Max MBs allowed to be allocated to all the tcmu device's "
 		 "data areas.");
@@ -297,7 +296,7 @@ static const struct kernel_param_ops tcmu_block_netlink_op = {
 	.get = tcmu_get_block_netlink,
 };
 
-module_param_cb(block_netlink, &tcmu_block_netlink_op, NULL, S_IWUSR | S_IRUGO);
+module_param_cb(block_netlink, &tcmu_block_netlink_op, NULL, 0644);
 MODULE_PARM_DESC(block_netlink, "Block new netlink commands.");
 
 static int tcmu_fail_netlink_cmd(struct tcmu_nl_cmd *nl_cmd)
@@ -349,7 +348,7 @@ static const struct kernel_param_ops tcmu_reset_netlink_op = {
 	.set = tcmu_set_reset_netlink,
 };
 
-module_param_cb(reset_netlink, &tcmu_reset_netlink_op, NULL, S_IWUSR);
+module_param_cb(reset_netlink, &tcmu_reset_netlink_op, NULL, 0200);
 MODULE_PARM_DESC(reset_netlink, "Reset netlink commands.");
 
 /* multicast group */
@@ -379,7 +378,7 @@ static int tcmu_genl_cmd_done(struct genl_info *info, int completed_cmd)
 	    !info->attrs[TCMU_ATTR_DEVICE_ID]) {
 		target_err("TCMU_ATTR_CMD_STATUS or TCMU_ATTR_DEVICE_ID not set, doing nothing\n");
 		return -EINVAL;
-        }
+	}
 
 	dev_id = nla_get_u32(info->attrs[TCMU_ATTR_DEVICE_ID]);
 	rc = nla_get_s32(info->attrs[TCMU_ATTR_CMD_STATUS]);
@@ -1360,7 +1359,7 @@ static bool tcmu_handle_completion(struct tcmu_cmd *cmd,
 
 	if (entry->rsp.scsi_status == SAM_STAT_CHECK_CONDITION) {
 		transport_copy_sense_to_cmd(se_cmd, entry->rsp.sense_buffer);
-		if (!read_len_valid )
+		if (!read_len_valid)
 			goto done;
 		else
 			se_cmd->se_cmd_flags |= SCF_TREAT_READ_AS_NORMAL;
@@ -1879,6 +1878,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)
 	vm_fault_t ret = 0;
 
 	int mi = tcmu_find_mem_index(vmf->vma);
+
 	if (mi < 0)
 		return VM_FAULT_SIGBUS;
 
drivers/target/target_core_xcopy.c +8 -8
index 23b4f75e74ea..2404572beb57 100644
@@ -30,7 +30,7 @@
 #include "target_core_ua.h"
 #include "target_core_xcopy.h"
 
-static struct workqueue_struct *xcopy_wq = NULL;
+static struct workqueue_struct *xcopy_wq;
 
 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop);
 
@@ -122,7 +122,7 @@ static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op
 	 * Extract RELATIVE INITIATOR PORT IDENTIFIER
 	 */
 	ript = get_unaligned_be16(&desc[2]);
-	target_debug("XCOPY 0xe4: RELATIVE INITIATOR PORT IDENTIFIER: %hu\n", ript);
+	target_debug("XCOPY 0xe4: RELATIVE INITIATOR PORT IDENTIFIER: %u\n", ript);
 	/*
 	 * Check for supported code set, association, and designator type
 	 */
@@ -215,7 +215,7 @@ static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd,
 		return -EINVAL;
 	}
 	if (tdll > RCR_OP_MAX_TARGET_DESC_COUNT * XCOPY_TARGET_DESC_LEN) {
-		target_err("XCOPY target descriptor supports a maximum two src/dest descriptors, tdll: %hu too large..\n",
+		target_err("XCOPY target descriptor supports a maximum two src/dest descriptors, tdll: %u too large..\n",
 			   tdll);
 		/* spc4r37 6.4.3.4 CSCD DESCRIPTOR LIST LENGTH field */
 		*sense_ret = TCM_TOO_MANY_TARGET_DESCS;
@@ -300,7 +300,7 @@ static int target_xcopy_parse_segdesc_02(struct xcopy_op *xop, unsigned char *p)
 
 	desc_len = get_unaligned_be16(&desc[2]);
 	if (desc_len != 0x18) {
-		target_err("XCOPY segment desc 0x02: Illegal desc_len: %hu\n", desc_len);
+		target_err("XCOPY segment desc 0x02: Illegal desc_len: %u\n", desc_len);
 		return -EINVAL;
 	}
 
@@ -309,7 +309,7 @@ static int target_xcopy_parse_segdesc_02(struct xcopy_op *xop, unsigned char *p)
 
 	if (xop->stdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX ||
 	    xop->dtdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX) {
-		target_err("XCOPY segment desc 0x02: unsupported CSCD ID > 0x%x; stdi: %hu dtdi: %hu\n",
+		target_err("XCOPY segment desc 0x02: unsupported CSCD ID > 0x%x; stdi: %u dtdi: %u\n",
 			   XCOPY_CSCD_DESC_ID_LIST_OFF_MAX, xop->stdi, xop->dtdi);
 		return -EINVAL;
 	}
@@ -320,7 +320,7 @@ static int target_xcopy_parse_segdesc_02(struct xcopy_op *xop, unsigned char *p)
 	xop->nolb = get_unaligned_be16(&desc[10]);
 	xop->src_lba = get_unaligned_be64(&desc[12]);
 	xop->dst_lba = get_unaligned_be64(&desc[20]);
-	target_debug("XCOPY seg desc 0x02: nolb: %hu src_lba: %llu dst_lba: %llu\n", xop->nolb,
+	target_debug("XCOPY seg desc 0x02: nolb: %u src_lba: %llu dst_lba: %llu\n", xop->nolb,
 		     (unsigned long long)xop->src_lba, (unsigned long long)xop->dst_lba);
 
 	return 0;
@@ -393,7 +393,7 @@ static struct se_node_acl xcopy_pt_nacl;
 
 static int xcopy_pt_get_cmd_state(struct se_cmd *se_cmd)
 {
-        return 0;
+	return 0;
 }
 
 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop)
@@ -813,7 +813,7 @@ static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop)
 	}
 
 	if (se_cmd->data_length < (XCOPY_HDR_LEN + tdll + sdll + inline_dl)) {
-		target_err("XCOPY parameter truncation: data length %u too small for tdll: %hu sdll: %u inline_dl: %u\n",
+		target_err("XCOPY parameter truncation: data length %u too small for tdll: %u sdll: %u inline_dl: %u\n",
 			   se_cmd->data_length, tdll, sdll, inline_dl);
 		ret = TCM_PARAMETER_LIST_LENGTH_ERROR;
 		goto out;
drivers/target/tcm_fc/tcm_fc.h +1 -1
index 00e5573c6296..5dacf917c3c5 100644
@@ -20,7 +20,7 @@ struct ft_transport_id {
 	__u8	__resvd1[7];
 	__u8	wwpn[8];
 	__u8	__resvd2[8];
-} __attribute__((__packed__));
+} __packed;
 
 /*
  * Session (remote port).
drivers/target/tcm_fc/tfc_conf.c +1 -1
index df2414b8c0cd..56b5e8947d1a 100644
@@ -37,7 +37,7 @@ static LIST_HEAD(ft_wwn_list);
 DEFINE_MUTEX(ft_lport_lock);
 
 unsigned int ft_debug_logging;
-module_param_named(debug_logging, ft_debug_logging, int, S_IRUGO|S_IWUSR);
+module_param_named(debug_logging, ft_debug_logging, int, 0644);
 MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
 
 /*
drivers/target/tcm_fc/tfc_sess.c +1 -0
index e69b6211886e..92748e94ec29 100644
@@ -231,6 +231,7 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id,
 					     sess, ft_sess_alloc_cb);
 	if (IS_ERR(sess->se_sess)) {
 		int rc = PTR_ERR(sess->se_sess);
+
 		kfree(sess);
 		sess = ERR_PTR(rc);
 	}
Signature · 1 line
2.40.3
#5 lore raw

PATCH 5/10 target: Add log prefix to all tcm files

In reply to Anastasia Kovaleva

Add prefix for wrapper to log the exact fabric.

This patch was made automatically by this zsh script:

........................................................................
dir="/path/to/kernel/src/drivers/target"
prefix=""

for file in $dir/**/*.c; do

        if [[ "$file" == *"tcm_fc"* ]]; then
                prefix="tcm_fc"
        elif [[ "$file" == *"cxgbit"* ]]; then
                prefix="cxgbit"
        elif [[ "$file" == *"loopback"* ]]; then
                prefix="loopback"
        elif [[ "$file" == *"sbp"* ]]; then
                prefix="sbp"
	elif [[ "$file" == *"iscsi_target_configfs"* ]]; then
		prefix="iscsi configfs"
	elif [[ "$file" == *"iscsi"* ]]; then
                prefix="iscsi"
        elif [[ "$file" == *"remote"* ]]; then
                prefix="remote"
        elif [[ "$file" == *"iblock"* ]]; then
                prefix="iblock"
        elif [[ "$file" == *"file"* ]]; then
                prefix="file"
        elif [[ "$file" == *"pscsi"* ]]; then
                prefix="pscsi"
        elif [[ "$file" == *"rd"* ]]; then
                prefix="rd"
	elif [[ "$file" == *"target_core_configfs"* ]]; then
		prefix="core configfs"
	elif [[ "$file" == *"core_xcopy"* ]]; then
		prefix="core xcopy"
	elif [[ "$file" == *"core_user"* ]]; then
		prefix="core user"
        else
                prefix="core"
        fi
        line="\n\n#define TARGET_PREFIX \"$prefix\""
        sed -i '/#include[^\n]*/,$!b;//{x;//p;g};//!H;$!d;x;s//&'"$line"'/' $file

done
........................................................................

You may not check it manually.

Note: Tne only place where I have manually added prefix is cxgbit_main.c because of #ifdef directive.

---
 drivers/target/iscsi/cxgbit/cxgbit_cm.c           | 2 ++
 drivers/target/iscsi/cxgbit/cxgbit_ddp.c          | 2 ++
 drivers/target/iscsi/cxgbit/cxgbit_main.c         | 2 ++
 drivers/target/iscsi/cxgbit/cxgbit_target.c       | 2 ++
 drivers/target/iscsi/iscsi_target.c               | 2 ++
 drivers/target/iscsi/iscsi_target_auth.c          | 2 ++
 drivers/target/iscsi/iscsi_target_configfs.c      | 2 ++
 drivers/target/iscsi/iscsi_target_datain_values.c | 2 ++
 drivers/target/iscsi/iscsi_target_device.c        | 2 ++
 drivers/target/iscsi/iscsi_target_erl0.c          | 2 ++
 drivers/target/iscsi/iscsi_target_erl1.c          | 2 ++
 drivers/target/iscsi/iscsi_target_erl2.c          | 2 ++
 drivers/target/iscsi/iscsi_target_login.c         | 2 ++
 drivers/target/iscsi/iscsi_target_nego.c          | 2 ++
 drivers/target/iscsi/iscsi_target_nodeattrib.c    | 2 ++
 drivers/target/iscsi/iscsi_target_parameters.c    | 2 ++
 drivers/target/iscsi/iscsi_target_seq_pdu_list.c  | 2 ++
 drivers/target/iscsi/iscsi_target_stat.c          | 2 ++
 drivers/target/iscsi/iscsi_target_tmr.c           | 2 ++
 drivers/target/iscsi/iscsi_target_tpg.c           | 2 ++
 drivers/target/iscsi/iscsi_target_transport.c     | 2 ++
 drivers/target/iscsi/iscsi_target_util.c          | 2 ++
 drivers/target/loopback/tcm_loop.c                | 2 ++
 drivers/target/sbp/sbp_target.c                   | 2 ++
 drivers/target/target_core_alua.c                 | 2 ++
 drivers/target/target_core_configfs.c             | 2 ++
 drivers/target/target_core_device.c               | 2 ++
 drivers/target/target_core_fabric_configfs.c      | 2 ++
 drivers/target/target_core_fabric_lib.c           | 2 ++
 drivers/target/target_core_file.c                 | 2 ++
 drivers/target/target_core_hba.c                  | 2 ++
 drivers/target/target_core_iblock.c               | 2 ++
 drivers/target/target_core_pr.c                   | 2 ++
 drivers/target/target_core_pscsi.c                | 2 ++
 drivers/target/target_core_rd.c                   | 2 ++
 drivers/target/target_core_sbc.c                  | 2 ++
 drivers/target/target_core_spc.c                  | 2 ++
 drivers/target/target_core_stat.c                 | 2 ++
 drivers/target/target_core_tmr.c                  | 2 ++
 drivers/target/target_core_tpg.c                  | 2 ++
 drivers/target/target_core_transport.c            | 2 ++
 drivers/target/target_core_ua.c                   | 2 ++
 drivers/target/target_core_user.c                 | 2 ++
 drivers/target/target_core_xcopy.c                | 2 ++
 drivers/target/tcm_fc/tfc_cmd.c                   | 2 ++
 drivers/target/tcm_fc/tfc_conf.c                  | 2 ++
 drivers/target/tcm_fc/tfc_io.c                    | 2 ++
 drivers/target/tcm_fc/tfc_sess.c                  | 2 ++
 drivers/target/tcm_remote/tcm_remote.c            | 2 ++
 49 files changed, 98 insertions(+)
drivers/target/iscsi/cxgbit/cxgbit_cm.c +2 -0
index 036e275de088..3d5445247f94 100644
@@ -25,6 +25,8 @@
 #include "cxgbit.h"
 #include "clip_tbl.h"
 
+#define TARGET_PREFIX "cxgbit"
+
 static void cxgbit_init_wr_wait(struct cxgbit_wr_wait *wr_waitp)
 {
 	wr_waitp->ret = 0;
drivers/target/iscsi/cxgbit/cxgbit_ddp.c +2 -0
index 3fd56f1484d8..e981f2175f98 100644
@@ -5,6 +5,8 @@
 
 #include "cxgbit.h"
 
+#define TARGET_PREFIX "cxgbit"
+
 static void
 cxgbit_set_one_ppod(struct cxgbi_pagepod *ppod,
 		    struct cxgbi_task_tag_info *ttinfo,
drivers/target/iscsi/cxgbit/cxgbit_main.c +2 -0
index 4e8097002679..4ab4b8a4c639 100644
@@ -14,6 +14,8 @@
 #include "cxgb4_dcb.h"
 #endif
 
+#define TARGET_PREFIX "cxgbit"
+
 LIST_HEAD(cdev_list_head);
 /* cdev list lock */
 DEFINE_MUTEX(cdev_list_lock);
drivers/target/iscsi/cxgbit/cxgbit_target.c +2 -0
index 826b951ed7c2..cff4bfb16810 100644
@@ -13,6 +13,8 @@
 #include <target/target_core_fabric.h>
 #include "cxgbit.h"
 
+#define TARGET_PREFIX "cxgbit"
+
 struct sge_opaque_hdr {
 	void *dev;
 	dma_addr_t addr[MAX_SKB_FRAGS + 1];
drivers/target/iscsi/iscsi_target.c +2 -0
index 0ad150d92805..c67ac066a7c9 100644
@@ -44,6 +44,8 @@
 
 #include <target/iscsi/iscsi_transport.h>
 
+#define TARGET_PREFIX "iscsi"
+
 static LIST_HEAD(g_tiqn_list);
 static LIST_HEAD(g_np_list);
 static DEFINE_SPINLOCK(tiqn_lock);
drivers/target/iscsi/iscsi_target_auth.c +2 -0
index 8308a1947605..509528c19dfe 100644
@@ -18,6 +18,8 @@
 #include "iscsi_target_nego.h"
 #include "iscsi_target_auth.h"
 
+#define TARGET_PREFIX "iscsi"
+
 static char *chap_get_digest_name(const int digest_type)
 {
 	switch (digest_type) {
drivers/target/iscsi/iscsi_target_configfs.c +2 -0
index c0f63c51a6cc..7082a7ef0a00 100644
@@ -28,6 +28,8 @@
 #include "iscsi_target.h"
 #include <target/iscsi/iscsi_target_stat.h>
 
+#define TARGET_PREFIX "iscsi configfs"
+
 
 /* Start items for lio_target_portal_cit */
 
drivers/target/iscsi/iscsi_target_datain_values.c +2 -0
index 57e887945de4..1f067841ff4a 100644
@@ -17,6 +17,8 @@
 #include "iscsi_target.h"
 #include "iscsi_target_datain_values.h"
 
+#define TARGET_PREFIX "iscsi"
+
 struct iscsi_datain_req *iscsit_allocate_datain_req(void)
 {
 	struct iscsi_datain_req *dr;
drivers/target/iscsi/iscsi_target_device.c +2 -0
index 466f27c93ca3..f197593ec641 100644
@@ -17,6 +17,8 @@
 #include "iscsi_target_tpg.h"
 #include "iscsi_target_util.h"
 
+#define TARGET_PREFIX "iscsi"
+
 void iscsit_determine_maxcmdsn(struct iscsit_session *sess)
 {
 	struct se_node_acl *se_nacl;
drivers/target/iscsi/iscsi_target_erl0.c +2 -0
index c34a04b7e91f..48cdb2ba971d 100644
@@ -23,6 +23,8 @@
 #include "iscsi_target_util.h"
 #include "iscsi_target.h"
 
+#define TARGET_PREFIX "iscsi"
+
 /*
  *	Used to set values in struct iscsit_cmd that iscsit_dataout_check_sequence()
  *	checks against to determine a PDU's Offset+Length is within the current
drivers/target/iscsi/iscsi_target_erl1.c +2 -0
index 91b36e46181d..88d5671666b2 100644
@@ -26,6 +26,8 @@
 #include "iscsi_target_erl2.h"
 #include "iscsi_target.h"
 
+#define TARGET_PREFIX "iscsi"
+
 #define OFFLOAD_BUF_SIZE	32768U
 
 /*
drivers/target/iscsi/iscsi_target_erl2.c +2 -0
index b28cf293b9be..aa8aef890ee2 100644
@@ -22,6 +22,8 @@
 #include "iscsi_target_erl2.h"
 #include "iscsi_target.h"
 
+#define TARGET_PREFIX "iscsi"
+
 /*
  *	FIXME: Does RData SNACK apply here as well?
  */
drivers/target/iscsi/iscsi_target_login.c +2 -0
index 1ba5af73aa01..c289c886231e 100644
@@ -35,6 +35,8 @@
 
 #include <target/iscsi/iscsi_transport.h>
 
+#define TARGET_PREFIX "iscsi"
+
 static struct iscsi_login *iscsi_login_init_conn(struct iscsit_conn *conn)
 {
 	struct iscsi_login *login;
drivers/target/iscsi/iscsi_target_nego.c +2 -0
index 523b780211b3..2af5ca83ab67 100644
@@ -28,6 +28,8 @@
 #include "iscsi_target.h"
 #include "iscsi_target_auth.h"
 
+#define TARGET_PREFIX "iscsi"
+
 #define MAX_LOGIN_PDUS  7
 
 void convert_null_to_semi(char *buf, int len)
drivers/target/iscsi/iscsi_target_nodeattrib.c +2 -0
index 7a2a92d7d7bb..59cf9809ec9d 100644
@@ -16,6 +16,8 @@
 #include "iscsi_target_util.h"
 #include "iscsi_target_nodeattrib.h"
 
+#define TARGET_PREFIX "iscsi"
+
 static inline char *iscsit_na_get_initiatorname(
 	struct iscsi_node_acl *nacl)
 {
drivers/target/iscsi/iscsi_target_parameters.c +2 -0
index 9c2c70de8d75..9eae01538696 100644
@@ -14,6 +14,8 @@
 #include "iscsi_target_util.h"
 #include "iscsi_target_parameters.h"
 
+#define TARGET_PREFIX "iscsi"
+
 int iscsi_login_rx_data(
 	struct iscsit_conn *conn,
 	char *buf,
drivers/target/iscsi/iscsi_target_seq_pdu_list.c +2 -0
index e60d69199504..4194935b7aa6 100644
@@ -17,6 +17,8 @@
 #include "iscsi_target_tpg.h"
 #include "iscsi_target_seq_pdu_list.h"
 
+#define TARGET_PREFIX "iscsi"
+
 #ifdef DEBUG
 static void iscsit_dump_seq_list(struct iscsit_cmd *cmd)
 {
drivers/target/iscsi/iscsi_target_stat.c +2 -0
index 367c6468b8e1..91f8e1f6f912 100644
@@ -21,6 +21,8 @@
 #include "iscsi_target_util.h"
 #include <target/iscsi/iscsi_target_stat.h>
 
+#define TARGET_PREFIX "iscsi"
+
 #ifndef INITIAL_JIFFIES
 #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
 #endif
drivers/target/iscsi/iscsi_target_tmr.c +2 -0
index 0382ec46c68d..eda3622e2437 100644
@@ -27,6 +27,8 @@
 #include "iscsi_target_util.h"
 #include "iscsi_target.h"
 
+#define TARGET_PREFIX "iscsi"
+
 u8 iscsit_tmr_abort_task(
 	struct iscsit_cmd *cmd,
 	unsigned char *buf)
drivers/target/iscsi/iscsi_target_tpg.c +2 -0
index 566132ab601e..c18f368976ac 100644
@@ -22,6 +22,8 @@
 
 #include <target/iscsi/iscsi_transport.h>
 
+#define TARGET_PREFIX "iscsi"
+
 struct iscsi_portal_group *iscsit_alloc_portal_group(struct iscsi_tiqn *tiqn, u16 tpgt)
 {
 	struct iscsi_portal_group *tpg;
drivers/target/iscsi/iscsi_target_transport.c +2 -0
index 0658388e9518..8896e4b08753 100644
@@ -4,6 +4,8 @@
 #include <linux/module.h>
 #include <target/iscsi/iscsi_transport.h>
 
+#define TARGET_PREFIX "iscsi"
+
 static LIST_HEAD(g_transport_list);
 static DEFINE_MUTEX(transport_mutex);
 
drivers/target/iscsi/iscsi_target_util.c +2 -0
index 04eb268b9bc9..01d74ae5fa96 100644
@@ -28,6 +28,8 @@
 #include "iscsi_target_util.h"
 #include "iscsi_target.h"
 
+#define TARGET_PREFIX "iscsi"
+
 extern struct list_head g_tiqn_list;
 extern spinlock_t tiqn_lock;
 
drivers/target/loopback/tcm_loop.c +2 -0
index 0664c09de0b8..6d0e7be756d7 100644
@@ -37,6 +37,8 @@
 
 #include "tcm_loop.h"
 
+#define TARGET_PREFIX "loopback"
+
 #define to_tcm_loop_hba(hba)	container_of(hba, struct tcm_loop_hba, dev)
 
 static struct kmem_cache *tcm_loop_cmd_cache;
drivers/target/sbp/sbp_target.c +2 -0
index 4d551eefa4a6..868ddda4dcf3 100644
@@ -27,6 +27,8 @@
 
 #include "sbp_target.h"
 
+#define TARGET_PREFIX "sbp"
+
 /* FireWire address region for management and command block address handlers */
 static const struct fw_address_region sbp_register_region = {
 	.start	= CSR_REGISTER_BASE + 0x10000,
drivers/target/target_core_alua.c +2 -0
index 1caddbc73631..00900189a00d 100644
@@ -29,6 +29,8 @@
 #include "target_core_alua.h"
 #include "target_core_ua.h"
 
+#define TARGET_PREFIX "core"
+
 static sense_reason_t core_alua_check_transition(int state, int valid,
 						 int *primary, int explicit);
 static int core_alua_set_tg_pt_secondary_state(
drivers/target/target_core_configfs.c +2 -0
index c30a8687e4c3..aaef72e44b7b 100644
@@ -40,6 +40,8 @@
 #include "target_core_rd.h"
 #include "target_core_xcopy.h"
 
+#define TARGET_PREFIX "core configfs"
+
 #define TB_CIT_SETUP(_name, _item_ops, _group_ops, _attrs)		\
 static void target_core_setup_##_name##_cit(struct target_backend *tb)	\
 {									\
drivers/target/target_core_device.c +2 -0
index ea94ceabfadb..1d54579ecca2 100644
@@ -36,6 +36,8 @@
 #include "target_core_pr.h"
 #include "target_core_ua.h"
 
+#define TARGET_PREFIX "core"
+
 static DEFINE_MUTEX(device_mutex);
 static DEFINE_IDR(devices_idr);
 
drivers/target/target_core_fabric_configfs.c +2 -0
index f4db86c41790..dec8f25c04d0 100644
@@ -34,6 +34,8 @@
 #include "target_core_alua.h"
 #include "target_core_pr.h"
 
+#define TARGET_PREFIX "core"
+
 #define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs)		\
 static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \
 {									\
drivers/target/target_core_fabric_lib.c +2 -0
index 36b6301808fe..b22b9448f027 100644
@@ -31,6 +31,8 @@
 #include "target_core_internal.h"
 #include "target_core_pr.h"
 
+#define TARGET_PREFIX "core"
+
 
 static int sas_get_pr_transport_id(
 	struct se_node_acl *nacl,
drivers/target/target_core_file.c +2 -0
index 902e68447c24..fd3719cac493 100644
@@ -29,6 +29,8 @@
 
 #include "target_core_file.h"
 
+#define TARGET_PREFIX "file"
+
 static inline struct fd_dev *FD_DEV(struct se_device *dev)
 {
 	return container_of(dev, struct fd_dev, dev);
drivers/target/target_core_hba.c +2 -0
index 0edb17711a52..48dab83e5be3 100644
@@ -26,6 +26,8 @@
 
 #include "target_core_internal.h"
 
+#define TARGET_PREFIX "core"
+
 static LIST_HEAD(backend_list);
 static DEFINE_MUTEX(backend_mutex);
 
drivers/target/target_core_iblock.c +2 -0
index 60a07baa9729..8d71a0f5033e 100644
@@ -34,6 +34,8 @@
 #include "target_core_iblock.h"
 #include "target_core_pr.h"
 
+#define TARGET_PREFIX "iblock"
+
 #define IBLOCK_MAX_BIO_PER_TASK	 32	/* max # of bios to submit at a time */
 #define IBLOCK_BIO_POOL_SIZE	128
 
drivers/target/target_core_pr.c +2 -0
index 8b97beffbf64..879624812573 100644
@@ -29,6 +29,8 @@
 #include "target_core_pr.h"
 #include "target_core_ua.h"
 
+#define TARGET_PREFIX "core"
+
 /*
  * Used for Specify Initiator Ports Capable Bit (SPEC_I_PT)
  */
drivers/target/target_core_pscsi.c +2 -0
index 4f300d366edc..24e080254c6f 100644
@@ -33,6 +33,8 @@
 #include "target_core_internal.h"
 #include "target_core_pscsi.h"
 
+#define TARGET_PREFIX "pscsi"
+
 static inline struct pscsi_dev_virt *PSCSI_DEV(struct se_device *dev)
 {
 	return container_of(dev, struct pscsi_dev_virt, dev);
drivers/target/target_core_rd.c +2 -0
index cd14fcb4b0f8..6e3547847bcc 100644
@@ -25,6 +25,8 @@
 
 #include "target_core_rd.h"
 
+#define TARGET_PREFIX "rd"
+
 static inline struct rd_dev *RD_DEV(struct se_device *dev)
 {
 	return container_of(dev, struct rd_dev, dev);
drivers/target/target_core_sbc.c +2 -0
index 37164a9f7d32..86b9a0bc6e90 100644
@@ -24,6 +24,8 @@
 #include "target_core_ua.h"
 #include "target_core_alua.h"
 
+#define TARGET_PREFIX "core"
+
 static sense_reason_t
 sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool);
 static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd);
drivers/target/target_core_spc.c +2 -0
index 671d0e3122e6..ce59b5f02ef0 100644
@@ -25,6 +25,8 @@
 #include "target_core_ua.h"
 #include "target_core_xcopy.h"
 
+#define TARGET_PREFIX "core"
+
 static void spc_fill_alua_data(struct se_lun *lun, unsigned char *buf)
 {
 	struct t10_alua_tg_pt_gp *tg_pt_gp;
drivers/target/target_core_stat.c +2 -0
index b0495d87e951..62daf04865c4 100644
@@ -27,6 +27,8 @@
 
 #include "target_core_internal.h"
 
+#define TARGET_PREFIX "core"
+
 #ifndef INITIAL_JIFFIES
 #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
 #endif
drivers/target/target_core_tmr.c +2 -0
index 0a5a09d63b48..db3b0467105d 100644
@@ -23,6 +23,8 @@
 #include "target_core_alua.h"
 #include "target_core_pr.h"
 
+#define TARGET_PREFIX "core"
+
 int core_tmr_alloc_req(
 	struct se_cmd *se_cmd,
 	void *fabric_tmr_ptr,
drivers/target/target_core_tpg.c +2 -0
index 5af85cd960ef..3f0b53032aeb 100644
@@ -30,6 +30,8 @@
 #include "target_core_pr.h"
 #include "target_core_ua.h"
 
+#define TARGET_PREFIX "core"
+
 extern struct se_device *g_lun0_dev;
 static DEFINE_XARRAY_ALLOC(tpg_xa);
 
drivers/target/target_core_transport.c +2 -0
index 3d6d0e525bd0..13fddd94a792 100644
@@ -40,6 +40,8 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/target.h>
 
+#define TARGET_PREFIX "core"
+
 static struct workqueue_struct *target_completion_wq;
 static struct workqueue_struct *target_submission_wq;
 static struct kmem_cache *se_sess_cache;
drivers/target/target_core_ua.c +2 -0
index faa7a3ffec68..11d50a1da03c 100644
@@ -22,6 +22,8 @@
 #include "target_core_pr.h"
 #include "target_core_ua.h"
 
+#define TARGET_PREFIX "core"
+
 sense_reason_t
 target_scsi3_ua_check(struct se_cmd *cmd)
 {
drivers/target/target_core_user.c +2 -0
index 5d4804b9f851..c8f66ef7411b 100644
@@ -30,6 +30,8 @@
 
 #include <linux/target_core_user.h>
 
+#define TARGET_PREFIX "core user"
+
 /**
  * DOC: Userspace I/O
  * Userspace I/O
drivers/target/target_core_xcopy.c +2 -0
index 2404572beb57..971299330a98 100644
@@ -30,6 +30,8 @@
 #include "target_core_ua.h"
 #include "target_core_xcopy.h"
 
+#define TARGET_PREFIX "core xcopy"
+
 static struct workqueue_struct *xcopy_wq;
 
 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop);
drivers/target/tcm_fc/tfc_cmd.c +2 -0
index 2372f08b91c3..ad494b36d503 100644
@@ -25,6 +25,8 @@
 
 #include "tcm_fc.h"
 
+#define TARGET_PREFIX "tcm_fc"
+
 /*
  * Dump cmd state for debugging.
  */
drivers/target/tcm_fc/tfc_conf.c +2 -0
index 56b5e8947d1a..2fd6ed19fbf9 100644
@@ -33,6 +33,8 @@
 
 #include "tcm_fc.h"
 
+#define TARGET_PREFIX "tcm_fc"
+
 static LIST_HEAD(ft_wwn_list);
 DEFINE_MUTEX(ft_lport_lock);
 
drivers/target/tcm_fc/tfc_io.c +2 -0
index 852c2bccf759..bfee5d9bfd87 100644
@@ -34,6 +34,8 @@
 
 #include "tcm_fc.h"
 
+#define TARGET_PREFIX "tcm_fc"
+
 /*
  * Deliver read data back to initiator.
  * XXX TBD handle resource problems later.
drivers/target/tcm_fc/tfc_sess.c +2 -0
index 92748e94ec29..725a3b0c9568 100644
@@ -27,6 +27,8 @@
 
 #include "tcm_fc.h"
 
+#define TARGET_PREFIX "tcm_fc"
+
 #define TFC_SESS_DBG(lport, fmt, args...) \
 	target_debug("host%u: rport %6.6x: " fmt, (lport)->host->host_no, (lport)->port_id, ##args)
 
drivers/target/tcm_remote/tcm_remote.c +2 -0
index fe88c27f1b58..b978b831c6c1 100644
@@ -17,6 +17,8 @@
 
 #include "tcm_remote.h"
 
+#define TARGET_PREFIX "remote"
+
 static inline struct tcm_remote_tpg *remote_tpg(struct se_portal_group *se_tpg)
 {
 	return container_of(se_tpg, struct tcm_remote_tpg, remote_se_tpg);
Signature · 1 line
2.40.3
#6 lore raw

PATCH 6/10 target: Remove old prefixes from log messages

In reply to Anastasia Kovaleva

If TARGET_PREFIX macro doesn't contain some information that the old prefix had (like in tcm_remote.c, tcm_loop.c, target_core_alua.c etc.), then remove the repeated prefix parts and unify prefix format:

sed -i 's/TCM_(Loop|Remote)_ConfigFS/configfs/g' drivers/target/**/*.c
sed -i 's/Target_Core_ConfigFS/configfs/g' drivers/target/target_core_alua.c
sed -i 's/CORE\[0\] -/\[0\]:/g' drivers/target/iscsi/iscsi_target.c drivers/target/iscsi/iscsi_target_tpg.c sed -i 's/LIO-CORE\[0\]/\[0\]:/g' drivers/target/iscsi/iscsi_target_configfs.c
sed -i -E 's/(target_.*[(]\").*(\[.*\]_)TPG(\[.*\]) -/\1\2tpg\3:/g' drivers/target/iscsi/iscsi_target_tpg.c sed -i -E 's/(target_.*[(]\").*iSCSI_TPG(\[.*\]) -/\1tpg\2:/g' drivers/target/iscsi/iscsi_target_tpg.c sed -i -E 's/(target_.*[(]\")CORE(\[.*\]) -/\1\2:/g' drivers/target/iscsi/iscsi_target_tpg.c

If new prefixes fully cover old prefixes' information, then remove the old prefixes:

........................................................................
dir="/home/a.kovaleva/work/scsi/drivers/target"

old_prefix=("FILEIO: " "IBLOCK: " "PSCSI: " "pSCSI: " "RAMDISK: " \
	    "TCM: " "TCMU: " "tcmu: " "XCOPY: " \
	    "Target_Core_ConfigFS: " "LIO_Target_ConfigFS: " \
	    "tcm_fc: ")

for file in $dir/**/*.{c,h}; do

    for prfx in ${old_prefix[@]}; do
        sed -i -E "s/(target_.*[(]\")$prfx/\1/g" $file
    done

done
........................................................................

You may not check it manually.

---
 drivers/target/iscsi/iscsi_target.c          |  8 +--
 drivers/target/iscsi/iscsi_target_configfs.c | 29 +++++-----
 drivers/target/iscsi/iscsi_target_tpg.c      | 36 ++++++------
 drivers/target/loopback/tcm_loop.c           |  4 +-
 drivers/target/target_core_alua.c            |  4 +-
 drivers/target/target_core_configfs.c        | 59 ++++++++------------
 drivers/target/target_core_file.c            | 26 ++++-----
 drivers/target/target_core_hba.c             |  3 +-
 drivers/target/target_core_iblock.c          | 12 ++--
 drivers/target/target_core_pscsi.c           | 37 ++++++------
 drivers/target/target_core_rd.c              |  7 +--
 drivers/target/target_core_user.c            | 12 ++--
 drivers/target/target_core_xcopy.c           | 15 +++--
 drivers/target/tcm_fc/tfc_conf.c             |  2 +-
 drivers/target/tcm_remote/tcm_remote.c       | 12 ++--
 15 files changed, 124 insertions(+), 142 deletions(-)
drivers/target/iscsi/iscsi_target.c +4 -4
index c67ac066a7c9..7d157d3f84a8 100644
@@ -154,7 +154,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf)
 	spin_unlock(&tiqn_lock);
 	idr_preload_end();
 
-	target_debug("CORE[0] - Added iSCSI Target IQN: %s\n", tiqn->tiqn);
+	target_debug("[0]: Added iSCSI Target IQN: %s\n", tiqn->tiqn);
 
 	return tiqn;
 
@@ -194,7 +194,7 @@ void iscsit_del_tiqn(struct iscsi_tiqn *tiqn)
 	idr_remove(&tiqn_idr, tiqn->tiqn_index);
 	spin_unlock(&tiqn_lock);
 
-	target_debug("CORE[0] - Deleted iSCSI Target IQN: %s\n", tiqn->tiqn);
+	target_debug("[0]: Deleted iSCSI Target IQN: %s\n", tiqn->tiqn);
 	kfree(tiqn);
 }
 
@@ -392,7 +392,7 @@ struct iscsi_np *iscsit_add_np(
 	list_add_tail(&np->np_list, &g_np_list);
 	mutex_unlock(&np_lock);
 
-	target_debug("CORE[0] - Added Network Portal: %pISpc on %s\n", &np->np_sockaddr,
+	target_debug("[0]: Added Network Portal: %pISpc on %s\n", &np->np_sockaddr,
 		     np->np_transport->name);
 
 	return np;
@@ -463,7 +463,7 @@ int iscsit_del_np(struct iscsi_np *np)
 	list_del(&np->np_list);
 	mutex_unlock(&np_lock);
 
-	target_debug("CORE[0] - Removed Network Portal: %pISpc on %s\n", &np->np_sockaddr,
+	target_debug("[0]: Removed Network Portal: %pISpc on %s\n", &np->np_sockaddr,
 		     np->np_transport->name);
 
 	iscsit_put_transport(np->np_transport);
drivers/target/iscsi/iscsi_target_configfs.c +14 -15
index 7082a7ef0a00..14c95c38d002 100644
@@ -212,7 +212,7 @@ static struct se_tpg_np *lio_target_call_addnptotpg(
 	if (ret < 0)
 		return ERR_PTR(-EINVAL);
 
-	target_debug("LIO_Target_ConfigFS: REGISTER -> %s TPGT: %u PORTAL: %s\n",
+	target_debug("REGISTER -> %s TPGT: %u PORTAL: %s\n",
 		     config_item_name(&se_tpg->se_tpg_wwn->wwn_group.cg_item), tpg->tpgt, name);
 	/*
 	 * Assume ISCSI_TCP by default.  Other network portals for other
@@ -233,7 +233,7 @@ static struct se_tpg_np *lio_target_call_addnptotpg(
 		iscsit_put_tpg(tpg);
 		return ERR_CAST(tpg_np);
 	}
-	target_debug("LIO_Target_ConfigFS: addnptotpg done!\n");
+	target_debug("addnptotpg done!\n");
 
 	iscsit_put_tpg(tpg);
 	return &tpg_np->se_tpg_np;
@@ -254,7 +254,7 @@ static void lio_target_call_delnpfromtpg(
 		return;
 
 	se_tpg = &tpg->tpg_se_tpg;
-	target_debug("LIO_Target_ConfigFS: DEREGISTER -> %s TPGT: %u PORTAL: %pISpc\n",
+	target_debug("DEREGISTER -> %s TPGT: %u PORTAL: %pISpc\n",
 		     config_item_name(&se_tpg->se_tpg_wwn->wwn_group.cg_item), tpg->tpgt,
 		     &tpg_np->tpg_np->np_sockaddr);
 
@@ -262,7 +262,7 @@ static void lio_target_call_delnpfromtpg(
 	if (ret < 0)
 		goto out;
 
-	target_debug("LIO_Target_ConfigFS: delnpfromtpg done!\n");
+	target_debug("delnpfromtpg done!\n");
 out:
 	iscsit_put_tpg(tpg);
 }
@@ -678,9 +678,8 @@ static ssize_t lio_target_nacl_cmdsn_depth_store(struct config_item *item,
 
 	ret = core_tpg_set_initiator_node_queue_depth(se_nacl, cmdsn_depth);
 
-	target_debug("LIO_Target_ConfigFS: %s/%s Set CmdSN Window: %u for InitiatorName: %s\n",
-		     config_item_name(wwn_ci), config_item_name(tpg_ci), cmdsn_depth,
-		     config_item_name(acl_ci));
+	target_debug("%s/%s Set CmdSN Window: %u for InitiatorName: %s\n", config_item_name(wwn_ci),
+		     config_item_name(tpg_ci), cmdsn_depth, config_item_name(acl_ci));
 
 	iscsit_put_tpg(tpg);
 	return (!ret) ? count : (ssize_t)ret;
@@ -1066,8 +1065,8 @@ static struct se_portal_group *lio_target_tiqn_addtpg(struct se_wwn *wwn,
 	if (ret != 0)
 		goto out;
 
-	target_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn);
-	target_debug("LIO_Target_ConfigFS: REGISTER -> Allocated TPG: %s\n", name);
+	target_debug("REGISTER -> %s\n", tiqn->tiqn);
+	target_debug("REGISTER -> Allocated TPG: %s\n", name);
 	return &tpg->tpg_se_tpg;
 out:
 	core_tpg_deregister(&tpg->tpg_se_tpg);
@@ -1116,7 +1115,7 @@ static void lio_target_tiqn_deltpg(struct se_portal_group *se_tpg)
 	/*
 	 * iscsit_tpg_del_portal_group() assumes force=1
 	 */
-	target_debug("LIO_Target_ConfigFS: DEREGISTER -> Releasing TPG\n");
+	target_debug("DEREGISTER -> Releasing TPG\n");
 	iscsit_tpg_del_portal_group(tiqn, tpg, 1);
 }
 
@@ -1184,8 +1183,8 @@ static struct se_wwn *lio_target_call_coreaddtiqn(
 	if (IS_ERR(tiqn))
 		return ERR_CAST(tiqn);
 
-	target_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn);
-	target_debug("LIO_Target_ConfigFS: REGISTER -> Allocated Node: %s\n", name);
+	target_debug("REGISTER -> %s\n", tiqn->tiqn);
+	target_debug("REGISTER -> Allocated Node: %s\n", name);
 	return &tiqn->tiqn_wwn;
 }
 
@@ -1224,7 +1223,7 @@ static void lio_target_call_coredeltiqn(
 {
 	struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn);
 
-	target_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n", tiqn->tiqn);
+	target_debug("DEREGISTER -> %s\n", tiqn->tiqn);
 	iscsit_del_tiqn(tiqn);
 }
 
@@ -1308,7 +1307,7 @@ static ssize_t iscsi_disc_enforce_discovery_auth_store(struct config_item *item,
 
 		discovery_tpg->tpg_attrib.authentication = 1;
 		iscsit_global->discovery_acl.node_auth.enforce_discovery_auth = 1;
-		target_debug("LIO-CORE[0] Successfully enabled authentication enforcement for iSCSI Discovery TPG\n");
+		target_debug("[0]: Successfully enabled authentication enforcement for iSCSI Discovery TPG\n");
 	} else {
 		/*
 		 * Reset the AuthMethod key to CHAP,None
@@ -1318,7 +1317,7 @@ static ssize_t iscsi_disc_enforce_discovery_auth_store(struct config_item *item,
 
 		discovery_tpg->tpg_attrib.authentication = 0;
 		iscsit_global->discovery_acl.node_auth.enforce_discovery_auth = 0;
-		target_debug("LIO-CORE[0] Successfully disabled authentication enforcement for iSCSI Discovery TPG\n");
+		target_debug("[0]: Successfully disabled authentication enforcement for iSCSI Discovery TPG\n");
 	}
 
 	return count;
drivers/target/iscsi/iscsi_target_tpg.c +18 -18
index c18f368976ac..2067c6facb09 100644
@@ -96,7 +96,7 @@ int iscsit_load_discovery_tpg(void)
 	spin_unlock(&tpg->tpg_state_lock);
 
 	iscsit_global->discovery_tpg = tpg;
-	target_debug("CORE[0] - Allocated Discovery TPG\n");
+	target_debug("[0]: Allocated Discovery TPG\n");
 
 	return 0;
 free_pl_out:
@@ -247,7 +247,7 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_gro
 	spin_lock(&tiqn->tiqn_tpg_lock);
 	list_add_tail(&tpg->tpg_list, &tiqn->tiqn_tpg_list);
 	tiqn->tiqn_ntpgs++;
-	target_debug("CORE[%s]_TPG[%u] - Added iSCSI Target Portal Group\n", tiqn->tiqn, tpg->tpgt);
+	target_debug("[%s]_tpg[%u]: Added iSCSI Target Portal Group\n", tiqn->tiqn, tpg->tpgt);
 	spin_unlock(&tiqn->tiqn_tpg_lock);
 
 	return 0;
@@ -293,7 +293,7 @@ int iscsit_tpg_del_portal_group(
 	list_del(&tpg->tpg_list);
 	spin_unlock(&tiqn->tiqn_tpg_lock);
 
-	target_debug("CORE[%s]_TPG[%u] - Deleted iSCSI Target Portal Group\n", tiqn->tiqn,
+	target_debug("[%s]_tpg[%u]: Deleted iSCSI Target Portal Group\n", tiqn->tiqn,
 		     tpg->tpgt);
 
 	kfree(tpg);
@@ -338,7 +338,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
 
 	spin_lock(&tiqn->tiqn_tpg_lock);
 	tiqn->tiqn_active_tpgs++;
-	target_debug("iSCSI_TPG[%u] - Enabled iSCSI Target Portal Group\n", tpg->tpgt);
+	target_debug("tpg[%u]: Enabled iSCSI Target Portal Group\n", tpg->tpgt);
 	spin_unlock(&tiqn->tiqn_tpg_lock);
 
 	return 0;
@@ -379,7 +379,7 @@ int iscsit_tpg_disable_portal_group(struct iscsi_portal_group *tpg, int force)
 
 	spin_lock(&tiqn->tiqn_tpg_lock);
 	tiqn->tiqn_active_tpgs--;
-	target_debug("iSCSI_TPG[%u] - Disabled iSCSI Target Portal Group\n", tpg->tpgt);
+	target_debug("tpg[%u]: Disabled iSCSI Target Portal Group\n", tpg->tpgt);
 	spin_unlock(&tiqn->tiqn_tpg_lock);
 
 	return 0;
@@ -501,7 +501,7 @@ struct iscsi_tpg_np *iscsit_tpg_add_network_portal(
 		spin_unlock(&tpg_np_parent->tpg_np_parent_lock);
 	}
 
-	target_debug("CORE[%s] - Added Network Portal: %pISpc,%hu on %s\n", tpg->tpg_tiqn->tiqn,
+	target_debug("[%s]: Added Network Portal: %pISpc,%hu on %s\n", tpg->tpg_tiqn->tiqn,
 		     &np->np_sockaddr, tpg->tpgt, np->np_transport->name);
 
 	return tpg_np;
@@ -514,7 +514,7 @@ static int iscsit_tpg_release_np(
 {
 	iscsit_clear_tpg_np_login_thread(tpg_np, tpg, true);
 
-	target_debug("CORE[%s] - Removed Network Portal: %pISpc,%u on %s\n", tpg->tpg_tiqn->tiqn,
+	target_debug("[%s]: Removed Network Portal: %pISpc,%u on %s\n", tpg->tpg_tiqn->tiqn,
 		     &np->np_sockaddr, tpg->tpgt, np->np_transport->name);
 
 	tpg_np->tpg_np = NULL;
@@ -668,7 +668,7 @@ int iscsit_ta_generate_node_acls(
 	}
 
 	a->generate_node_acls = flag;
-	target_debug("iSCSI_TPG[%u] - Generate Initiator Portal Group ACLs: %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: Generate Initiator Portal Group ACLs: %s\n", tpg->tpgt,
 		     (a->generate_node_acls) ? "Enabled" : "Disabled");
 
 	if (flag == 1 && a->cache_dynamic_acls == 0) {
@@ -696,7 +696,7 @@ int iscsit_ta_default_cmdsn_depth(
 	}
 
 	a->default_cmdsn_depth = tcq_depth;
-	target_debug("iSCSI_TPG[%u] - Set Default CmdSN TCQ Depth to %u\n", tpg->tpgt,
+	target_debug("tpg[%u]: Set Default CmdSN TCQ Depth to %u\n", tpg->tpgt,
 		     a->default_cmdsn_depth);
 
 	return 0;
@@ -719,7 +719,7 @@ int iscsit_ta_cache_dynamic_acls(
 	}
 
 	a->cache_dynamic_acls = flag;
-	target_debug("iSCSI_TPG[%u] - Cache Dynamic Initiator Portal Group ACLs %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: Cache Dynamic Initiator Portal Group ACLs %s\n", tpg->tpgt,
 		     (a->cache_dynamic_acls) ? "Enabled" : "Disabled");
 
 	return 0;
@@ -737,7 +737,7 @@ int iscsit_ta_demo_mode_write_protect(
 	}
 
 	a->demo_mode_write_protect = flag;
-	target_debug("iSCSI_TPG[%u] - Demo Mode Write Protect bit: %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: Demo Mode Write Protect bit: %s\n", tpg->tpgt,
 		     (a->demo_mode_write_protect) ? "ON" : "OFF");
 
 	return 0;
@@ -755,7 +755,7 @@ int iscsit_ta_prod_mode_write_protect(
 	}
 
 	a->prod_mode_write_protect = flag;
-	target_debug("iSCSI_TPG[%u] - Production Mode Write Protect bit: %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: Production Mode Write Protect bit: %s\n", tpg->tpgt,
 		     (a->prod_mode_write_protect) ? "ON" : "OFF");
 
 	return 0;
@@ -773,7 +773,7 @@ int iscsit_ta_demo_mode_discovery(
 	}
 
 	a->demo_mode_discovery = flag;
-	target_debug("iSCSI_TPG[%u] - Demo Mode Discovery bit: %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: Demo Mode Discovery bit: %s\n", tpg->tpgt,
 		     (a->demo_mode_discovery) ? "ON" : "OFF");
 
 	return 0;
@@ -791,7 +791,7 @@ int iscsit_ta_default_erl(
 	}
 
 	a->default_erl = default_erl;
-	target_debug("iSCSI_TPG[%u] - DefaultERL: %u\n", tpg->tpgt, a->default_erl);
+	target_debug("tpg[%u]: DefaultERL: %u\n", tpg->tpgt, a->default_erl);
 
 	return 0;
 }
@@ -808,7 +808,7 @@ int iscsit_ta_t10_pi(
 	}
 
 	a->t10_pi = flag;
-	target_debug("iSCSI_TPG[%u] - T10 Protection information bit: %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: T10 Protection information bit: %s\n", tpg->tpgt,
 		     (a->t10_pi) ? "ON" : "OFF");
 
 	return 0;
@@ -826,7 +826,7 @@ int iscsit_ta_fabric_prot_type(
 	}
 
 	a->fabric_prot_type = prot_type;
-	target_debug("iSCSI_TPG[%u] - T10 Fabric Protection Type: %u\n", tpg->tpgt, prot_type);
+	target_debug("tpg[%u]: T10 Fabric Protection Type: %u\n", tpg->tpgt, prot_type);
 
 	return 0;
 }
@@ -843,7 +843,7 @@ int iscsit_ta_tpg_enabled_sendtargets(
 	}
 
 	a->tpg_enabled_sendtargets = flag;
-	target_debug("iSCSI_TPG[%u] - TPG enabled bit required for SendTargets: %s\n", tpg->tpgt,
+	target_debug("tpg[%u]: TPG enabled bit required for SendTargets: %s\n", tpg->tpgt,
 		     (a->tpg_enabled_sendtargets) ? "ON" : "OFF");
 
 	return 0;
@@ -861,7 +861,7 @@ int iscsit_ta_login_keys_workaround(
 	}
 
 	a->login_keys_workaround = flag;
-	target_debug("iSCSI_TPG[%u] - TPG enabled bit for login keys workaround: %s ", tpg->tpgt,
+	target_debug("tpg[%u]: TPG enabled bit for login keys workaround: %s ", tpg->tpgt,
 		     (a->login_keys_workaround) ? "ON" : "OFF");
 
 	return 0;
drivers/target/loopback/tcm_loop.c +2 -2
index 6d0e7be756d7..7b4c3b1ae16d 100644
@@ -592,7 +592,7 @@ static int tcm_loop_port_link(
 	 */
 	scsi_add_device(tl_hba->sh, 0, tl_tpg->tl_tpgt, lun->unpacked_lun);
 
-	target_debug("TCM_Loop_ConfigFS: Port Link Successful\n");
+	target_debug("configfs: Port Link Successful\n");
 	return 0;
 }
 
@@ -622,7 +622,7 @@ static void tcm_loop_port_unlink(
 
 	atomic_dec_mb(&tl_tpg->tl_tpg_port_count);
 
-	target_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n");
+	target_debug("configfs: Port Unlink Successful\n");
 }
 
 /* End items for tcm_loop_port_cit */
drivers/target/target_core_alua.c +2 -2
index 00900189a00d..fd91a2a3b120 100644
@@ -1928,7 +1928,7 @@ ssize_t core_alua_store_tg_pt_gp_info(
 		 * with the default_tg_pt_gp.
 		 */
 		if (!tg_pt_gp_new) {
-			target_debug("Target_Core_ConfigFS: Moving %s/tpgt_%u/%s from ALUA Target Port Group: alua/%s, ID: %u back to default_tg_pt_gp\n",
+			target_debug("configfs: Moving %s/tpgt_%u/%s from ALUA Target Port Group: alua/%s, ID: %u back to default_tg_pt_gp\n",
 				     tpg->se_tpg_tfo->tpg_get_wwn(tpg),
 				     tpg->se_tpg_tfo->tpg_get_tag(tpg),
 				     config_item_name(&lun->lun_group.cg_item),
@@ -1946,7 +1946,7 @@ ssize_t core_alua_store_tg_pt_gp_info(
 
 	target_swap_tg_pt_gp(lun, tg_pt_gp, tg_pt_gp_new);
 	spin_unlock(&lun->lun_tg_pt_gp_lock);
-	target_debug("Target_Core_ConfigFS: %s %s/tpgt_%u/%s to ALUA Target Port Group: alua/%s, ID: %u\n",
+	target_debug("configfs: %s %s/tpgt_%u/%s to ALUA Target Port Group: alua/%s, ID: %u\n",
 		     (move) ? "Moving" : "Adding", tpg->se_tpg_tfo->tpg_get_wwn(tpg),
 		     tpg->se_tpg_tfo->tpg_get_tag(tpg), config_item_name(&lun->lun_group.cg_item),
 		     config_item_name(&tg_pt_gp_new->tg_pt_gp_group.cg_item),
drivers/target/target_core_configfs.c +24 -35

192 lines not on this page · raw message

drivers/target/target_core_file.c +13 -13
index fd3719cac493..503b53767b8b 100644
@@ -82,7 +82,7 @@ static struct se_device *fd_alloc_device(struct se_hba *hba, const char *name)
 
 	fd_dev->fd_host = fd_host;
 
-	target_debug("FILEIO: Allocated fd_dev for %p\n", name);
+	target_debug("Allocated fd_dev for %p\n", name);
 
 	return &fd_dev->dev;
 }
@@ -134,7 +134,7 @@ static int fd_configure_device(struct se_device *dev)
 	 * to write-out the entire device cache.
 	 */
 	if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) {
-		target_debug("FILEIO: Disabling O_DSYNC, using buffered FILEIO\n");
+		target_debug("Disabling O_DSYNC, using buffered FILEIO\n");
 		flags &= ~O_DSYNC;
 	}
 
@@ -164,7 +164,7 @@ static int fd_configure_device(struct se_device *dev)
 		dev_size = (i_size_read(file->f_mapping->host) -
 				       fd_dev->fd_block_size);
 
-		target_debug("FILEIO: Using size: %llu bytes from struct block_device blocks: %llu logical_block_size: %d\n",
+		target_debug("Using size: %llu bytes from struct block_device blocks: %llu logical_block_size: %d\n",
 			     dev_size, div_u64(dev_size, fd_dev->fd_block_size),
 			     fd_dev->fd_block_size);
 		/*
@@ -177,7 +177,7 @@ static int fd_configure_device(struct se_device *dev)
 			dev->dev_attrib.is_nonrot = 1;
 	} else {
 		if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) {
-			target_err("FILEIO: Missing fd_dev_size= parameter, and no backing struct block_device\n");
+			target_err("Missing fd_dev_size= parameter, and no backing struct block_device\n");
 			goto fail;
 		}
 
@@ -195,7 +195,7 @@ static int fd_configure_device(struct se_device *dev)
 	dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
 
 	if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) {
-		target_debug("FILEIO: Forcing setting of emulate_write_cache=1 with FDBD_HAS_BUFFERED_IO_WCE\n");
+		target_debug("Forcing setting of emulate_write_cache=1 with FDBD_HAS_BUFFERED_IO_WCE\n");
 		dev->dev_attrib.emulate_write_cache = 1;
 	}
 
@@ -406,7 +406,7 @@ fd_execute_sync_cache(struct se_cmd *cmd)
 
 	ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
 	if (ret != 0)
-		target_err("FILEIO: vfs_fsync_range() failed: %d\n", ret);
+		target_err("vfs_fsync_range() failed: %d\n", ret);
 
 	if (immed)
 		return 0;
@@ -548,7 +548,7 @@ fd_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
 					   target_to_linux_sector(dev,  nolb),
 					   GFP_KERNEL);
 		if (ret < 0) {
-			target_warn("FILEIO: blkdev_issue_discard() failed: %d\n", ret);
+			target_warn("blkdev_issue_discard() failed: %d\n", ret);
 			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 		}
 	} else {
@@ -563,7 +563,7 @@ fd_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
 
 		ret = file->f_op->fallocate(file, mode, pos, len);
 		if (ret < 0) {
-			target_warn("FILEIO: fallocate() failed: %d\n", ret);
+			target_warn("fallocate() failed: %d\n", ret);
 			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 		}
 	}
@@ -667,7 +667,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 	 * single vfs_[writev,readv] call.
 	 */
 	if (cmd->data_length > FD_MAX_BYTES) {
-		target_err("FILEIO: Not able to process I/O of %u bytes due to FD_MAX_BYTES: %u iovec count limitation\n",
+		target_err("Not able to process I/O of %u bytes due to FD_MAX_BYTES: %u iovec count limitation\n",
 			   cmd->data_length, FD_MAX_BYTES);
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
@@ -716,7 +716,7 @@ static ssize_t fd_set_configfs_dev_params(struct se_device *dev,
 				ret = -EINVAL;
 				break;
 			}
-			target_debug("FILEIO: Referencing Path: %s\n", fd_dev->fd_dev_name);
+			target_debug("Referencing Path: %s\n", fd_dev->fd_dev_name);
 			fd_dev->fbd_flags |= FBDF_HAS_PATH;
 			break;
 		case Opt_fd_dev_size:
@@ -731,7 +731,7 @@ static ssize_t fd_set_configfs_dev_params(struct se_device *dev,
 				target_err("kstrtoull() failed for fd_dev_size=\n");
 				goto out;
 			}
-			target_debug("FILEIO: Referencing Size: %llu bytes\n", fd_dev->fd_dev_size);
+			target_debug("Referencing Size: %llu bytes\n", fd_dev->fd_dev_size);
 			fd_dev->fbd_flags |= FBDF_HAS_SIZE;
 			break;
 		case Opt_fd_buffered_io:
@@ -744,7 +744,7 @@ static ssize_t fd_set_configfs_dev_params(struct se_device *dev,
 				goto out;
 			}
 
-			target_debug("FILEIO: Using buffered I/O operations for struct fd_dev\n");
+			target_debug("Using buffered I/O operations for struct fd_dev\n");
 
 			fd_dev->fbd_flags |= FDBD_HAS_BUFFERED_IO_WCE;
 			break;
@@ -758,7 +758,7 @@ static ssize_t fd_set_configfs_dev_params(struct se_device *dev,
 				goto out;
 			}
 
-			target_debug("FILEIO: Using async I/O operations for struct fd_dev\n");
+			target_debug("Using async I/O operations for struct fd_dev\n");
 
 			fd_dev->fbd_flags |= FDBD_HAS_ASYNC_IO;
 			break;
drivers/target/target_core_hba.c +1 -2
index 48dab83e5be3..31a426fcb3d4 100644
@@ -59,8 +59,7 @@ int transport_backend_register(const struct target_backend_ops *ops)
 	list_add_tail(&tb->list, &backend_list);
 	mutex_unlock(&backend_mutex);
 
-	target_debug("TCM: Registered subsystem plugin: %s struct module: %p\n", ops->name,
-		     ops->owner);
+	target_debug("Registered subsystem plugin: %s struct module: %p\n", ops->name, ops->owner);
 	return 0;
 }
 EXPORT_SYMBOL(transport_backend_register);
drivers/target/target_core_iblock.c +6 -6
index 8d71a0f5033e..25cc0815e590 100644
@@ -71,7 +71,7 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam
 	if (!ib_dev->ibd_plug)
 		goto free_dev;
 
-	target_debug("IBLOCK: Allocated ib_dev for %s\n", name);
+	target_debug("Allocated ib_dev for %s\n", name);
 
 	return &ib_dev->dev;
 
@@ -106,11 +106,11 @@ static int iblock_configure_device(struct se_device *dev)
 
 	ret = bioset_init(&ib_dev->ibd_bio_set, IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS);
 	if (ret) {
-		target_err("IBLOCK: Unable to create bioset\n");
+		target_err("Unable to create bioset\n");
 		goto out;
 	}
 
-	target_debug("IBLOCK: Claiming struct block_device: %s\n", ib_dev->ibd_udev_path);
+	target_debug("Claiming struct block_device: %s\n", ib_dev->ibd_udev_path);
 
 	if (!ib_dev->ibd_readonly)
 		mode |= BLK_OPEN_WRITE;
@@ -400,7 +400,7 @@ static void iblock_end_io_flush(struct bio *bio)
 	struct se_cmd *cmd = bio->bi_private;
 
 	if (bio->bi_status)
-		target_err("IBLOCK: cache flush failed: %d\n", bio->bi_status);
+		target_err("cache flush failed: %d\n", bio->bi_status);
 
 	if (cmd) {
 		if (bio->bi_status)
@@ -612,7 +612,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev,
 				ret = -EINVAL;
 				break;
 			}
-			target_debug("IBLOCK: Referencing UDEV path: %s\n", ib_dev->ibd_udev_path);
+			target_debug("Referencing UDEV path: %s\n", ib_dev->ibd_udev_path);
 			ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH;
 			break;
 		case Opt_readonly:
@@ -628,7 +628,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev,
 				goto out;
 			}
 			ib_dev->ibd_readonly = tmp_readonly;
-			target_debug("IBLOCK: readonly: %d\n", ib_dev->ibd_readonly);
+			target_debug("readonly: %d\n", ib_dev->ibd_readonly);
 			break;
 		case Opt_force:
 			break;
drivers/target/target_core_pscsi.c +17 -20
index 24e080254c6f..51b0998b9a9e 100644
@@ -114,8 +114,7 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag)
 	 */
 	sh = scsi_host_lookup(phv->phv_host_id);
 	if (!sh) {
-		target_err("pSCSI: Unable to locate SCSI Host for phv_host_id: %d\n",
-			   phv->phv_host_id);
+		target_err("Unable to locate SCSI Host for phv_host_id: %d\n", phv->phv_host_id);
 		return -EINVAL;
 	}
 
@@ -334,7 +333,7 @@ static struct se_device *pscsi_alloc_device(struct se_hba *hba,
 		return NULL;
 	}
 
-	target_debug("PSCSI: Allocated pdv: %p for %s\n", pdv, name);
+	target_debug("Allocated pdv: %p for %s\n", pdv, name);
 	return &pdv->dev;
 }
 
@@ -364,7 +363,7 @@ static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
 	bdev_file = bdev_file_open_by_path(dev->udev_path,
 				BLK_OPEN_WRITE | BLK_OPEN_READ, pdv, NULL);
 	if (IS_ERR(bdev_file)) {
-		target_err("pSCSI: bdev_file_open_by_path() failed\n");
+		target_err("bdev_file_open_by_path() failed\n");
 		scsi_device_put(sd);
 		return PTR_ERR(bdev_file);
 	}
@@ -435,7 +434,7 @@ static int pscsi_configure_device(struct se_device *dev)
 	 */
 	if (!sh) {
 		if (phv->phv_mode == PHV_LLD_SCSI_HOST_NO) {
-			target_err("pSCSI: Unable to locate struct Scsi_Host for PHV_LLD_SCSI_HOST_NO\n");
+			target_err("Unable to locate struct Scsi_Host for PHV_LLD_SCSI_HOST_NO\n");
 			return -ENODEV;
 		}
 		/*
@@ -443,7 +442,7 @@ static int pscsi_configure_device(struct se_device *dev)
 		 * reference, we enforce that udev_path has been set
 		 */
 		if (!(dev->dev_flags & DF_USING_UDEV_PATH)) {
-			target_err("pSCSI: udev_path attribute has not been set before ENABLE=1\n");
+			target_err("udev_path attribute has not been set before ENABLE=1\n");
 			return -EINVAL;
 		}
 		/*
@@ -453,7 +452,7 @@ static int pscsi_configure_device(struct se_device *dev)
 		 */
 		if (!(pdv->pdv_flags & PDF_HAS_VIRT_HOST_ID)) {
 			if (hba->dev_count) {
-				target_err("pSCSI: Unable to set hba_mode with active devices\n");
+				target_err("Unable to set hba_mode with active devices\n");
 				return -EEXIST;
 			}
 
@@ -466,15 +465,14 @@ static int pscsi_configure_device(struct se_device *dev)
 		} else {
 			sh = scsi_host_lookup(pdv->pdv_host_id);
 			if (!sh) {
-				target_err("pSCSI: Unable to locate pdv_host_id: %d\n",
-					   pdv->pdv_host_id);
+				target_err("Unable to locate pdv_host_id: %d\n", pdv->pdv_host_id);
 				return -EINVAL;
 			}
 			pdv->pdv_lld_host = sh;
 		}
 	} else {
 		if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) {
-			target_err("pSCSI: PHV_VIRTUAL_HOST_ID set while struct Scsi_Host exists\n");
+			target_err("PHV_VIRTUAL_HOST_ID set while struct Scsi_Host exists\n");
 			return -EEXIST;
 		}
 	}
@@ -514,7 +512,7 @@ static int pscsi_configure_device(struct se_device *dev)
 	}
 	spin_unlock_irq(sh->host_lock);
 
-	target_err("pSCSI: Unable to locate %d:%d:%d:%d\n", sh->host_no, pdv->pdv_channel_id,
+	target_err("Unable to locate %d:%d:%d:%d\n", sh->host_no, pdv->pdv_channel_id,
 		   pdv->pdv_target_id, pdv->pdv_lun_id);
 
 	if (phv->phv_mode == PHV_VIRTUAL_HOST_ID)
@@ -820,14 +818,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	BUG_ON(!cmd->data_length);
 
-	target_debug("PSCSI: nr_pages: %d\n", nr_pages);
+	target_debug("nr_pages: %d\n", nr_pages);
 
 	for_each_sg(sgl, sg, sgl_nents, i) {
 		page = sg_page(sg);
 		off = sg->offset;
 		len = sg->length;
 
-		target_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, page, len, off);
+		target_debug("i: %d page: %p len: %d off: %d\n", i, page, len, off);
 
 		/*
 		 * We only have one page of data in each sg element,
@@ -850,24 +848,23 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 					 rw ? REQ_OP_WRITE : REQ_OP_READ);
 				bio->bi_end_io = pscsi_bi_endio;
 
-				target_debug("PSCSI: Allocated bio: %p, dir: %s nr_vecs: %d\n", bio,
+				target_debug("Allocated bio: %p, dir: %s nr_vecs: %d\n", bio,
 					     (rw) ? "rw" : "r", nr_vecs);
 			}
 
-			target_debug("PSCSI: Calling bio_add_pc_page() i: %d bio: %p page: %p len: %d off: %d\n",
+			target_debug("Calling bio_add_pc_page() i: %d bio: %p page: %p len: %d off: %d\n",
 				     i, bio, page, len, off);
 
 			rc = bio_add_pc_page(pdv->pdv_sd->request_queue,
 					bio, page, bytes, off);
-			target_debug("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n", bio_segments(bio),
-				     nr_vecs);
+			target_debug("bio->bi_vcnt: %d nr_vecs: %d\n", bio_segments(bio), nr_vecs);
 			if (rc != bytes) {
-				target_debug("PSCSI: Reached bio->bi_vcnt max: %d i: %d bio: %p, allocating another bio\n",
+				target_debug("Reached bio->bi_vcnt max: %d i: %d bio: %p, allocating another bio\n",
 					     bio->bi_vcnt, i, bio);
 
 				rc = blk_rq_append_bio(req, bio);
 				if (rc) {
-					target_err("pSCSI: failed to append bio\n");
+					target_err("failed to append bio\n");
 					goto fail;
 				}
 
@@ -881,7 +878,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 	if (bio) {
 		rc = blk_rq_append_bio(req, bio);
 		if (rc) {
-			target_err("pSCSI: failed to append bio\n");
+			target_err("failed to append bio\n");
 			goto fail;
 		}
 	}
drivers/target/target_core_rd.c +3 -4
index 6e3547847bcc..3a109a61c83b 100644
@@ -553,8 +553,7 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
 		case Opt_rd_pages:
 			match_int(args, &arg);
 			rd_dev->rd_page_count = arg;
-			target_debug("RAMDISK: Referencing Page Count: %u\n",
-				     rd_dev->rd_page_count);
+			target_debug("Referencing Page Count: %u\n", rd_dev->rd_page_count);
 			rd_dev->rd_flags |= RDF_HAS_PAGE_COUNT;
 			break;
 		case Opt_rd_nullio:
@@ -562,7 +561,7 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
 			if (arg != 1)
 				break;
 
-			target_debug("RAMDISK: Setting NULLIO flag: %d\n", arg);
+			target_debug("Setting NULLIO flag: %d\n", arg);
 			rd_dev->rd_flags |= RDF_NULLIO;
 			break;
 		case Opt_rd_dummy:
@@ -570,7 +569,7 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
 			if (arg != 1)
 				break;
 
-			target_debug("RAMDISK: Setting DUMMY flag: %d\n", arg);
+			target_debug("Setting DUMMY flag: %d\n", arg);
 			rd_dev->rd_flags |= RDF_DUMMY;
 			break;
 		default:
drivers/target/target_core_user.c +6 -6
index c8f66ef7411b..49f5fd7e399b 100644
@@ -1039,7 +1039,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err)
 		goto queue;
 
 	if (data_length > (size_t)udev->max_blocks * blk_size) {
-		target_warn("TCMU: Request of size %zu is too big for %zu data area\n", data_length,
+		target_warn("Request of size %zu is too big for %zu data area\n", data_length,
 			    (size_t)udev->max_blocks * blk_size);
 		*scsi_err = TCM_INVALID_CDB_FIELD;
 		return -1;
@@ -1057,7 +1057,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err)
 	command_size = tcmu_cmd_get_cmd_size(tcmu_cmd, base_command_size);
 
 	if (command_size > (udev->cmdr_size / 2)) {
-		target_warn("TCMU: Request of size %zu is too big for %u cmd ring\n", command_size,
+		target_warn("Request of size %zu is too big for %u cmd ring\n", command_size,
 			    udev->cmdr_size);
 		tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cur);
 		*scsi_err = TCM_INVALID_CDB_FIELD;
@@ -1073,7 +1073,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err)
 
 	if (xa_alloc(&udev->commands, &cmd_id, tcmu_cmd, XA_LIMIT(1, 0xffff),
 		     GFP_NOWAIT) < 0) {
-		target_err("tcmu: Could not allocate cmd id.\n");
+		target_err("Could not allocate cmd id.\n");
 
 		tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt);
 		*scsi_err = TCM_OUT_OF_RESOURCES;
@@ -1346,7 +1346,7 @@ static bool tcmu_handle_completion(struct tcmu_cmd *cmd,
 	tcmu_cmd_reset_dbi_cur(cmd);
 
 	if (entry->hdr.uflags & TCMU_UFLAG_UNKNOWN_OP) {
-		target_warn("TCMU: Userspace set UNKNOWN_OP flag on se_cmd %p\n", cmd->se_cmd);
+		target_warn("Userspace set UNKNOWN_OP flag on se_cmd %p\n", cmd->se_cmd);
 		entry->rsp.scsi_status = SAM_STAT_CHECK_CONDITION;
 		goto done;
 	}
@@ -1374,7 +1374,7 @@ static bool tcmu_handle_completion(struct tcmu_cmd *cmd,
 	} else if (se_cmd->data_direction == DMA_TO_DEVICE) {
 		/* TODO: */
 	} else if (se_cmd->data_direction != DMA_NONE) {
-		target_warn("TCMU: data direction was %d!\n", se_cmd->data_direction);
+		target_warn("data direction was %d!\n", se_cmd->data_direction);
 	}
 
 done:
@@ -2579,7 +2579,7 @@ static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev,
 				ret = -EINVAL;
 				break;
 			}
-			target_debug("TCMU: Referencing Path: %s\n", udev->dev_config);
+			target_debug("Referencing Path: %s\n", udev->dev_config);
 			break;
 		case Opt_dev_size:
 			ret = match_u64(&args[0], &udev->dev_size);
drivers/target/target_core_xcopy.c +7 -8
index 971299330a98..341adcc82db8 100644
@@ -50,7 +50,7 @@ static int target_xcopy_locate_se_dev_e4_iter(struct se_device *se_dev,
 	int rc;
 
 	if (!se_dev->dev_attrib.emulate_3pc) {
-		target_debug("XCOPY: emulate_3pc disabled on se_dev %p\n", se_dev);
+		target_debug("emulate_3pc disabled on se_dev %p\n", se_dev);
 		return 0;
 	}
 
@@ -59,8 +59,7 @@ static int target_xcopy_locate_se_dev_e4_iter(struct se_device *se_dev,
 
 	rc = memcmp(&tmp_dev_wwn[0], dev_wwn, XCOPY_NAA_IEEE_REGEX_LEN);
 	if (rc != 0) {
-		target_debug("XCOPY: skip non-matching: %*ph\n", XCOPY_NAA_IEEE_REGEX_LEN,
-			     tmp_dev_wwn);
+		target_debug("skip non-matching: %*ph\n", XCOPY_NAA_IEEE_REGEX_LEN, tmp_dev_wwn);
 		return 0;
 	}
 	target_debug("XCOPY 0xe4: located se_dev: %p\n", se_dev);
@@ -582,7 +581,7 @@ static int target_xcopy_read_source(
 	cdb[0] = READ_16;
 	put_unaligned_be64(src_lba, &cdb[2]);
 	put_unaligned_be32(transfer_length_block, &cdb[10]);
-	target_debug("XCOPY: Built READ_16: LBA: %llu Blocks: %u Length: %u\n",
+	target_debug("Built READ_16: LBA: %llu Blocks: %u Length: %u\n",
 		     (unsigned long long)src_lba, transfer_length_block, src_bytes);
 
 	__target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, src_bytes,
@@ -627,7 +626,7 @@ static int target_xcopy_write_destination(
 	cdb[0] = WRITE_16;
 	put_unaligned_be64(dst_lba, &cdb[2]);
 	put_unaligned_be32(transfer_length_block, &cdb[10]);
-	target_debug("XCOPY: Built WRITE_16: LBA: %llu Blocks: %u Length: %u\n",
+	target_debug("Built WRITE_16: LBA: %llu Blocks: %u Length: %u\n",
 		     (unsigned long long)dst_lba, transfer_length_block, dst_bytes);
 
 	__target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, dst_bytes,
@@ -834,7 +833,7 @@ static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop)
 	if (rc <= 0)
 		goto out;
 
-	target_debug("XCOPY: Processed %d segment descriptors, length: %u\n", rc,
+	target_debug("Processed %d segment descriptors, length: %u\n", rc,
 		     rc * XCOPY_SEGMENT_DESC_LEN);
 
 	rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll, &ret);
@@ -843,7 +842,7 @@ static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop)
 
 	if (xop->src_dev->dev_attrib.block_size !=
 	    xop->dst_dev->dev_attrib.block_size) {
-		target_err("XCOPY: Non matching src_dev block_size: %u + dst_dev block_size: %u currently unsupported\n",
+		target_err("Non matching src_dev block_size: %u + dst_dev block_size: %u currently unsupported\n",
 			   xop->src_dev->dev_attrib.block_size,
 			   xop->dst_dev->dev_attrib.block_size);
 		xcopy_pt_undepend_remotedev(xop);
@@ -851,7 +850,7 @@ static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop)
 		goto out;
 	}
 
-	target_debug("XCOPY: Processed %d target descriptors, length: %u\n", rc,
+	target_debug("Processed %d target descriptors, length: %u\n", rc,
 		     rc * XCOPY_TARGET_DESC_LEN);
 	transport_kunmap_data_sg(se_cmd);
 	return TCM_NO_SENSE;
drivers/target/tcm_fc/tfc_conf.c +1 -1
index 2fd6ed19fbf9..b265159a308a 100644
@@ -224,7 +224,7 @@ static struct se_portal_group *ft_add_tpg(struct se_wwn *wwn, const char *name)
 	unsigned long index;
 	int ret;
 
-	target_debug("tcm_fc: add tpg %s\n", name);
+	target_debug("add tpg %s\n", name);
 
 	/*
 	 * Name must be "tpgt_" followed by the index.
drivers/target/tcm_remote/tcm_remote.c +6 -6
index b978b831c6c1..309633e44b28 100644
@@ -73,7 +73,7 @@ static int tcm_remote_port_link(
 	struct se_portal_group *se_tpg,
 	struct se_lun *lun)
 {
-	target_debug("TCM_Remote_ConfigFS: Port Link LUN %lld Successful\n", lun->unpacked_lun);
+	target_debug("configfs: Port Link LUN %lld Successful\n", lun->unpacked_lun);
 	return 0;
 }
 
@@ -81,7 +81,7 @@ static void tcm_remote_port_unlink(
 	struct se_portal_group *se_tpg,
 	struct se_lun *lun)
 {
-	target_debug("TCM_Remote_ConfigFS: Port Unlink LUN %lld Successful\n", lun->unpacked_lun);
+	target_debug("configfs: Port Unlink LUN %lld Successful\n", lun->unpacked_lun);
 }
 
 static struct se_portal_group *tcm_remote_make_tpg(
@@ -116,7 +116,7 @@ static struct se_portal_group *tcm_remote_make_tpg(
 	if (ret < 0)
 		return ERR_PTR(-ENOMEM);
 
-	target_debug("TCM_Remote_ConfigFS: Allocated Emulated %s Target Port %s,t,0x%04lx\n",
+	target_debug("configfs: Allocated Emulated %s Target Port %s,t,0x%04lx\n",
 		     tcm_remote_dump_proto_id(remote_hba),
 		     config_item_name(&wwn->wwn_group.cg_item), tpgt);
 	return &remote_tpg->remote_se_tpg;
@@ -141,7 +141,7 @@ static void tcm_remote_drop_tpg(struct se_portal_group *se_tpg)
 	remote_tpg->remote_hba = NULL;
 	remote_tpg->remote_tpgt = 0;
 
-	target_debug("TCM_Remote_ConfigFS: Deallocated Emulated %s Target Port %s,t,0x%04x\n",
+	target_debug("configfs: Deallocated Emulated %s Target Port %s,t,0x%04x\n",
 		     tcm_remote_dump_proto_id(remote_hba),
 		     config_item_name(&wwn->wwn_group.cg_item), tpgt);
 }
@@ -197,7 +197,7 @@ static struct se_wwn *tcm_remote_make_wwn(
 	}
 	snprintf(&remote_hba->remote_wwn_address[0], TL_WWN_ADDR_LEN, "%s", &name[off]);
 
-	target_debug("TCM_Remote_ConfigFS: Allocated emulated Target %s Address: %s\n",
+	target_debug("configfs: Allocated emulated Target %s Address: %s\n",
 		     tcm_remote_dump_proto_id(remote_hba), name);
 	return &remote_hba->remote_hba_wwn;
 out:
@@ -210,7 +210,7 @@ static void tcm_remote_drop_wwn(struct se_wwn *wwn)
 	struct tcm_remote_hba *remote_hba = container_of(wwn,
 				struct tcm_remote_hba, remote_hba_wwn);
 
-	target_debug("TCM_Remote_ConfigFS: Deallocating emulated Target %s Address: %s\n",
+	target_debug("configfs: Deallocating emulated Target %s Address: %s\n",
 		     tcm_remote_dump_proto_id(remote_hba), remote_hba->remote_wwn_address);
 	kfree(remote_hba);
 }
Signature · 1 line
2.40.3
#7 lore raw

PATCH 7/10 target: core: Extend CaW logging

In reply to Anastasia Kovaleva

Pass se_cmd to the compare_and_write_do_cmp() for extended logging.

---
 drivers/target/target_core_sbc.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/target/target_core_sbc.c +9 -12
index 86b9a0bc6e90..22b705bc7f91 100644
@@ -375,10 +375,12 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success,
  * @miscmp_off and return TCM_MISCOMPARE_VERIFY.
  */
 static sense_reason_t
-compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
-			 struct scatterlist *cmp_sgl, unsigned int cmp_nents,
-			 unsigned int cmp_len, unsigned int *miscmp_off)
+compare_and_write_do_cmp(struct se_cmd *cmd, unsigned int cmp_len, unsigned int *miscmp_off)
 {
+	struct scatterlist *read_sgl = cmd->t_bidi_data_sg;
+	struct scatterlist *cmp_sgl = cmd->t_data_sg;
+	unsigned int read_nents = cmd->t_bidi_data_nents;
+	unsigned int cmp_nents = cmd->t_data_nents;
 	unsigned char *buf = NULL;
 	struct scatterlist *sg;
 	sense_reason_t ret;
@@ -394,7 +396,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 
 	rc = sg_copy_to_buffer(cmp_sgl, cmp_nents, buf, cmp_len);
 	if (!rc) {
-		target_err("sg_copy_to_buffer() failed for compare_and_write\n");
+		target_cmd_err(cmd, "sg_copy_to_buffer() failed for compare_and_write\n");
 		ret = TCM_OUT_OF_RESOURCES;
 		goto out;
 	}
@@ -413,7 +415,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 			for (i = 0; i < len && addr[i] == buf[offset + i]; i++)
 				;
 			*miscmp_off = offset + i;
-			target_warn("Detected MISCOMPARE at offset %u\n", *miscmp_off);
+			target_cmd_warn(cmd, "Detected MISCOMPARE at offset %u\n", *miscmp_off);
 			ret = TCM_MISCOMPARE_VERIFY;
 		}
 		kunmap_atomic(addr);
@@ -425,7 +427,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 		if (!cmp_len)
 			break;
 	}
-	target_debug("COMPARE AND WRITE read data matches compare data\n");
+	target_cmd_debug(cmd, "COMPARE AND WRITE read data matches compare data\n");
 out:
 	kfree(buf);
 	return ret;
@@ -479,12 +481,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes
 		goto out;
 	}
 
-	ret = compare_and_write_do_cmp(cmd->t_bidi_data_sg,
-				       cmd->t_bidi_data_nents,
-				       cmd->t_data_sg,
-				       cmd->t_data_nents,
-				       compare_len,
-				       &miscmp_off);
+	ret = compare_and_write_do_cmp(cmd, compare_len, &miscmp_off);
 	if (ret == TCM_MISCOMPARE_VERIFY) {
 		/*
 		 * SBC-4 r15: 5.3 COMPARE AND WRITE command
Signature · 1 line
2.40.3
#8 lore raw

PATCH 8/10 target: core: Use extended logs where possible

In reply to Anastasia Kovaleva

1) Change the common logs to the extended ones where it is possible;
2) Change the logs themselves removing repeating parts in the new wrapper;
3) Align the format string arguments with clang-config;
4) Remove unused variables;

---
 drivers/target/target_core_alua.c            |  72 ++--
 drivers/target/target_core_configfs.c        |   8 +-
 drivers/target/target_core_device.c          |  46 +--
 drivers/target/target_core_fabric_configfs.c |   8 +-
 drivers/target/target_core_file.c            |  45 +--
 drivers/target/target_core_hba.c             |   4 +-
 drivers/target/target_core_iblock.c          |  35 +-
 drivers/target/target_core_pr.c              | 353 ++++++++++---------
 drivers/target/target_core_pscsi.c           |  44 +--
 drivers/target/target_core_rd.c              |  22 +-
 drivers/target/target_core_sbc.c             | 120 +++----
 drivers/target/target_core_spc.c             |  20 +-
 drivers/target/target_core_tmr.c             |  19 +-
 drivers/target/target_core_tpg.c             |   9 +-
 drivers/target/target_core_transport.c       | 104 +++---
 drivers/target/target_core_ua.c              |  14 +-
 drivers/target/target_core_xcopy.c           | 180 +++++-----
 17 files changed, 558 insertions(+), 545 deletions(-)
drivers/target/target_core_alua.c +37 -35
index fd91a2a3b120..04916ecd6ed2 100644
@@ -64,7 +64,8 @@ target_emulate_report_referrals(struct se_cmd *cmd)
 	u32 rd_len = 0, off;
 
 	if (cmd->data_length < 4) {
-		target_warn("REPORT REFERRALS allocation length %u too small\n", cmd->data_length);
+		target_cmd_warn(cmd, "REPORT REFERRALS allocation length %u too small\n",
+				cmd->data_length);
 		return TCM_INVALID_CDB_FIELD;
 	}
 
@@ -153,8 +154,8 @@ target_emulate_report_target_port_groups(struct se_cmd *cmd)
 		off = 4;
 
 	if (cmd->data_length < off) {
-		target_warn("REPORT TARGET PORT GROUPS allocation length %u too small for %s header\n",
-			    cmd->data_length, (ext_hdr) ? "extended" : "normal");
+		target_cmd_warn(cmd, "REPORT TARGET PORT GROUPS allocation length %u too small for %s header\n",
+				cmd->data_length, (ext_hdr) ? "extended" : "normal");
 		return TCM_INVALID_CDB_FIELD;
 	}
 	buf = transport_kmap_data_sg(cmd);
@@ -282,8 +283,8 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
 	u16 tg_pt_id, rtpi;
 
 	if (cmd->data_length < 4) {
-		target_warn("SET TARGET PORT GROUPS parameter list length %u too small\n",
-			    cmd->data_length);
+		target_cmd_warn(cmd, "SET TARGET PORT GROUPS parameter list length %u too small\n",
+				cmd->data_length);
 		return TCM_INVALID_PARAMETER_LIST;
 	}
 
@@ -299,14 +300,14 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
 	l_tg_pt_gp = rcu_dereference(l_lun->lun_tg_pt_gp);
 	if (!l_tg_pt_gp) {
 		rcu_read_unlock();
-		target_err("Unable to access l_lun->tg_pt_gp\n");
+		target_cmd_err(cmd, "Unable to access l_lun->tg_pt_gp\n");
 		rc = TCM_UNSUPPORTED_SCSI_OPCODE;
 		goto out;
 	}
 
 	if (!(l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICIT_ALUA)) {
 		rcu_read_unlock();
-		target_debug("Unable to process SET_TARGET_PORT_GROUPS while TPGS_EXPLICIT_ALUA is disabled\n");
+		target_cmd_debug(cmd, "Unable to process SET_TARGET_PORT_GROUPS while TPGS_EXPLICIT_ALUA is disabled\n");
 		rc = TCM_UNSUPPORTED_SCSI_OPCODE;
 		goto out;
 	}
@@ -662,7 +663,7 @@ target_alua_state_check(struct se_cmd *cmd)
 	 * access state: OFFLINE
 	 */
 	if (atomic_read(&lun->lun_tg_pt_secondary_offline)) {
-		target_debug("ALUA: Got secondary offline status for local target port\n");
+		target_cmd_debug(cmd, "ALUA: Got secondary offline status for local target port\n");
 		return TCM_ALUA_OFFLINE;
 	}
 	rcu_read_lock();
@@ -707,13 +708,13 @@ target_alua_state_check(struct se_cmd *cmd)
 	 */
 	case ALUA_ACCESS_STATE_OFFLINE:
 	default:
-		target_err("Unknown ALUA access state: 0x%02x\n", out_alua_state);
+		target_cmd_err(cmd, "Unknown ALUA access state: 0x%02x\n", out_alua_state);
 		rc = TCM_INVALID_CDB_FIELD;
 	}
 
 	if (rc && rc != TCM_INVALID_CDB_FIELD) {
-		target_debug("[%s]: ALUA TG Port not available, SenseKey: NOT_READY, ASC/rc: 0x04/%d\n",
-			     cmd->se_tfo->fabric_name, rc);
+		target_cmd_debug(cmd, "[%s]: ALUA TG Port not available, SenseKey: NOT_READY, ASC/rc: 0x04/%d\n",
+				 cmd->se_tfo->fabric_name, rc);
 	}
 
 	return rc;
@@ -1168,7 +1169,7 @@ static int core_alua_update_tpg_secondary_metadata(struct se_lun *lun)
 
 	md_buf = kzalloc(ALUA_MD_BUF_LEN, GFP_KERNEL);
 	if (!md_buf) {
-		target_err("Unable to allocate buf for ALUA metadata\n");
+		target_lun_err(lun, "Unable to allocate buf for ALUA metadata\n");
 		rc = -ENOMEM;
 		goto out_unlock;
 	}
@@ -1216,7 +1217,7 @@ static int core_alua_set_tg_pt_secondary_state(
 	tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp);
 	if (!tg_pt_gp) {
 		rcu_read_unlock();
-		target_err("Unable to complete secondary state transition\n");
+		target_lun_err(lun, "Unable to complete secondary state transition\n");
 		return -EINVAL;
 	}
 	trans_delay_msecs = tg_pt_gp->tg_pt_gp_trans_delay_msecs;
@@ -1233,10 +1234,10 @@ static int core_alua_set_tg_pt_secondary_state(
 			ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG :
 			ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA;
 
-	target_debug("Successful %s ALUA transition TG PT Group: %s ID: %u to secondary access state: %s\n",
-		     (explicit) ? "explicit" : "implicit",
-		     config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), tg_pt_gp->tg_pt_gp_id,
-		     (offline) ? "OFFLINE" : "ONLINE");
+	target_lun_debug(lun, "Successful %s ALUA transition TG PT Group: %s ID: %u to secondary access state: %s\n",
+			 (explicit) ? "explicit" : "implicit",
+			 config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), tg_pt_gp->tg_pt_gp_id,
+			 (offline) ? "OFFLINE" : "ONLINE");
 
 	rcu_read_unlock();
 	/*
@@ -1898,7 +1899,7 @@ ssize_t core_alua_store_tg_pt_gp_info(
 		return -ENODEV;
 
 	if (count > TG_PT_GROUP_NAME_BUF) {
-		target_err("ALUA Target Port Group alias too large!\n");
+		target_lun_err(lun, "ALUA Target Port Group alias too large!\n");
 		return -EINVAL;
 	}
 	memset(buf, 0, TG_PT_GROUP_NAME_BUF);
@@ -1928,12 +1929,12 @@ ssize_t core_alua_store_tg_pt_gp_info(
 		 * with the default_tg_pt_gp.
 		 */
 		if (!tg_pt_gp_new) {
-			target_debug("configfs: Moving %s/tpgt_%u/%s from ALUA Target Port Group: alua/%s, ID: %u back to default_tg_pt_gp\n",
-				     tpg->se_tpg_tfo->tpg_get_wwn(tpg),
-				     tpg->se_tpg_tfo->tpg_get_tag(tpg),
-				     config_item_name(&lun->lun_group.cg_item),
-				     config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item),
-				     tg_pt_gp->tg_pt_gp_id);
+			target_lun_debug(lun, "configfs: Moving %s/tpgt_%u/%s from ALUA Target Port Group: alua/%s, ID: %u back to default_tg_pt_gp\n",
+					 tpg->se_tpg_tfo->tpg_get_wwn(tpg),
+					 tpg->se_tpg_tfo->tpg_get_tag(tpg),
+					 config_item_name(&lun->lun_group.cg_item),
+					 config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item),
+					 tg_pt_gp->tg_pt_gp_id);
 
 			target_swap_tg_pt_gp(lun, tg_pt_gp,
 					dev->t10_alua.default_tg_pt_gp);
@@ -1946,11 +1947,12 @@ ssize_t core_alua_store_tg_pt_gp_info(
 
 	target_swap_tg_pt_gp(lun, tg_pt_gp, tg_pt_gp_new);
 	spin_unlock(&lun->lun_tg_pt_gp_lock);
-	target_debug("configfs: %s %s/tpgt_%u/%s to ALUA Target Port Group: alua/%s, ID: %u\n",
-		     (move) ? "Moving" : "Adding", tpg->se_tpg_tfo->tpg_get_wwn(tpg),
-		     tpg->se_tpg_tfo->tpg_get_tag(tpg), config_item_name(&lun->lun_group.cg_item),
-		     config_item_name(&tg_pt_gp_new->tg_pt_gp_group.cg_item),
-		     tg_pt_gp_new->tg_pt_gp_id);
+	target_lun_debug(lun, "configfs: %s %s/tpgt_%u/%s to ALUA Target Port Group: alua/%s, ID: %u\n",
+			 (move) ? "Moving" : "Adding", tpg->se_tpg_tfo->tpg_get_wwn(tpg),
+			 tpg->se_tpg_tfo->tpg_get_tag(tpg),
+			 config_item_name(&lun->lun_group.cg_item),
+			 config_item_name(&tg_pt_gp_new->tg_pt_gp_group.cg_item),
+			 tg_pt_gp_new->tg_pt_gp_id);
 
 	core_alua_put_tg_pt_gp_from_name(tg_pt_gp_new);
 sync_rcu:
@@ -2147,11 +2149,11 @@ ssize_t core_alua_store_offline_bit(
 
 	ret = kstrtoul(page, 0, &tmp);
 	if (ret < 0) {
-		target_err("Unable to extract alua_tg_pt_offline value\n");
+		target_lun_err(lun, "Unable to extract alua_tg_pt_offline value\n");
 		return ret;
 	}
 	if ((tmp != 0) && (tmp != 1)) {
-		target_err("Illegal value for alua_tg_pt_offline: %lu\n", tmp);
+		target_lun_err(lun, "Illegal value for alua_tg_pt_offline: %lu\n", tmp);
 		return -EINVAL;
 	}
 
@@ -2179,13 +2181,13 @@ ssize_t core_alua_store_secondary_status(
 
 	ret = kstrtoul(page, 0, &tmp);
 	if (ret < 0) {
-		target_err("Unable to extract alua_tg_pt_status\n");
+		target_lun_err(lun, "Unable to extract alua_tg_pt_status\n");
 		return ret;
 	}
 	if ((tmp != ALUA_STATUS_NONE) &&
 	    (tmp != ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG) &&
 	    (tmp != ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA)) {
-		target_err("Illegal value for alua_tg_pt_status: %lu\n", tmp);
+		target_lun_err(lun, "Illegal value for alua_tg_pt_status: %lu\n", tmp);
 		return -EINVAL;
 	}
 	lun->lun_tg_pt_secondary_stat = (int)tmp;
@@ -2210,11 +2212,11 @@ ssize_t core_alua_store_secondary_write_metadata(
 
 	ret = kstrtoul(page, 0, &tmp);
 	if (ret < 0) {
-		target_err("Unable to extract alua_tg_pt_write_md\n");
+		target_lun_err(lun, "Unable to extract alua_tg_pt_write_md\n");
 		return ret;
 	}
 	if ((tmp != 0) && (tmp != 1)) {
-		target_err("Illegal value for alua_tg_pt_write_md: %lu\n", tmp);
+		target_lun_err(lun, "Illegal value for alua_tg_pt_write_md: %lu\n", tmp);
 		return -EINVAL;
 	}
 	lun->lun_tg_pt_secondary_write_md = (int)tmp;
drivers/target/target_core_configfs.c +4 -4
index ea958b9a21b8..4c058472acb7 100644
@@ -196,7 +196,7 @@ static struct config_group *target_core_register_fabric(
 
 	tf = target_core_get_fabric(name);
 	if (!tf) {
-		target_debug("target_core_register_fabric() trying autoload for %s\n", name);
+		target_debug("%s trying autoload for %s\n", __func__, name);
 
 		/*
 		 * Below are some hardcoded request_module() calls to automatically
@@ -3589,8 +3589,8 @@ static int __init target_core_init_configfs(void)
 	const struct cred *old_cred;
 	int ret;
 
-	target_debug("TARGET_CORE[0]: Loading Generic Kernel Storage Engine: %s on %s/%s on "
-		     UTS_RELEASE "\n", TARGET_CORE_VERSION, utsname()->sysname, utsname()->machine);
+	target_debug("Loading Generic Kernel Storage Engine: %s on %s/%s on " UTS_RELEASE "\n",
+		     TARGET_CORE_VERSION, utsname()->sysname, utsname()->machine);
 
 	config_group_init(&subsys->su_group);
 	mutex_init(&subsys->su_mutex);
@@ -3704,7 +3704,7 @@ static void __exit target_core_exit_configfs(void)
 	core_alua_free_lu_gp(default_lu_gp);
 	default_lu_gp = NULL;
 
-	target_debug("TARGET_CORE[0]: Released ConfigFS Fabric Infrastructure\n");
+	target_debug("Released ConfigFS Fabric Infrastructure\n");
 
 	core_dev_release_virtual_lun0();
 	rd_module_exit();
drivers/target/target_core_device.c +19 -27

117 lines not on this page · raw message

drivers/target/target_core_fabric_configfs.c +4 -4
index dec8f25c04d0..d524971e5174 100644
@@ -106,13 +106,13 @@ static int target_fabric_mappedlun_link(
 	 * Make sure the SymLink is going to the same $FABRIC/$WWN/tpgt_$TPGT
 	 */
 	if (strcmp(config_item_name(wwn_ci), config_item_name(wwn_ci_s))) {
-		target_err("Illegal Initiator ACL SymLink outside of %s\n",
-			   config_item_name(wwn_ci));
+		target_lun_err(lun, "Illegal Initiator ACL SymLink outside of %s\n",
+			       config_item_name(wwn_ci));
 		return -EINVAL;
 	}
 	if (strcmp(config_item_name(tpg_ci), config_item_name(tpg_ci_s))) {
-		target_err("Illegal Initiator ACL Symlink outside of %s TPGT: %s\n",
-			   config_item_name(wwn_ci), config_item_name(tpg_ci));
+		target_lun_err(lun, "Illegal Initiator ACL Symlink outside of %s TPGT: %s\n",
+			       config_item_name(wwn_ci), config_item_name(tpg_ci));
 		return -EINVAL;
 	}
 	/*
drivers/target/target_core_file.c +23 -22

141 lines not on this page · raw message

drivers/target/target_core_hba.c +2 -2
index 31a426fcb3d4..a5b5442d52ce 100644
@@ -139,7 +139,7 @@ core_alloc_hba(const char *plugin_name, u32 plugin_dep_id, u32 hba_flags)
 	list_add_tail(&hba->hba_node, &hba_list);
 	spin_unlock(&hba_lock);
 
-	target_debug("CORE_HBA[%d] - Attached HBA to Generic Target Core\n", hba->hba_id);
+	target_debug("hba[%d] - Attached HBA to Generic Target Core\n", hba->hba_id);
 
 	return hba;
 
@@ -162,7 +162,7 @@ core_delete_hba(struct se_hba *hba)
 	list_del(&hba->hba_node);
 	spin_unlock(&hba_lock);
 
-	target_debug("CORE_HBA[%d] - Detached HBA from Generic Target Core\n", hba->hba_id);
+	target_debug("hba[%d] - Detached HBA from Generic Target Core\n", hba->hba_id);
 
 	module_put(hba->backend->ops->owner);
 
drivers/target/target_core_iblock.c +17 -18
index 25cc0815e590..bf6b95285d80 100644
@@ -47,7 +47,7 @@ static inline struct iblock_dev *IBLOCK_DEV(struct se_device *dev)
 
 static int iblock_attach_hba(struct se_hba *hba, u32 host_id)
 {
-	target_debug("CORE_HBA[%d] - TCM iBlock HBA Driver %s on Generic Target Core Stack %s\n",
+	target_debug("hba[%d] - TCM iBlock HBA Driver %s on Generic Target Core Stack %s\n",
 		     hba->hba_id, IBLOCK_VERSION, TARGET_CORE_VERSION);
 	return 0;
 }
@@ -100,7 +100,7 @@ static int iblock_configure_device(struct se_device *dev)
 	int ret;
 
 	if (!(ib_dev->ibd_flags & IBDF_HAS_UDEV_PATH)) {
-		target_err("Missing udev_path= parameters for IBLOCK\n");
+		target_err("Missing udev_path= parameters\n");
 		return -EINVAL;
 	}
 
@@ -175,8 +175,7 @@ static int iblock_configure_device(struct se_device *dev)
 			ret = -ENOMEM;
 			goto out_blkdev_put;
 		}
-		target_debug("IBLOCK setup BIP bs->bio_integrity_pool: %p\n",
-			     &bs->bio_integrity_pool);
+		target_debug("Setup BIP bs->bio_integrity_pool: %p\n", &bs->bio_integrity_pool);
 	}
 
 	dev->dev_attrib.hw_pi_prot_type = dev->dev_attrib.pi_prot_type;
@@ -344,7 +343,7 @@ static void iblock_bio_done(struct bio *bio)
 	blk_status_t blk_status = bio->bi_status;
 
 	if (bio->bi_status) {
-		target_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
+		target_cmd_err(cmd, "bio error: %p,  err: %d\n", bio, bio->bi_status);
 		/*
 		 * Bump the ib_bio_err_cnt and release bio.
 		 */
@@ -370,7 +369,7 @@ static struct bio *iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num,
 	bio = bio_alloc_bioset(ib_dev->ibd_bd, bio_max_segs(sg_num), opf,
 			       GFP_NOIO, &ib_dev->ibd_bio_set);
 	if (!bio) {
-		target_err("Unable to allocate memory for bio\n");
+		target_cmd_err(cmd, "Unable to allocate memory for bio\n");
 		return NULL;
 	}
 
@@ -400,7 +399,7 @@ static void iblock_end_io_flush(struct bio *bio)
 	struct se_cmd *cmd = bio->bi_private;
 
 	if (bio->bi_status)
-		target_err("cache flush failed: %d\n", bio->bi_status);
+		target_cmd_err(cmd, "Cache flush failed: %d\n", bio->bi_status);
 
 	if (cmd) {
 		if (bio->bi_status)
@@ -451,7 +450,7 @@ iblock_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
 				   target_to_linux_sector(dev,  nolb),
 				   GFP_KERNEL);
 	if (ret < 0) {
-		target_err("blkdev_issue_discard() failed: %d\n", ret);
+		target_cmd_err(cmd, "blkdev_issue_discard() failed: %d\n", ret);
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 
@@ -505,7 +504,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
 					sbc_get_write_same_sectors(cmd));
 
 	if (cmd->prot_op) {
-		target_err("WRITE_SAME: Protection information with IBLOCK backends not supported\n");
+		target_cmd_err(cmd, "WRITE_SAME: Protection information with IBLOCK backends not supported\n");
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 
@@ -516,8 +515,8 @@ iblock_execute_write_same(struct se_cmd *cmd)
 
 	if (cmd->t_data_nents > 1 ||
 	    sg->length != cmd->se_dev->dev_attrib.block_size) {
-		target_err("WRITE_SAME: Illegal SGL t_data_nents: %u length: %u block_size: %u\n",
-			   cmd->t_data_nents, sg->length, cmd->se_dev->dev_attrib.block_size);
+		target_cmd_err(cmd, "WRITE_SAME: Illegal SGL t_data_nents: %u length: %u block_size: %u\n",
+			       cmd->t_data_nents, sg->length, cmd->se_dev->dev_attrib.block_size);
 		return TCM_INVALID_CDB_FIELD;
 	}
 
@@ -680,13 +679,13 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio,
 
 	bi = bdev_get_integrity(ib_dev->ibd_bd);
 	if (!bi) {
-		target_err("Unable to locate bio_integrity\n");
+		target_cmd_err(cmd, "Unable to locate bio_integrity\n");
 		return -ENODEV;
 	}
 
 	bip = bio_integrity_alloc(bio, GFP_NOIO, bio_max_segs(cmd->t_prot_nents));
 	if (IS_ERR(bip)) {
-		target_err("Unable to allocate bio_integrity_payload\n");
+		target_cmd_err(cmd, "Unable to allocate bio_integrity_payload\n");
 		return PTR_ERR(bip);
 	}
 
@@ -694,8 +693,8 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio,
 	bip_set_seed(bip, bio->bi_iter.bi_sector >>
 				  (bi->interval_exp - SECTOR_SHIFT));
 
-	target_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size,
-		     (unsigned long long)bip->bip_iter.bi_sector);
+	target_cmd_debug(cmd, "BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size,
+			 (unsigned long long)bip->bip_iter.bi_sector);
 
 	resid = bio_integrity_bytes(bi, bio_sectors(bio));
 	while (resid > 0 && sg_miter_next(miter)) {
@@ -704,13 +703,13 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio,
 		rc = bio_integrity_add_page(bio, miter->page, len,
 					    offset_in_page(miter->addr));
 		if (rc != len) {
-			target_err("bio_integrity_add_page() failed; %d\n", rc);
+			target_cmd_err(cmd, "bio_integrity_add_page() failed; %d\n", rc);
 			sg_miter_stop(miter);
 			return -ENOMEM;
 		}
 
-		target_debug("Added bio integrity page: %p length: %zu offset: %lu\n", miter->page,
-			     len, offset_in_page(miter->addr));
+		target_cmd_debug(cmd, "Added bio integrity page: %p length: %zu offset: %lu\n",
+				 miter->page, len, offset_in_page(miter->addr));
 
 		resid -= len;
 		if (len < miter->length)
drivers/target/target_core_pr.c +184 -169

877 lines not on this page · raw message

drivers/target/target_core_pscsi.c +22 -22

150 lines not on this page · raw message

drivers/target/target_core_rd.c +11 -11
index 3a109a61c83b..c460e9b4c83d 100644
@@ -44,7 +44,7 @@ static int rd_attach_hba(struct se_hba *hba, u32 host_id)
 
 	hba->hba_ptr = rd_host;
 
-	target_debug("CORE_HBA[%d] - TCM Ramdisk HBA Driver %s on Generic Target Core Stack %s\n",
+	target_debug("hba[%d] - TCM Ramdisk HBA Driver %s on Generic Target Core Stack %s\n",
 		     hba->hba_id, RD_HBA_VERSION, TARGET_CORE_VERSION);
 
 	return 0;
@@ -54,8 +54,8 @@ static void rd_detach_hba(struct se_hba *hba)
 {
 	struct rd_host *rd_host = hba->hba_ptr;
 
-	target_debug("CORE_HBA[%d] - Detached Ramdisk HBA: %u from Generic Target Core\n",
-		     hba->hba_id, rd_host->rd_host_id);
+	target_debug("hba[%d] - Detached Ramdisk HBA: %u from Generic Target Core\n", hba->hba_id,
+		     rd_host->rd_host_id);
 
 	kfree(rd_host);
 	hba->hba_ptr = NULL;
@@ -96,7 +96,7 @@ static void rd_release_device_space(struct rd_dev *rd_dev)
 	page_count = rd_release_sgl_table(rd_dev, rd_dev->sg_table_array,
 					  rd_dev->sg_table_count);
 
-	target_debug("CORE_RD[%u] - Released device space for Ramdisk Device ID: %u, pages %u in %u tables total bytes %lu\n",
+	target_debug("host[%u] - Released device space for Ramdisk Device ID: %u, pages %u in %u tables total bytes %lu\n",
 		     rd_dev->rd_host->rd_host_id, rd_dev->rd_dev_id, page_count,
 		     rd_dev->sg_table_count, (unsigned long)page_count * PAGE_SIZE);
 
@@ -201,7 +201,7 @@ static int rd_build_device_space(struct rd_dev *rd_dev)
 	if (rc)
 		return rc;
 
-	target_debug("CORE_RD[%u] - Built Ramdisk Device ID: %u space of %u pages in %u tables\n",
+	target_debug("host[%u] - Built Ramdisk Device ID: %u space of %u pages in %u tables\n",
 		     rd_dev->rd_host->rd_host_id, rd_dev->rd_dev_id, rd_dev->rd_page_count,
 		     rd_dev->sg_table_count);
 
@@ -218,7 +218,7 @@ static void rd_release_prot_space(struct rd_dev *rd_dev)
 	page_count = rd_release_sgl_table(rd_dev, rd_dev->sg_prot_array,
 					  rd_dev->sg_prot_count);
 
-	target_debug("CORE_RD[%u] - Released protection space for Ramdisk Device ID: %u, pages %u in %u tables total bytes %lu\n",
+	target_debug("host[%u] - Released protection space for Ramdisk Device ID: %u, pages %u in %u tables total bytes %lu\n",
 		     rd_dev->rd_host->rd_host_id, rd_dev->rd_dev_id, page_count,
 		     rd_dev->sg_table_count, (unsigned long)page_count * PAGE_SIZE);
 
@@ -256,7 +256,7 @@ static int rd_build_prot_space(struct rd_dev *rd_dev, int prot_length, int block
 	if (rc)
 		return rc;
 
-	target_debug("CORE_RD[%u] - Built Ramdisk Device ID: %u prot space of %u pages in %u tables\n",
+	target_debug("host[%u] - Built Ramdisk Device ID: %u prot space of %u pages in %u tables\n",
 		     rd_dev->rd_host->rd_host_id, rd_dev->rd_dev_id, total_sg_needed,
 		     rd_dev->sg_prot_count);
 
@@ -299,7 +299,7 @@ static int rd_configure_device(struct se_device *dev)
 
 	rd_dev->rd_dev_id = rd_host->rd_host_dev_id_count++;
 
-	target_debug("CORE_RD[%u] - Added TCM MEMCPY Ramdisk Device ID: %u of %u pages in %u tables, %lu total bytes\n",
+	target_debug("host[%u] - Added TCM MEMCPY Ramdisk Device ID: %u of %u pages in %u tables, %lu total bytes\n",
 		     rd_host->rd_host_id, rd_dev->rd_dev_id, rd_dev->rd_page_count,
 		     rd_dev->sg_table_count, (unsigned long)(rd_dev->rd_page_count * PAGE_SIZE));
 
@@ -437,7 +437,7 @@ rd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	rd_sg = &table->sg_table[rd_page - table->page_start_offset];
 
-	target_debug("RD[%u]: %s LBA: %llu, Size: %u Page: %u, Offset: %u\n", dev->rd_dev_id,
+	target_debug("device[%u]: %s LBA: %llu, Size: %u Page: %u, Offset: %u\n", dev->rd_dev_id,
 		     data_direction == DMA_FROM_DEVICE ? "Read" : "Write", cmd->t_task_lba, rd_size,
 		     rd_page, rd_offset);
 
@@ -458,14 +458,14 @@ rd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 		sg_miter_next(&m);
 		if (!(u32)m.length) {
-			target_debug("RD[%u]: invalid sgl %p len %zu\n", dev->rd_dev_id, m.addr,
+			target_debug("device[%u]: invalid sgl %p len %zu\n", dev->rd_dev_id, m.addr,
 				     m.length);
 			sg_miter_stop(&m);
 			return TCM_INCORRECT_AMOUNT_OF_DATA;
 		}
 		len = min((u32)m.length, src_len);
 		if (len > rd_size) {
-			target_debug("RD[%u]: size underrun page %d offset %d size %d\n",
+			target_debug("device[%u]: size underrun page %d offset %d size %d\n",
 				     dev->rd_dev_id, rd_page, rd_offset, rd_size);
 			len = rd_size;
 		}
drivers/target/target_core_sbc.c +61 -59

308 lines not on this page · raw message

drivers/target/target_core_spc.c +9 -11
index ce59b5f02ef0..2d506e672bff 100644
@@ -744,7 +744,7 @@ spc_emulate_inquiry(struct se_cmd *cmd)
 
 	buf = kzalloc(SE_INQUIRY_BUF, GFP_KERNEL);
 	if (!buf) {
-		target_err("Unable to allocate response buffer for INQUIRY\n");
+		target_cmd_err(cmd, "Unable to allocate response buffer for INQUIRY\n");
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 
@@ -752,7 +752,7 @@ spc_emulate_inquiry(struct se_cmd *cmd)
 
 	if (!(cdb[1] & 0x1)) {
 		if (cdb[2]) {
-			target_err("INQUIRY with EVPD==0 but PAGE CODE=%02x\n", cdb[2]);
+			target_cmd_err(cmd, "INQUIRY with EVPD==0 but PAGE CODE=%02x\n", cdb[2]);
 			ret = TCM_INVALID_CDB_FIELD;
 			goto out;
 		}
@@ -771,7 +771,7 @@ spc_emulate_inquiry(struct se_cmd *cmd)
 		}
 	}
 
-	target_debug("Unknown VPD Code: 0x%02x\n", cdb[2]);
+	target_cmd_debug(cmd, "Unknown VPD Code: 0x%02x\n", cdb[2]);
 	ret = TCM_INVALID_CDB_FIELD;
 
 out:
@@ -1086,7 +1086,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd)
 
 	if (page == 0x3f) {
 		if (subpage != 0x00 && subpage != 0xff) {
-			target_warn("MODE_SENSE: Invalid subpage code: 0x%02x\n", subpage);
+			target_cmd_warn(cmd, "MODE_SENSE: Invalid subpage code: 0x%02x\n", subpage);
 			return TCM_INVALID_CDB_FIELD;
 		}
 
@@ -1120,8 +1120,8 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd)
 	 *  - obsolete page 03h "format parameters" (checked by Solaris)
 	 */
 	if (page != 0x03)
-		target_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", page,
-			   subpage);
+		target_cmd_debug(cmd, "MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n",
+				 page, subpage);
 
 	return TCM_UNKNOWN_MODE_PAGE;
 
@@ -1213,7 +1213,7 @@ static sense_reason_t spc_emulate_request_sense(struct se_cmd *cmd)
 	memset(buf, 0, SE_SENSE_BUF);
 
 	if (cdb[1] & 0x01) {
-		target_err("REQUEST_SENSE description emulation not supported\n");
+		target_cmd_err(cmd, "REQUEST_SENSE description emulation not supported\n");
 		return TCM_INVALID_CDB_FIELD;
 	}
 
@@ -2113,7 +2113,6 @@ static sense_reason_t
 spc_rsoc_get_descr(struct se_cmd *cmd, struct target_opcode_descriptor **opcode)
 {
 	struct target_opcode_descriptor *descr;
-	struct se_session *sess = cmd->se_sess;
 	unsigned char *cdb = cmd->t_task_cdb;
 	u8 opts = cdb[2] & 0x3;
 	u8 requested_opcode;
@@ -2125,9 +2124,8 @@ spc_rsoc_get_descr(struct se_cmd *cmd, struct target_opcode_descriptor **opcode)
 	*opcode = NULL;
 
 	if (opts > 3) {
-		target_debug("TARGET_CORE[%s]: Invalid REPORT SUPPORTED OPERATION CODES with unsupported REPORTING OPTIONS %#x for 0x%08llx from %s\n",
-			     cmd->se_tfo->fabric_name, opts, cmd->se_lun->unpacked_lun,
-			     sess->se_node_acl->initiatorname);
+		target_cmd_debug(cmd, "Invalid REPORT SUPPORTED OPERATION CODES with unsupported REPORTING OPTIONS %#x for 0x%08llx\n",
+				 opts, cmd->se_lun->unpacked_lun);
 		return TCM_INVALID_CDB_FIELD;
 	}
 
drivers/target/target_core_tmr.c +10 -9
index db3b0467105d..867a2d604b2f 100644
@@ -89,8 +89,8 @@ static bool __target_check_io_state(struct se_cmd *se_cmd,
 	 */
 	spin_lock(&se_cmd->t_state_lock);
 	if (se_cmd->transport_state & (CMD_T_COMPLETE | CMD_T_FABRIC_STOP)) {
-		target_debug("Attempted to abort io tag: %llu already complete or fabric stop, skipping\n",
-			     se_cmd->tag);
+		target_cmd_debug(se_cmd, "Attempted to abort io tag: %llu already complete or fabric stop, skipping\n",
+				 se_cmd->tag);
 		spin_unlock(&se_cmd->t_state_lock);
 		return false;
 	}
@@ -136,8 +136,8 @@ void core_tmr_abort_task(
 			if (tmr->ref_task_tag != ref_tag)
 				continue;
 
-			target_err("ABORT_TASK: Found referenced %s task_tag: %llu\n",
-				   se_cmd->se_tfo->fabric_name, ref_tag);
+			target_cmd_err(se_cmd, "ABORT_TASK: Found referenced %s task_tag: %llu\n",
+				       se_cmd->se_tfo->fabric_name, ref_tag);
 
 			spin_lock(&se_sess->sess_cmd_lock);
 			rc = __target_check_io_state(se_cmd, se_sess, 0);
@@ -237,9 +237,9 @@ static void core_tmr_drain_tmr_list(
 		list_del_init(&tmr_p->tmr_list);
 		cmd = tmr_p->task_cmd;
 
-		target_debug("LUN_RESET: %s releasing TMR %p Function: 0x%02x, Response: 0x%02x, t_state: %d\n",
-			     (preempt_and_abort_list) ? "Preempt" : "", tmr_p, tmr_p->function,
-			     tmr_p->response, cmd->t_state);
+		target_cmd_debug(cmd, "LUN_RESET: %s releasing TMR %p Function: 0x%02x, Response: 0x%02x, t_state: %d\n",
+				 (preempt_and_abort_list) ? "Preempt" : "", tmr_p, tmr_p->function,
+				 tmr_p->response, cmd->t_state);
 
 		target_put_cmd_and_wait(cmd);
 	}
@@ -344,8 +344,9 @@ static void core_tmr_drain_state_list(
 		list_del_init(&cmd->state_list);
 
 		target_show_cmd("LUN_RESET: ", cmd);
-		target_debug("LUN_RESET: ITT[0x%08llx] - %s pr_res_key: 0x%016Lx\n", cmd->tag,
-			     (preempt_and_abort_list) ? "preempt" : "", cmd->pr_res_key);
+		target_cmd_debug(cmd, "LUN_RESET: ITT[0x%08llx] - %s pr_res_key: 0x%016Lx\n",
+				 cmd->tag, (preempt_and_abort_list) ? "preempt" : "",
+				 cmd->pr_res_key);
 
 		target_put_cmd_and_wait(cmd);
 	}
drivers/target/target_core_tpg.c +4 -5
index 3f0b53032aeb..633f64b36aaf 100644
@@ -136,9 +136,8 @@ void core_tpg_add_node_to_devs(
 				lun_access_ro = false;
 		}
 
-		target_debug("TARGET_CORE[%s]->TPG[%u]_LUN[%llu] - Adding %s access for LUN in Demo Mode\n",
-			     tpg->se_tpg_tfo->fabric_name, tpg->se_tpg_tfo->tpg_get_tag(tpg),
-			     lun->unpacked_lun, lun_access_ro ? "READ-ONLY" : "READ-WRITE");
+		target_lun_debug(lun, "Adding %s access for LUN in Demo Mode\n",
+				 lun_access_ro ? "READ-ONLY" : "READ-WRITE");
 
 		core_enable_device_list_for_node(lun, NULL, lun->unpacked_lun,
 						 lun_access_ro, acl, tpg);
@@ -544,7 +543,7 @@ int core_tpg_register(
 		}
 	}
 
-	target_debug("TARGET_CORE[%s]: Allocated portal_group for endpoint: %s, Proto: %d, Portal Tag: %u\n",
+	target_debug("[%s]: Allocated portal_group for endpoint: %s, Proto: %d, Portal Tag: %u\n",
 		     se_tpg->se_tpg_tfo->fabric_name,
 		     se_tpg->se_tpg_tfo->tpg_get_wwn(se_tpg) ?
 		     se_tpg->se_tpg_tfo->tpg_get_wwn(se_tpg) : NULL,
@@ -560,7 +559,7 @@ int core_tpg_deregister(struct se_portal_group *se_tpg)
 	struct se_node_acl *nacl, *nacl_tmp;
 	LIST_HEAD(node_list);
 
-	target_debug("TARGET_CORE[%s]: Deallocating portal_group for endpoint: %s, Proto: %d, Portal Tag: %u\n",
+	target_debug("[%s]: Deallocating portal_group for endpoint: %s, Proto: %d, Portal Tag: %u\n",
 		     tfo->fabric_name, tfo->tpg_get_wwn(se_tpg) ? tfo->tpg_get_wwn(se_tpg) : NULL,
 		     se_tpg->proto_id, tfo->tpg_get_tag(se_tpg));
 
drivers/target/target_core_transport.c +52 -52

268 lines not on this page · raw message

drivers/target/target_core_ua.c +7 -7
index 11d50a1da03c..df4d884b76ae 100644
@@ -253,11 +253,11 @@ bool core_scsi3_ua_for_check_condition(struct se_cmd *cmd, u8 *key, u8 *asc,
 	spin_unlock(&deve->ua_lock);
 	rcu_read_unlock();
 
-	target_debug("[%s]: %s UNIT ATTENTION condition with INTLCK_CTRL: %d, mapped LUN: %llu, got CDB: 0x%02x reported ASC: 0x%02x, ASCQ: 0x%02x\n",
-		     nacl->se_tpg->se_tpg_tfo->fabric_name,
-		     dev_ua_intlck_clear ? "Releasing" : "Reporting",
-		     dev->dev_attrib.emulate_ua_intlck_ctrl, cmd->orig_fe_lun, cmd->t_task_cdb[0],
-		     *asc, *ascq);
+	target_cmd_debug(cmd, "[%s]: %s UNIT ATTENTION condition with INTLCK_CTRL: %d, mapped LUN: %llu, got CDB: 0x%02x reported ASC: 0x%02x, ASCQ: 0x%02x\n",
+			 nacl->se_tpg->se_tpg_tfo->fabric_name,
+			 dev_ua_intlck_clear ? "Releasing" : "Reporting",
+			 dev->dev_attrib.emulate_ua_intlck_ctrl, cmd->orig_fe_lun,
+			 cmd->t_task_cdb[0], *asc, *ascq);
 
 	return head == 0;
 }
@@ -313,8 +313,8 @@ int core_scsi3_ua_clear_for_request_sense(
 	spin_unlock(&deve->ua_lock);
 	rcu_read_unlock();
 
-	target_debug("[%s]: Released UNIT ATTENTION condition, mapped LUN: %llu, got REQUEST_SENSE reported ASC: 0x%02x, ASCQ: 0x%02x\n",
-		     nacl->se_tpg->se_tpg_tfo->fabric_name, cmd->orig_fe_lun, *asc, *ascq);
+	target_cmd_debug(cmd, "[%s]: Released UNIT ATTENTION condition, mapped LUN: %llu, got REQUEST_SENSE reported ASC: 0x%02x, ASCQ: 0x%02x\n",
+			 nacl->se_tpg->se_tpg_tfo->fabric_name, cmd->orig_fe_lun, *asc, *ascq);
 
 	return (head) ? -EPERM : 0;
 }
drivers/target/target_core_xcopy.c +92 -88

456 lines not on this page · raw message

Signature · 1 line
2.40.3
#9 lore raw

Re: [PATCH 08/10] target: core: Use extended logs where possible

kernel test robot noticed the following build warnings:

Hi Anastasia,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on linus/master next-20241128] [cannot apply to v6.12]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Anastasia-Kovaleva/target-core-Improve-SCSI-target-logs/20241129-234412
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20241129153056.6985-9-a.kovaleva%40yadro.com
patch subject: [PATCH 08/10] target: core: Use extended logs where possible
config: arc-randconfig-001-20241130 (https://download.01.org/0day-ci/archive/20241130/[email protected]/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/target/target_core_pr.c:75:26: warning: 'pr_preempt_type_table_str' defined but not used [-Wunused-const-variable=]
      75 | static const char *const pr_preempt_type_table_str[] = {
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/target/target_core_pr.c:64:26: warning: 'pr_register_type_table_str' defined but not used [-Wunused-const-variable=]
      64 | static const char *const pr_register_type_table_str[] = {
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/pr_preempt_type_table_str +75 drivers/target/target_core_pr.c

    63	
  > 64	static const char *const pr_register_type_table_str[] = {
    65		"REGISTER",
    66		"REGISTER_AND_IGNORE_EXISTING_KEY",
    67		"REGISTER_AND_MOVE",
    68	};
    69	
    70	enum preempt_type {
    71		PREEMPT,
    72		PREEMPT_AND_ABORT,
    73	};
    74	
  > 75	static const char *const pr_preempt_type_table_str[] = {
    76		"PREEMPT",
    77		"PREEMPT_AND_ABORT",
    78	};
    79	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#10 lore raw

Re: [PATCH 08/10] target: core: Use extended logs where possible

In reply to Anastasia Kovaleva
kernel test robot noticed the following build warnings:

Hi Anastasia,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on linus/master next-20241128] [cannot apply to v6.12]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Anastasia-Kovaleva/target-core-Improve-SCSI-target-logs/20241129-234412
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20241129153056.6985-9-a.kovaleva%40yadro.com
patch subject: [PATCH 08/10] target: core: Use extended logs where possible
config: arm64-randconfig-003-20241130 (https://download.01.org/0day-ci/archive/20241130/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/target/target_core_pr.c:64:26: warning: unused variable 'pr_register_type_table_str' [-Wunused-const-variable]
      64 | static const char *const pr_register_type_table_str[] = {
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/target/target_core_pr.c:75:26: warning: unused variable 'pr_preempt_type_table_str' [-Wunused-const-variable]
      75 | static const char *const pr_preempt_type_table_str[] = {
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~

2 warnings generated.

vim +/pr_register_type_table_str +64 drivers/target/target_core_pr.c

    63	
  > 64	static const char *const pr_register_type_table_str[] = {
    65		"REGISTER",
    66		"REGISTER_AND_IGNORE_EXISTING_KEY",
    67		"REGISTER_AND_MOVE",
    68	};
    69	
    70	enum preempt_type {
    71		PREEMPT,
    72		PREEMPT_AND_ABORT,
    73	};
    74	
  > 75	static const char *const pr_preempt_type_table_str[] = {
    76		"PREEMPT",
    77		"PREEMPT_AND_ABORT",
    78	};
    79	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#11 lore raw

PATCH 9/10 target: Use __func__ in logs

In reply to Anastasia Kovaleva

Replace hardcoded function names in log messages with __func__ macro.

---
 drivers/target/iscsi/iscsi_target_configfs.c |  2 +-
 drivers/target/iscsi/iscsi_target_nego.c     | 24 ++++++++++----------
 drivers/target/iscsi/iscsi_target_util.c     |  2 +-
 drivers/target/sbp/sbp_target.c              | 12 +++++-----
 4 files changed, 20 insertions(+), 20 deletions(-)
drivers/target/iscsi/iscsi_target_configfs.c +1 -1
index 14c95c38d002..2a35dbc1a6e3 100644
@@ -1518,7 +1518,7 @@ static void lio_release_cmd(struct se_cmd *se_cmd)
 {
 	struct iscsit_cmd *cmd = container_of(se_cmd, struct iscsit_cmd, se_cmd);
 
-	target_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd);
+	target_debug("Entering %s() for se_cmd: %p\n", __func__, se_cmd);
 	iscsit_release_cmd(cmd);
 }
 
drivers/target/iscsi/iscsi_target_nego.c +12 -12
index 2af5ca83ab67..91cd365294df 100644
@@ -375,7 +375,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
 	bool rc;
 
 	trace_sk_data_ready(sk);
-	target_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);
+	target_debug("Entering %s(): conn: %p\n", __func__, conn);
 
 	write_lock_bh(&sk->sk_callback_lock);
 	if (!sk->sk_user_data) {
@@ -403,7 +403,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
 
 	rc = schedule_delayed_work(&conn->login_work, 0);
 	if (!rc) {
-		target_debug("iscsi_target_sk_data_ready, schedule_delayed_work got false\n");
+		target_debug("%s(): schedule_delayed_work got false\n", __func__);
 	}
 	write_unlock_bh(&sk->sk_callback_lock);
 }
@@ -418,7 +418,7 @@ static void iscsi_target_set_sock_callbacks(struct iscsit_conn *conn)
 		return;
 
 	sk = conn->sock->sk;
-	target_debug("Entering iscsi_target_set_sock_callbacks: conn: %p\n", conn);
+	target_debug("Entering %s(): conn: %p\n", __func__, conn);
 
 	write_lock_bh(&sk->sk_callback_lock);
 	sk->sk_user_data = conn;
@@ -440,7 +440,7 @@ static void iscsi_target_restore_sock_callbacks(struct iscsit_conn *conn)
 		return;
 
 	sk = conn->sock->sk;
-	target_debug("Entering iscsi_target_restore_sock_callbacks: conn: %p\n", conn);
+	target_debug("Entering %s(): conn: %p\n", __func__, conn);
 
 	write_lock_bh(&sk->sk_callback_lock);
 	if (!sk->sk_user_data) {
@@ -461,7 +461,7 @@ static int iscsi_target_do_login(struct iscsit_conn *, struct iscsi_login *);
 static bool __iscsi_target_sk_check_close(struct sock *sk)
 {
 	if (sk->sk_state == TCP_CLOSE_WAIT || sk->sk_state == TCP_CLOSE) {
-		target_debug("__iscsi_target_sk_check_close: TCP_CLOSE_WAIT|TCP_CLOSE,returning TRUE\n");
+		target_debug("%s(): TCP_CLOSE_WAIT|TCP_CLOSE, returning TRUE\n", __func__);
 		return true;
 	}
 	return false;
@@ -533,7 +533,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
 	int rc, zero_tsih = login->zero_tsih;
 	bool state;
 
-	target_debug("entering iscsi_target_do_login_rx, conn: %p, %s:%d\n", conn, current->comm,
+	target_debug("Entering %s(), conn: %p, %s:%d\n", __func__, conn, current->comm,
 		     current->pid);
 
 	spin_lock(&conn->login_worker_lock);
@@ -559,12 +559,12 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
 	spin_unlock(&tpg->tpg_state_lock);
 
 	if (!state) {
-		target_debug("iscsi_target_do_login_rx: tpg_state != TPG_STATE_ACTIVE\n");
+		target_debug("%s(): tpg_state != TPG_STATE_ACTIVE\n", __func__);
 		goto err;
 	}
 
 	if (iscsi_target_sk_check_close(conn)) {
-		target_debug("iscsi_target_do_login_rx, TCP state CLOSE\n");
+		target_debug("%s(): TCP state CLOSE\n", __func__);
 		goto err;
 	}
 
@@ -572,7 +572,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
 	rc = iscsit_set_login_timer_kworker(conn, current);
 	if (rc < 0) {
 		/* The login timer has already expired */
-		target_debug("iscsi_target_do_login_rx, login failed\n");
+		target_debug("%s(): login failed\n", __func__);
 		goto err;
 	}
 
@@ -582,7 +582,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
 	if (rc < 0)
 		goto err;
 
-	target_debug("iscsi_target_do_login_rx after rx_login_io, %p, %s:%d\n", conn, current->comm,
+	target_debug("%s(): after rx_login_io, %p, %s:%d\n", __func__, conn, current->comm,
 		     current->pid);
 
 	/*
@@ -646,7 +646,7 @@ static void iscsi_target_sk_state_change(struct sock *sk)
 	void (*orig_state_change)(struct sock *);
 	bool state;
 
-	target_debug("Entering iscsi_target_sk_state_change\n");
+	target_debug("Entering %s()\n", __func__);
 
 	write_lock_bh(&sk->sk_callback_lock);
 	conn = sk->sk_user_data;
@@ -697,7 +697,7 @@ static void iscsi_target_sk_state_change(struct sock *sk)
 	 * the remaining iscsi connection resources.
 	 */
 	if (state) {
-		target_debug("iscsi_target_sk_state_change got failed state\n");
+		target_debug("%s() got failed state\n", __func__);
 		set_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags);
 		state = test_bit(LOGIN_FLAGS_INITIAL_PDU, &conn->login_flags);
 		write_unlock_bh(&sk->sk_callback_lock);
drivers/target/iscsi/iscsi_target_util.c +1 -1
index 01d74ae5fa96..a5ddec6b08f2 100644
@@ -1031,7 +1031,7 @@ void iscsit_login_timeout(struct timer_list *t)
 	struct iscsit_conn *conn = from_timer(conn, t, login_timer);
 	struct iscsi_login *login = conn->login;
 
-	target_debug("Entering iscsi_target_login_timeout >>>>>>>>>>>>>>>>>>>\n");
+	target_debug("Entering %s() >>>>>>>>>>>>>>>>>>>\n", __func__);
 
 	spin_lock_bh(&conn->login_timer_lock);
 	login->login_failed = 1;
drivers/target/sbp/sbp_target.c +6 -6
index 868ddda4dcf3..6bd7eced72ac 100644
@@ -1115,7 +1115,7 @@ static int sbp_fetch_command(struct sbp_target_request *req)
 		min_t(int, cmd_len, sizeof(req->orb.command_block)));
 
 	if (cmd_len > sizeof(req->orb.command_block)) {
-		target_debug("sbp_fetch_command: filling in long command\n");
+		target_debug("%s(): filling in long command\n", __func__);
 		copy_len = cmd_len - sizeof(req->orb.command_block);
 
 		ret = sbp_run_request_transaction(req,
@@ -1194,20 +1194,20 @@ static void sbp_handle_command(struct sbp_target_request *req)
 
 	ret = sbp_fetch_command(req);
 	if (ret) {
-		target_debug("sbp_handle_command: fetch command failed: %d\n", ret);
+		target_debug("%s(): fetch command failed: %d\n", __func__, ret);
 		goto err;
 	}
 
 	ret = sbp_fetch_page_table(req);
 	if (ret) {
-		target_debug("sbp_handle_command: fetch page table failed: %d\n", ret);
+		target_debug("%s(): fetch page table failed: %d\n", __func__, ret);
 		goto err;
 	}
 
 	unpacked_lun = req->login->login_lun;
 	sbp_calc_data_length_direction(req, &data_length, &data_dir);
 
-	target_debug("sbp_handle_command ORB:0x%llx unpacked_lun:%d data_len:%d data_dir:%d\n",
+	target_debug("%s(): ORB:0x%llx unpacked_lun:%d data_len:%d data_dir:%d\n", __func__,
 		     req->orb_pointer, unpacked_lun, data_length, data_dir);
 
 	/* only used for printk until we do TMRs */
@@ -1329,12 +1329,12 @@ static int sbp_send_status(struct sbp_target_request *req)
 	rc = sbp_run_request_transaction(req, TCODE_WRITE_BLOCK_REQUEST,
 			login->status_fifo_addr, &req->status, length);
 	if (rc != RCODE_COMPLETE) {
-		target_debug("sbp_send_status: write failed: 0x%x\n", rc);
+		target_debug("%s(): write failed: 0x%x\n", __func__, rc);
 		ret = -EIO;
 		goto put_ref;
 	}
 
-	target_debug("sbp_send_status: status write complete for ORB: 0x%llx\n", req->orb_pointer);
+	target_debug("%s(): status write complete for ORB: 0x%llx\n", __func__, req->orb_pointer);
 	/*
 	 * Drop the extra ACK_KREF reference taken by target_submit_cmd()
 	 * ahead of sbp_check_stop_free() -> transport_generic_free_cmd()
Signature · 1 line
2.40.3
#12 lore raw

PATCH 10/10 target: iscsi: Improve a log message

In reply to Anastasia Kovaleva

Change the log message to a useful one.

---
 drivers/target/iscsi/iscsi_target_parameters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target_parameters.c +1 -1
index 9eae01538696..587a7a69405b 100644
@@ -1143,7 +1143,7 @@ static int iscsi_check_value(struct iscsi_param *param, char *value)
 			if (iscsi_check_string_or_list_value(param, value) < 0)
 				return -1;
 		} else {
-			target_err("Huh? 0x%02x\n", param->type);
+			target_err("Unknown parameter: 0x%02x\n", param->type);
 			return -1;
 		}
 
Signature · 1 line
2.40.3