From patchwork Wed Jul 26 11:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Kovaleva X-Patchwork-Id: 706876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F7E3C001B0 for ; Wed, 26 Jul 2023 12:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233832AbjGZMOe (ORCPT ); Wed, 26 Jul 2023 08:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233760AbjGZMOd (ORCPT ); Wed, 26 Jul 2023 08:14:33 -0400 X-Greylist: delayed 603 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 26 Jul 2023 05:14:31 PDT Received: from mta-04.yadro.com (mta-04.yadro.com [89.207.88.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE55B1996; Wed, 26 Jul 2023 05:14:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mta-04.yadro.com 3C4A6C0007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; s=mta-04; t=1690372545; bh=ICN7tlynP85fwkGe9KVycdQY4u70ICUlf+EORDl5EIw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=bczdRjMddyXzkQuWL/AsiPqaJfeoVSyD0OJpjAKj66M86aA//PpOFPGvHASN7auH9 zer/xACHr4Zc+rhlYrYfKMtOJtBfptBKd9coUmJdEWntvRBCK4dNuYatGv1h497qug 0KpRUIc+jwydR9YGAdSEHfqcDanWxiqAcMM1r6b93IK952yeAAjPdVxcstf03lvDlG mvM96EvU4r0hpZewVPMI2322rLkGtQvnKMBIo8b0D6p+FnWLdQMcVM99doIpjC+I+0 2palc68AB1XHguekOVJBXzAysBdwuqQZeCcIKtLqdZlWJR6JGyHIJDaBd0fqzjHIoI yBARvZ4E0e0rA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; s=mta-03; t=1690372545; bh=ICN7tlynP85fwkGe9KVycdQY4u70ICUlf+EORDl5EIw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=kgAf1yfwXgT6MIKUqV++OCVOTbrD1twg8LiONZktZPAoH3yJuCij6BrDOe5i6Bxy7 4ObMJvJvO9PcvJRVyq5H8ybiewaeeu/0MyRKJREEEDTPUu/MVP8iVCxXEq3IAHBgCE Umy9lCZ/M56EHzVY4YPnk/q9ISo3qtu4zkl1AZ8bwbCJij4NQDxqayy0+b7TXvP2Dd SRfak+jepgXnFh7mraJ/pFrd89z1DogbUKPNqOwiT4ubjqOTz0SjmhzxcERgeyhHef HihSMmU3JJ16gO8fzh3sD1Kifw1uDgpBC/OZe3bPPWKTva5ZLEZ0TjNP/uTmpFCbmO pnei4RtweErwQ== From: Anastasia Kovaleva To: , CC: , , Subject: [RFC PATCH 1/3] target: core: Initial work on improving SCSI target logs Date: Wed, 26 Jul 2023 14:55:07 +0300 Message-ID: <20230726115509.357-2-a.kovaleva@yadro.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230726115509.357-1-a.kovaleva@yadro.com> References: <20230726115509.357-1-a.kovaleva@yadro.com> MIME-Version: 1.0 X-ClientProxiedBy: T-EXCH-10.corp.yadro.com (172.17.11.60) To T-EXCH-09.corp.yadro.com (172.17.11.59) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Introduce the new logging wrapper. Signed-off-by: Anastasia Kovaleva --- include/target/target_core_base.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 159567359bbb..ba8c05dc3d54 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -11,6 +11,31 @@ #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_lun->lun_tpg->tpg_rtpi, \ + (cmd)->orig_fe_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_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_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_debug(fmt, ...) target_log(debug, fmt, ##__VA_ARGS__) +#define target_info(fmt, ...) target_log(info, fmt, ##__VA_ARGS__) +#define target_warn(fmt, ...) target_log(warn, fmt, ##__VA_ARGS__) +#define target_err(fmt, ...) target_log(err, fmt, ##__VA_ARGS__) + /* * Maximum size of a CDB that can be stored in se_cmd without allocating * memory dynamically for the CDB. From patchwork Wed Jul 26 11:55:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Kovaleva X-Patchwork-Id: 707461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81A37C41513 for ; Wed, 26 Jul 2023 12:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233886AbjGZMOf (ORCPT ); Wed, 26 Jul 2023 08:14:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233775AbjGZMOd (ORCPT ); Wed, 26 Jul 2023 08:14:33 -0400 Received: from mta-04.yadro.com (mta-04.yadro.com [89.207.88.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B482619B5; Wed, 26 Jul 2023 05:14:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mta-04.yadro.com D008BC0007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; s=mta-04; t=1690372546; bh=RXHNlK+J34Gch7AuwTA6STlGivOlgCC2+rOrTiYymHw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=lXT96hBUCZk0nf7DfimDbnxLgQfk2Cf7KKydxT+i1pXhhy70+eQhUMjjl4lU6z9e/ G4UZ1c2VR0LQZTw7BPOs1JmuWVHwvQjtZnyceGaWd/0yyhds4LTj/k8ma38qMAnMKt rdPh5XTGhYWyM8J8xqSZfSBtVvc6t8Smj9+3swUwHjXdEJb9BCM6IqQbwly9mER3MA 52sVtvu49vjXSfQdHgV2C4nkMmfDiLbgKRIeXKI+ssytx9evZYMzrHQWh5HDyta4YY VNqu/JzVDS+KD+WE6uo8T2O4xfDF4Hj1xSpmApUsJDhYN1Drb9FATp/9BvyZrt4/wj ggGlu/U/GfGqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; s=mta-03; t=1690372546; bh=RXHNlK+J34Gch7AuwTA6STlGivOlgCC2+rOrTiYymHw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=haKYp3ZPw7/TnlrM1WvF687JrkswEKvQ6F6bisMYWDiX5wT09yZKBHoh/lg3eJClW taWm6qsfvfzP1I+yw+u2wh0vhmEIiJzpvpUHT26YxWWx6MsXoYaADclDqODaMhvoOW MnS+ZeJy5Dnc+JYaMliA4cCtq5BeiaG3Oci/UhUKlzuKe05+A4KHyTMApxEP9rUhrn np7SwwBHDRSm0IKF5WanaicZhQw31dVfuvIbgDLvCpczU2W13Vs0HAPj2VkKz+h1zQ RrVkMEU/R/6YJYRp9XDGAJdGnOhxy7by4ik4GPFiqDKOHJg6yKhw3hfO06TyeLtlLA AL71+T2IqJw0A== From: Anastasia Kovaleva To: , CC: , , Subject: [RFC PATCH 2/3] target: core: apply the new wrapper to spc Date: Wed, 26 Jul 2023 14:55:08 +0300 Message-ID: <20230726115509.357-3-a.kovaleva@yadro.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230726115509.357-1-a.kovaleva@yadro.com> References: <20230726115509.357-1-a.kovaleva@yadro.com> MIME-Version: 1.0 X-ClientProxiedBy: T-EXCH-09.corp.yadro.com (172.17.11.59) To T-EXCH-09.corp.yadro.com (172.17.11.59) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Anastasia Kovaleva --- drivers/target/target_core_spc.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 50290abc07bc..8defcf11cde3 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -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; @@ -742,7 +744,7 @@ spc_emulate_inquiry(struct se_cmd *cmd) buf = kzalloc(SE_INQUIRY_BUF, GFP_KERNEL); if (!buf) { - pr_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; } @@ -750,8 +752,7 @@ spc_emulate_inquiry(struct se_cmd *cmd) if (!(cdb[1] & 0x1)) { if (cdb[2]) { - pr_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; } @@ -770,7 +771,7 @@ spc_emulate_inquiry(struct se_cmd *cmd) } } - pr_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: @@ -1085,7 +1086,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) if (page == 0x3f) { if (subpage != 0x00 && subpage != 0xff) { - pr_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; } @@ -1119,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) - pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", - page, subpage); + target_cmd_err(cmd, "MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", + page, subpage); return TCM_UNKNOWN_MODE_PAGE; @@ -1212,8 +1213,7 @@ static sense_reason_t spc_emulate_request_sense(struct se_cmd *cmd) memset(buf, 0, SE_SENSE_BUF); if (cdb[1] & 0x01) { - pr_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,11 +2124,9 @@ spc_rsoc_get_descr(struct se_cmd *cmd, struct target_opcode_descriptor **opcode) *opcode = NULL; if (opts > 3) { - pr_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; } From patchwork Wed Jul 26 11:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Kovaleva X-Patchwork-Id: 707460 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55714C001DE for ; Wed, 26 Jul 2023 12:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233905AbjGZMOj (ORCPT ); Wed, 26 Jul 2023 08:14:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233843AbjGZMOe (ORCPT ); Wed, 26 Jul 2023 08:14:34 -0400 Received: from mta-04.yadro.com (mta-04.yadro.com [89.207.88.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B46CA19AD; Wed, 26 Jul 2023 05:14:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mta-04.yadro.com A5B1BC0007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; s=mta-04; t=1690372548; bh=oUjTtSSfsT+s1M0rrU8Rr6IMXX0bGDYAJXHZaIsRH9U=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=oG35zqIKrBxClLAk716LZrrVqtuTE/EmYSEto6Phg0Nmp+k8jP5WqkXuTYjdzyDo6 ujdDvK1XGA/xSBA5Gjk/eC9SKT7zQgb99UumDwYmXwbuE2WoEQ9WnzmHLGvYX5liMP dOtIYEu1Orc9x/d7C17w4E6f8hEHB4mmCMES9T8D2WEePRarkaQt3Bmrrl8Z+drsAr sbaktD2KT+x4Kx7g5ddvXu50gZPmv07U0mz5uRxnGtLSNddqz5J8Fz7X9JFOY8owhd tLhexi+WkYiYR7MvSeWL47SivO0PpUFbOd/YiCnauQYuLhMtGgWA9o37sejTqhAvQp 1/Dg5TpgbdrOA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; s=mta-03; t=1690372548; bh=oUjTtSSfsT+s1M0rrU8Rr6IMXX0bGDYAJXHZaIsRH9U=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=lhlajvWusb9R02Qj9UoYnmJ/DC1cesjp4UIKBS32hRiZUHOxYAo3gtBbvkd3DsNyi rSeQpI3MN0tYmUnkh7Vy4SfrG3DPcCztv2sbDsXzWzTa4wf+ZDDSTgBd7Caf+CBO3z 9DvFYRw9zm11lqSt7NIdkDF4dFy9G6PdIxY0L5wpO2h5tymFztcaGMjK9Jl/K2Od2k UNM9RDJG680VrnpvcknsmIMMT1hK027v9feyBaAubIU25yed1tqdbIKkfH2hcZKm5t 2p5yi5iGb03kL6MV60MFB8tP3dfl9aFPWx+Z69VibDAVWUlFn0Cv0YbvbNYbqwsLBw 4Blf10LUYtirw== From: Anastasia Kovaleva To: , CC: , , Subject: [RFC PATCH 3/3] target: core: apply the new wrapper to iblock Date: Wed, 26 Jul 2023 14:55:09 +0300 Message-ID: <20230726115509.357-4-a.kovaleva@yadro.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230726115509.357-1-a.kovaleva@yadro.com> References: <20230726115509.357-1-a.kovaleva@yadro.com> MIME-Version: 1.0 X-ClientProxiedBy: T-EXCH-09.corp.yadro.com (172.17.11.59) To T-EXCH-09.corp.yadro.com (172.17.11.59) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Anastasia Kovaleva --- drivers/target/target_core_iblock.c | 94 ++++++++++++++--------------- 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index e6029ea87e2f..e8153d99a83b 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -37,6 +37,8 @@ #define IBLOCK_MAX_BIO_PER_TASK 32 /* max # of bios to submit at a time */ #define IBLOCK_BIO_POOL_SIZE 128 +#define TARGET_PREFIX "iblock" + static inline struct iblock_dev *IBLOCK_DEV(struct se_device *dev) { return container_of(dev, struct iblock_dev, dev); @@ -45,9 +47,8 @@ static inline struct iblock_dev *IBLOCK_DEV(struct se_device *dev) static int iblock_attach_hba(struct se_hba *hba, u32 host_id) { - pr_debug("CORE_HBA[%d] - TCM iBlock HBA Driver %s on" - " Generic Target Core Stack %s\n", hba->hba_id, - IBLOCK_VERSION, TARGET_CORE_VERSION); + target_debug("CORE_HBA[%d] - TCM iblock HBA Driver %s on Generic Target Core Stack %s\n", + hba->hba_id, IBLOCK_VERSION, TARGET_CORE_VERSION); return 0; } @@ -61,7 +62,7 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam ib_dev = kzalloc(sizeof(struct iblock_dev), GFP_KERNEL); if (!ib_dev) { - pr_err("Unable to allocate struct iblock_dev\n"); + target_err("Unable to allocate struct iblock_dev\n"); return NULL; } @@ -70,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; - pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name); + target_debug("Allocated ib_dev for %s\n", name); return &ib_dev->dev; @@ -98,17 +99,17 @@ static int iblock_configure_device(struct se_device *dev) int ret; if (!(ib_dev->ibd_flags & IBDF_HAS_UDEV_PATH)) { - pr_err("Missing udev_path= parameters for IBLOCK\n"); + target_err("Missing udev_path= parameters\n"); return -EINVAL; } ret = bioset_init(&ib_dev->ibd_bio_set, IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); if (ret) { - pr_err("IBLOCK: Unable to create bioset\n"); + target_err("Unable to create bioset\n"); goto out; } - pr_debug( "IBLOCK: Claiming struct block_device: %s\n", + target_debug("Claiming struct block_device: %s\n", ib_dev->ibd_udev_path); mode = FMODE_READ|FMODE_EXCL; @@ -151,8 +152,8 @@ static int iblock_configure_device(struct se_device *dev) if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-IP") || !strcmp(bi->profile->name, "T10-DIF-TYPE1-IP")) { - pr_err("IBLOCK export of blk_integrity: %s not" - " supported\n", bi->profile->name); + target_err("Export of blk_integrity: %s not supported\n", + bi->profile->name); ret = -ENOSYS; goto out_blkdev_put; } @@ -165,12 +166,12 @@ static int iblock_configure_device(struct se_device *dev) if (dev->dev_attrib.pi_prot_type) { if (bioset_integrity_create(bs, IBLOCK_BIO_POOL_SIZE) < 0) { - pr_err("Unable to allocate bioset for PI\n"); + target_err("Unable to allocate bioset for PI\n"); ret = -ENOMEM; goto out_blkdev_put; } - pr_debug("IBLOCK setup BIP bs->bio_integrity_pool: %p\n", - &bs->bio_integrity_pool); + target_debug("IBLOCK 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; } @@ -339,7 +340,7 @@ static void iblock_bio_done(struct bio *bio) blk_status_t blk_status = bio->bi_status; if (bio->bi_status) { - pr_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. */ @@ -365,7 +366,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) { - pr_err("Unable to allocate memory for bio\n"); + target_cmd_err(cmd, "Unable to allocate memory for bio\n"); return NULL; } @@ -395,7 +396,7 @@ static void iblock_end_io_flush(struct bio *bio) struct se_cmd *cmd = bio->bi_private; if (bio->bi_status) - pr_err("IBLOCK: 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) @@ -446,7 +447,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) { - pr_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; } @@ -500,8 +501,7 @@ iblock_execute_write_same(struct se_cmd *cmd) sbc_get_write_same_sectors(cmd)); if (cmd->prot_op) { - pr_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; } @@ -512,9 +512,8 @@ iblock_execute_write_same(struct se_cmd *cmd) if (cmd->t_data_nents > 1 || sg->length != cmd->se_dev->dev_attrib.block_size) { - pr_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; } @@ -600,8 +599,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev, switch (token) { case Opt_udev_path: if (ib_dev->ibd_bd) { - pr_err("Unable to set udev_path= while" - " ib_dev->ibd_bd exists\n"); + target_err("Unable to set udev_path= while ib_dev->ibd_bd exists\n"); ret = -EEXIST; goto out; } @@ -610,8 +608,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev, ret = -EINVAL; break; } - pr_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: @@ -623,12 +620,11 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev, ret = kstrtoul(arg_p, 0, &tmp_readonly); kfree(arg_p); if (ret < 0) { - pr_err("kstrtoul() failed for" - " readonly=\n"); + target_err("kstrtoul() failed for readonly=\n"); goto out; } ib_dev->ibd_readonly = tmp_readonly; - pr_debug("IBLOCK: readonly: %d\n", ib_dev->ibd_readonly); + target_debug("readonly: %d\n", ib_dev->ibd_readonly); break; case Opt_force: break; @@ -680,13 +676,13 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, bi = bdev_get_integrity(ib_dev->ibd_bd); if (!bi) { - pr_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)) { - pr_err("Unable to allocate bio_integrity_payload\n"); + target_cmd_err(cmd, "Unable to allocate bio_integrity_payload\n"); return PTR_ERR(bip); } @@ -695,8 +691,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)); - pr_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 = bip->bip_iter.bi_size; while (resid > 0 && sg_miter_next(miter)) { @@ -705,13 +701,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) { - pr_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; } - pr_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) @@ -845,7 +841,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key, int ret; if (!ops) { - pr_err("Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n"); + target_cmd_err(cmd, "Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -853,20 +849,20 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key, case PRO_REGISTER: case PRO_REGISTER_AND_IGNORE_EXISTING_KEY: if (!ops->pr_register) { - pr_err("block device does not support pr_register.\n"); + target_cmd_err(cmd, "block device does not support pr_register.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } /* The block layer pr ops always enables aptpl */ if (!aptpl) - pr_info("APTPL not set by initiator, but will be used.\n"); + target_cmd_info(cmd, "APTPL not set by initiator, but will be used.\n"); ret = ops->pr_register(bdev, key, sa_key, sa == PRO_REGISTER ? 0 : PR_FL_IGNORE_KEY); break; case PRO_RESERVE: if (!ops->pr_reserve) { - pr_err("block_device does not support pr_reserve.\n"); + target_cmd_err(cmd, "block_device does not support pr_reserve.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -874,7 +870,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key, break; case PRO_CLEAR: if (!ops->pr_clear) { - pr_err("block_device does not support pr_clear.\n"); + target_cmd_err(cmd, "block_device does not support pr_clear.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -883,7 +879,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key, case PRO_PREEMPT: case PRO_PREEMPT_AND_ABORT: if (!ops->pr_clear) { - pr_err("block_device does not support pr_preempt.\n"); + target_cmd_err(cmd, "block_device does not support pr_preempt.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -893,14 +889,14 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key, break; case PRO_RELEASE: if (!ops->pr_clear) { - pr_err("block_device does not support pr_pclear.\n"); + target_cmd_err(cmd, "block_device does not support pr_pclear.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } ret = ops->pr_release(bdev, key, scsi_pr_type_to_block(type)); break; default: - pr_err("Unknown PERSISTENT_RESERVE_OUT SA: 0x%02x\n", sa); + target_cmd_err(cmd, "Unknown PERSISTENT_RESERVE_OUT SA: 0x%02x\n", sa); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -966,12 +962,12 @@ static sense_reason_t iblock_pr_read_keys(struct se_cmd *cmd, sense_reason_t ret; if (!ops) { - pr_err("Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n"); + target_cmd_err(cmd, "Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } if (!ops->pr_read_keys) { - pr_err("Block device does not support read_keys.\n"); + target_cmd_err(cmd, "Block device does not support read_keys.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -1033,12 +1029,12 @@ static sense_reason_t iblock_pr_read_reservation(struct se_cmd *cmd, struct pr_held_reservation rsv = { }; if (!ops) { - pr_err("Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n"); + target_cmd_err(cmd, "Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } if (!ops->pr_read_reservation) { - pr_err("Block device does not support read_keys.\n"); + target_cmd_err(cmd, "Block device does not support read_keys.\n"); return TCM_UNSUPPORTED_SCSI_OPCODE; } @@ -1080,7 +1076,7 @@ static sense_reason_t iblock_execute_pr_in(struct se_cmd *cmd, u8 sa, ret = iblock_pr_read_reservation(cmd, param_data); break; default: - pr_err("Unknown PERSISTENT_RESERVE_IN SA: 0x%02x\n", sa); + target_cmd_err(cmd, "Unknown PERSISTENT_RESERVE_IN SA: 0x%02x\n", sa); return TCM_UNSUPPORTED_SCSI_OPCODE; }