From patchwork Fri Sep 25 16:19:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 350A9C4363D for ; Fri, 25 Sep 2020 16:19:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBF7620809 for ; Fri, 25 Sep 2020 16:19:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GiCp44yq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729134AbgIYQTg (ORCPT ); Fri, 25 Sep 2020 12:19:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58666 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728996AbgIYQTg (ORCPT ); Fri, 25 Sep 2020 12:19:36 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juqylsxeQnN8xlFt8c6sVAPHOTqPVpJEMIV/U4qDUJ8=; b=GiCp44yqCMIo95SShtDiM0rrFD2jxnlozPShXkFzJHfkVjkba0n2x57BNVwR7cTrf+NRR/ I8wgIr7T36ZFWvG3CTgq+fvyExYyIitkuwtVMtNsAoOdVquvGX36P0tm7pwuGwVq4HhAF/ V94kDUD5k2r7cLinR+QDcrj1oOJd38Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-BJlZSyQYPdyld3HWcjUD-w-1; Fri, 25 Sep 2020 12:19:33 -0400 X-MC-Unique: BJlZSyQYPdyld3HWcjUD-w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DA8281F03D; Fri, 25 Sep 2020 16:19:32 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EB5D5D9DC; Fri, 25 Sep 2020 16:19:31 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 01/12] struct device: Add function callback durable_name Date: Fri, 25 Sep 2020 11:19:18 -0500 Message-Id: <20200925161929.1136806-2-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Function callback and function to be used to write a persistent durable name to the supplied character buffer. This will be used to add structured key-value data to log messages for hardware related errors which allows end users to correlate message and specific hardware. Signed-off-by: Tony Asleson --- drivers/base/core.c | 24 ++++++++++++++++++++++++ include/linux/device.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 05d414e9e8a4..88696ade8bfc 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2489,6 +2489,30 @@ int dev_set_name(struct device *dev, const char *fmt, ...) } EXPORT_SYMBOL_GPL(dev_set_name); +/** + * dev_durable_name - Write "DURABLE_NAME"= in buffer + * @dev: device + * @buffer: character buffer to write results + * @len: length of buffer + * @return: Number of bytes written to buffer + */ +int dev_durable_name(const struct device *dev, char *buffer, size_t len) +{ + int tmp, dlen; + + if (dev && dev->durable_name) { + tmp = snprintf(buffer, len, "DURABLE_NAME="); + if (tmp < len) { + dlen = dev->durable_name(dev, buffer + tmp, + len - tmp); + if (dlen > 0 && ((dlen + tmp) < len)) + return dlen + tmp; + } + } + return 0; +} +EXPORT_SYMBOL_GPL(dev_durable_name); + /** * device_to_dev_kobj - select a /sys/dev/ directory for the device * @dev: device diff --git a/include/linux/device.h b/include/linux/device.h index 5efed864b387..074125999dd8 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -614,6 +614,8 @@ struct device { struct iommu_group *iommu_group; struct dev_iommu *iommu; + int (*durable_name)(const struct device *dev, char *buff, size_t len); + bool offline_disabled:1; bool offline:1; bool of_node_reused:1; @@ -655,6 +657,8 @@ static inline const char *dev_name(const struct device *dev) extern __printf(2, 3) int dev_set_name(struct device *dev, const char *name, ...); +int dev_durable_name(const struct device *d, char *buffer, size_t len); + #ifdef CONFIG_NUMA static inline int dev_to_node(struct device *dev) { From patchwork Fri Sep 25 16:19:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 257528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B99D9C4741F for ; Fri, 25 Sep 2020 16:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76FB822B2D for ; Fri, 25 Sep 2020 16:19:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hVavjcj6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727874AbgIYQTh (ORCPT ); Fri, 25 Sep 2020 12:19:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33991 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728996AbgIYQTh (ORCPT ); Fri, 25 Sep 2020 12:19:37 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NmMNFZem4zxwx8zsacxizdBtvT6u9qJjyTu6Rji6vJI=; b=hVavjcj6bTQgFGcbQ9n8AkmVcmzHdw4q6QORhGmn+Ncy/40jhO98uFDP65J3AvbXgC3Pyp lWCOTCuQmXkMICCuCDAOh6+gT8zCWEChRp0KaDe5xv79Y43mAJLBuqjB1ZCCrmaCMmLb8V 45feOp53EwVqzacSNqtNQB1ToChxiXY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-WgbhSpbDOseWmP0nrURg3A-1; Fri, 25 Sep 2020 12:19:34 -0400 X-MC-Unique: WgbhSpbDOseWmP0nrURg3A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E649801AAC; Fri, 25 Sep 2020 16:19:33 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90F2D5D9DC; Fri, 25 Sep 2020 16:19:32 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 02/12] create_syslog_header: Add durable name Date: Fri, 25 Sep 2020 11:19:19 -0500 Message-Id: <20200925161929.1136806-3-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This gets us a persistent durable name for code that logs messages in the block layer that have the appropriate callbacks setup for durable name. Signed-off-by: Tony Asleson --- drivers/base/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 88696ade8bfc..adef36d4b475 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3864,6 +3864,7 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen) { const char *subsys; size_t pos = 0; + int dlen; if (dev->class) subsys = dev->class->name; @@ -3906,6 +3907,10 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen) "DEVICE=+%s:%s", subsys, dev_name(dev)); } + dlen = dev_durable_name(dev, hdr + (pos + 1), hdrlen - (pos + 1)); + if (dlen) + pos += dlen + 1; + if (pos >= hdrlen) goto overflow; From patchwork Fri Sep 25 16:19:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81023C4727D for ; Fri, 25 Sep 2020 16:19:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D9E121D7A for ; Fri, 25 Sep 2020 16:19:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Usm+W0Ra" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729431AbgIYQTk (ORCPT ); Fri, 25 Sep 2020 12:19:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33506 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728443AbgIYQTi (ORCPT ); Fri, 25 Sep 2020 12:19:38 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tjfyyqBk18iK3mdk298NBEQQwB4z45w48Rk7GFdPx3g=; b=Usm+W0RaSVWQNz5FDoRFyadWj+A84Wr87Iwx7kLKo8YsIutN0KbBVfPusJADXPwpykWduq XpeFobEUSVozWWJ46BjiwE3AR7Aq7HVETJFW/YsrOz91ddz8ei8bgMlAWkSZ0LQSWE2UR+ 6Mh3tMdaXyjEwRWkHEwUeSn139yKfW8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-562-Gc0cH_BDPRmq_HAU3k6tPg-1; Fri, 25 Sep 2020 12:19:35 -0400 X-MC-Unique: Gc0cH_BDPRmq_HAU3k6tPg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D9691DDF3; Fri, 25 Sep 2020 16:19:34 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFBCB5D9DC; Fri, 25 Sep 2020 16:19:33 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 03/12] dev_vprintk_emit: Increase hdr size Date: Fri, 25 Sep 2020 11:19:20 -0500 Message-Id: <20200925161929.1136806-4-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org With the addition of the device persistent id we have the possibility of adding 154 more bytes to the hdr. Thus if we assume the previous size of 128 was sufficient we can simply add the 2 amounts and round up. Signed-off-by: Tony Asleson --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index adef36d4b475..72a93b041a2d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3924,7 +3924,7 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen) int dev_vprintk_emit(int level, const struct device *dev, const char *fmt, va_list args) { - char hdr[128]; + char hdr[288]; size_t hdrlen; hdrlen = create_syslog_header(dev, hdr, sizeof(hdr)); From patchwork Fri Sep 25 16:19:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296658 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E2CCC47432 for ; Fri, 25 Sep 2020 16:19:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AF6A235FD for ; Fri, 25 Sep 2020 16:19:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Z1XU8uol" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729503AbgIYQTn (ORCPT ); Fri, 25 Sep 2020 12:19:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21868 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729472AbgIYQTk (ORCPT ); Fri, 25 Sep 2020 12:19:40 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I8nvqUGVqAwMorQosWtn1/SwIepEf1j+KL4FD6RqP0c=; b=Z1XU8uolsY5vaAsSn7NUydYMBU/wzpcui/H3Vrbx3wSnhLXNZO3PWbkgLVXseD3W2ZBLm7 L0vpkgraCNUOOOfabANj846rx0rMv/uH3OFnKqNW1G+8B8/eqNEkFrgaM4wqo8ZMn2u9jn e73UUp2bWBbSn25q/zEnd4XlvwJkfF0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-590-3_Q53fmcNXCUjYOrAROw0w-1; Fri, 25 Sep 2020 12:19:36 -0400 X-MC-Unique: 3_Q53fmcNXCUjYOrAROw0w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D371104FC89; Fri, 25 Sep 2020 16:19:35 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id CED4A5D9DC; Fri, 25 Sep 2020 16:19:34 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 04/12] scsi: Add durable_name for dev_printk Date: Fri, 25 Sep 2020 11:19:21 -0500 Message-Id: <20200925161929.1136806-5-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add the needed functions to fill out the durable_name function call back for scsi based storage devices. This allows calls into dev_printk for scsi devices to have a persistent id associated with them. Signed-off-by: Tony Asleson --- drivers/scsi/scsi_lib.c | 9 +++++++++ drivers/scsi/scsi_sysfs.c | 35 ++++++++++++++++++++++++++++------- drivers/scsi/sd.c | 2 ++ include/scsi/scsi_device.h | 3 +++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 06056e9ec333..aa5601733763 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -3151,3 +3151,12 @@ int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id) return group_id; } EXPORT_SYMBOL(scsi_vpd_tpg_id); + +int scsi_durable_name(struct scsi_device *sdev, char *buf, size_t len) +{ + int vpd_len = scsi_vpd_lun_id(sdev, buf, len); + if (vpd_len > 0 && vpd_len < len) + return vpd_len + 1; + return 0; +} +EXPORT_SYMBOL(scsi_durable_name); diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 163dbcb741c1..c4840bc80b47 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -504,15 +504,19 @@ static struct class sdev_class = { .dev_release = scsi_device_cls_release, }; +static struct scsi_device *dev_to_scsi_device(const struct device *dev) +{ + return dev->type == &scsi_dev_type ? to_scsi_device(dev) : NULL; +} + /* all probing is done in the individual ->probe routines */ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv) { - struct scsi_device *sdp; + struct scsi_device *sdp = dev_to_scsi_device(dev); - if (dev->type != &scsi_dev_type) + if (!sdp) return 0; - sdp = to_scsi_device(dev); if (sdp->no_uld_attach) return 0; return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0; @@ -520,13 +524,11 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv) static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { - struct scsi_device *sdev; + struct scsi_device *sdev = dev_to_scsi_device(dev); - if (dev->type != &scsi_dev_type) + if (!sdev) return 0; - sdev = to_scsi_device(dev); - add_uevent_var(env, "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type); return 0; } @@ -1582,6 +1584,24 @@ static struct device_type scsi_dev_type = { .groups = scsi_sdev_attr_groups, }; +int dev_to_scsi_durable_name(const struct device *dev, char *buf, size_t len) +{ + /* + * When we go through dev_printk in the scsi layer, dev is embedded + * in a struct scsi_device. When we go through the block layer, + * dev is embedded in struct genhd, thus we need different paths to + * retrieve the struct scsi_device to call scsi_durable_name. + */ + struct scsi_device *sdev = dev_to_scsi_device(dev); + if (!sdev) + sdev = dev_to_scsi_device(dev->parent); + if (!sdev) + return 0; + + return scsi_durable_name(sdev, buf, len); +} +EXPORT_SYMBOL(dev_to_scsi_durable_name); + void scsi_sysfs_device_initialize(struct scsi_device *sdev) { unsigned long flags; @@ -1591,6 +1611,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) device_initialize(&sdev->sdev_gendev); sdev->sdev_gendev.bus = &scsi_bus_type; sdev->sdev_gendev.type = &scsi_dev_type; + sdev->sdev_gendev.durable_name = dev_to_scsi_durable_name; dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu", sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d90fefffe31b..69ff339fa5ea 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3386,6 +3386,8 @@ static int sd_probe(struct device *dev) gd->private_data = &sdkp->driver; gd->queue = sdkp->device->request_queue; + disk_to_dev(gd)->durable_name = dev_to_scsi_durable_name; + /* defaults, until the device tells us otherwise */ sdp->sector_size = 512; sdkp->capacity = 0; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index bc5909033d13..7b6cff11d502 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -464,6 +464,9 @@ extern void sdev_disable_disk_events(struct scsi_device *sdev); extern void sdev_enable_disk_events(struct scsi_device *sdev); extern int scsi_vpd_lun_id(struct scsi_device *, char *, size_t); extern int scsi_vpd_tpg_id(struct scsi_device *, int *); +extern int dev_to_scsi_durable_name(const struct device *dev, char *buf, + size_t len); +extern int scsi_durable_name(struct scsi_device *sdev, char *buf, size_t len); #ifdef CONFIG_PM extern int scsi_autopm_get_device(struct scsi_device *); From patchwork Fri Sep 25 16:19:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67C2BC47423 for ; Fri, 25 Sep 2020 16:19:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D05121D7A for ; Fri, 25 Sep 2020 16:19:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HyJqWlmG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729511AbgIYQTo (ORCPT ); Fri, 25 Sep 2020 12:19:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32867 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729469AbgIYQTn (ORCPT ); Fri, 25 Sep 2020 12:19:43 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rwAc6IYMXXgAxXrjBQyg7IGNXahbd5GI5Gq+iFjPuIQ=; b=HyJqWlmGPEAeHSYwEkWKBiTT7AWQIuLpbpcGsQg5fyI4uE37gg2BK/lalDqNz2JKJCrDt5 4XVGc1Kcw6leo28hQkzn8Rv3POrfC9hfo1NU6XJlfkD7cdhYMac/g7j4E2d8E7xU6JndGw CYCMGZk3st04MUJKgFdKeyitbShtuek= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538-Z-mNMkj8MP-ubHS7T7yGJw-1; Fri, 25 Sep 2020 12:19:37 -0400 X-MC-Unique: Z-mNMkj8MP-ubHS7T7yGJw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB4231DDF3; Fri, 25 Sep 2020 16:19:36 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id E17A55D9DC; Fri, 25 Sep 2020 16:19:35 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 05/12] nvme: Add durable name for dev_printk Date: Fri, 25 Sep 2020 11:19:22 -0500 Message-Id: <20200925161929.1136806-6-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Changed the comment from // to /* and re-worked buffer space needed for formatting wwid as requested by Keith Busch. ref. https://lore.kernel.org/linux-block/20200513230455.GA1503@redsun51.ssa.fujisawa.hgst.com/ Signed-off-by: Tony Asleson --- drivers/nvme/host/core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 4ee2330c603e..2e3b808c7815 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2734,6 +2734,22 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys, return true; } +static ssize_t wwid_show(struct device *dev, struct device_attribute *attr, + char *buf); + +static int dev_to_nvme_durable_name(const struct device *dev, char *buf, size_t len) +{ + /* + * Max 141 needed for wwid_show, make sure we have the space available + * in our buffer before we format the wwid directly into it. + */ + if (len >= 141) { + ssize_t wwid_len = wwid_show((struct device *)dev, NULL, buf); + return wwid_len > 0 ? wwid_len - 1 : 0; /* remove '\n' */ + } + return 0; +} + static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) { struct nvme_subsystem *subsys, *found; @@ -3663,6 +3679,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) disk->queue = ns->queue; disk->flags = flags; memcpy(disk->disk_name, disk_name, DISK_NAME_LEN); + disk_to_dev(disk)->durable_name = dev_to_nvme_durable_name; + ns->disk = disk; if (__nvme_revalidate_disk(disk, id)) From patchwork Fri Sep 25 16:19:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 257526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB93DC47420 for ; Fri, 25 Sep 2020 16:19:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B9CB21D7A for ; Fri, 25 Sep 2020 16:19:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g5VPU+kj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729540AbgIYQTs (ORCPT ); Fri, 25 Sep 2020 12:19:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31038 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729480AbgIYQTn (ORCPT ); Fri, 25 Sep 2020 12:19:43 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANY2qnzvW5slLXQEnRPDZ8OvNs0Obq0WqgEdDcyBR9E=; b=g5VPU+kj5IERHKjczBgRvQPuSJa325X8+lwnD+Q/UtbJM7RMZTbMhndQrM9972pMF7ews0 a2U0B4vvc6FUWHBCWFyhBuI6GiKrcBHIvU/3EUuu/1D3XwdKTz2FMNpr5r0vDtvQPRlm5Q u/eSWlzEXDUiGD50dfxap4nJ+UxfAO0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-Xdn-GAWHPDq-o_t1u0PIGQ-1; Fri, 25 Sep 2020 12:19:38 -0400 X-MC-Unique: Xdn-GAWHPDq-o_t1u0PIGQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D93E210BBED2; Fri, 25 Sep 2020 16:19:37 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 162515D9DC; Fri, 25 Sep 2020 16:19:36 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 06/12] libata: Add ata_scsi_durable_name Date: Fri, 25 Sep 2020 11:19:23 -0500 Message-Id: <20200925161929.1136806-7-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Function used to create the durable name for ata scsi. Signed-off-by: Tony Asleson --- drivers/ata/libata-scsi.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 46336084b1a9..194dac7dbdca 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1086,6 +1086,13 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) return 0; } +int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len) +{ + struct ata_device *ata_dev = container_of(dev, struct ata_device, tdev); + + return scsi_durable_name(ata_dev->sdev, buf, len); +} + /** * ata_scsi_slave_config - Set SCSI device attributes * @sdev: SCSI device to examine @@ -1102,14 +1109,19 @@ int ata_scsi_slave_config(struct scsi_device *sdev) { struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); - int rc = 0; + int rc; ata_scsi_sdev_config(sdev); - if (dev) + if (dev) { rc = ata_scsi_dev_config(sdev, dev); + if (rc) + return rc; - return rc; + dev->tdev.durable_name = ata_scsi_durable_name; + } + + return 0; } EXPORT_SYMBOL_GPL(ata_scsi_slave_config); From patchwork Fri Sep 25 16:19:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 257523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD03AC47429 for ; Fri, 25 Sep 2020 16:19:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A3DB20809 for ; Fri, 25 Sep 2020 16:19:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KzhkwtZA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729484AbgIYQT5 (ORCPT ); Fri, 25 Sep 2020 12:19:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42832 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729493AbgIYQTn (ORCPT ); Fri, 25 Sep 2020 12:19:43 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zuPbP3Dh/kHk7MosTe8SMu7B3ELSVFAGeHkzLThiUQY=; b=KzhkwtZAS6P+PrK000zAyWGM3gUnZShyreOBT7iSo71CdBzNebJKmdMEXKjkgrlv7ze0fx E0u9jIFHVNmeFbQp1upkc+RKQgv8T2HFoIYO5jLfz/DsWlLt7RoZtOe+rEzSpQo1qwv4pe OhyjYbyuiXVxdaSE8JaqXF0/rjWTlWs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-506-UiiPqmYmMrCQGJeUQVwRfA-1; Fri, 25 Sep 2020 12:19:40 -0400 X-MC-Unique: UiiPqmYmMrCQGJeUQVwRfA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E617D10BBED3; Fri, 25 Sep 2020 16:19:38 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2807A5D9DC; Fri, 25 Sep 2020 16:19:38 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 07/12] libata: Make ata_scsi_durable_name static Date: Fri, 25 Sep 2020 11:19:24 -0500 Message-Id: <20200925161929.1136806-8-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Tony Asleson Signed-off-by: kernel test robot --- drivers/ata/libata-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 194dac7dbdca..13a58ed7184c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1086,7 +1086,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) return 0; } -int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len) +static int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len) { struct ata_device *ata_dev = container_of(dev, struct ata_device, tdev); From patchwork Fri Sep 25 16:19:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 037B3C47420 for ; Fri, 25 Sep 2020 16:19:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1ACC2311D for ; Fri, 25 Sep 2020 16:19:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hyTgD2ZA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729524AbgIYQTz (ORCPT ); Fri, 25 Sep 2020 12:19:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20440 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729517AbgIYQTp (ORCPT ); Fri, 25 Sep 2020 12:19:45 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F6eo05v4RI1S7qaxLX6OH/af8QrKhgKrDe4W0YSlPVc=; b=hyTgD2ZAUdVWyRKmAFVSKtXfwrZsiVKwsb4yh2NFJwW4dWCwcKVhCDNyn8VzwhG95uN+tF gR62cHPO6X8S9VKyiLPMhZ9rutyufPBq+Y1/ORii7K3H/dAi8L/O5XD8aUwHkj8cpcKJHK jMWb4AVGKtbuhbE/o9ZRRfk8nLsKqKU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-183-7H6l-eN7MamwiCKrXZX-kA-1; Fri, 25 Sep 2020 12:19:42 -0400 X-MC-Unique: 7H6l-eN7MamwiCKrXZX-kA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0DCC1104FC80; Fri, 25 Sep 2020 16:19:40 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41F335D9DC; Fri, 25 Sep 2020 16:19:39 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 08/12] Add durable_name_printk Date: Fri, 25 Sep 2020 11:19:25 -0500 Message-Id: <20200925161929.1136806-9-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Ideally block related code would standardize on using dev_printk, but dev_printk does change the user visible messages which is questionable. Adding this function which adds the structured key/value durable name to the log entry. It has the same signature as dev_printk. In the future, code that is using this could easily transition to dev_printk when that becomes workable. Signed-off-by: Tony Asleson --- drivers/base/core.c | 15 +++++++++++++++ include/linux/dev_printk.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 72a93b041a2d..447b0ebc93af 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3975,6 +3975,21 @@ void dev_printk(const char *level, const struct device *dev, } EXPORT_SYMBOL(dev_printk); +void durable_name_printk(const char *level, const struct device *dev, + const char *fmt, ...) +{ + size_t dictlen; + va_list args; + char dict[288]; + + dictlen = dev_durable_name(dev, dict, sizeof(dict)); + + va_start(args, fmt); + vprintk_emit(0, level[1] - '0', dict, dictlen, fmt, args); + va_end(args); +} +EXPORT_SYMBOL(durable_name_printk); + #define define_dev_printk_level(func, kern_level) \ void func(const struct device *dev, const char *fmt, ...) \ { \ diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h index 3028b644b4fb..4d57b940b692 100644 --- a/include/linux/dev_printk.h +++ b/include/linux/dev_printk.h @@ -32,6 +32,11 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); __printf(3, 4) __cold void dev_printk(const char *level, const struct device *dev, const char *fmt, ...); + +__printf(3, 4) __cold +void durable_name_printk(const char *level, const struct device *dev, + const char *fmt, ...); + __printf(2, 3) __cold void _dev_emerg(const struct device *dev, const char *fmt, ...); __printf(2, 3) __cold From patchwork Fri Sep 25 16:19:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 257525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C42F6C47426 for ; Fri, 25 Sep 2020 16:19:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ADA22344C for ; Fri, 25 Sep 2020 16:19:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YLKAhDSG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729545AbgIYQTw (ORCPT ); Fri, 25 Sep 2020 12:19:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38226 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729525AbgIYQTq (ORCPT ); Fri, 25 Sep 2020 12:19:46 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6namRKwyl41y70rGoFYuQn74j+aa0S3vYKcYpbMpaLA=; b=YLKAhDSGMl2IBRIXWbUpnlzyndcLAa8svBg/4at1iLITFGulyPhKppRrpJiybpixa0YgcX YM9EMqYdo4Da/PnsYtXzyNFaIqsoLOo7sVTD2MQ20j/VY73I8FVe0XwP/et2eS6WUjoeaF RKKqVT79JyVEEbx/rtUM4m4e3RQ8KHA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-716peKunOrer45eL0-rxew-1; Fri, 25 Sep 2020 12:19:42 -0400 X-MC-Unique: 716peKunOrer45eL0-rxew-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EDFD87130C; Fri, 25 Sep 2020 16:19:41 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 524465D9DC; Fri, 25 Sep 2020 16:19:40 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 09/12] libata: use durable_name_printk Date: Fri, 25 Sep 2020 11:19:26 -0500 Message-Id: <20200925161929.1136806-10-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Utilize durable_name_printk to associate the durable name with the log message via structured data. The user visible portion of the log message is unchanged. Signed-off-by: Tony Asleson --- drivers/ata/libata-core.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b1cd4d97bc2a..11200b861ce8 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6443,7 +6443,8 @@ void ata_port_printk(const struct ata_port *ap, const char *level, vaf.fmt = fmt; vaf.va = &args; - printk("%sata%u: %pV", level, ap->print_id, &vaf); + durable_name_printk(level, &ap->tdev, "ata%u: %pV", + ap->print_id, &vaf); va_end(args); } @@ -6461,11 +6462,11 @@ void ata_link_printk(const struct ata_link *link, const char *level, vaf.va = &args; if (sata_pmp_attached(link->ap) || link->ap->slave_link) - printk("%sata%u.%02u: %pV", - level, link->ap->print_id, link->pmp, &vaf); + durable_name_printk(level, &link->tdev, "ata%u.%02u: %pV", + link->ap->print_id, link->pmp, &vaf); else - printk("%sata%u: %pV", - level, link->ap->print_id, &vaf); + durable_name_printk(level, &link->tdev, "ata%u: %pV", + link->ap->print_id, &vaf); va_end(args); } @@ -6482,9 +6483,9 @@ void ata_dev_printk(const struct ata_device *dev, const char *level, vaf.fmt = fmt; vaf.va = &args; - printk("%sata%u.%02u: %pV", - level, dev->link->ap->print_id, dev->link->pmp + dev->devno, - &vaf); + durable_name_printk(level, &dev->tdev, "ata%u.%02u: %pV", + dev->link->ap->print_id, dev->link->pmp + dev->devno, + &vaf); va_end(args); } From patchwork Fri Sep 25 16:19:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6574C47431 for ; Fri, 25 Sep 2020 16:19:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 797D82344C for ; Fri, 25 Sep 2020 16:19:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SMwzqXnR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729547AbgIYQTy (ORCPT ); Fri, 25 Sep 2020 12:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43424 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729522AbgIYQTp (ORCPT ); Fri, 25 Sep 2020 12:19:45 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JVm1mp3p8i8CqDumdPNUgn0vv7qi6XfNucb1VG5u2E8=; b=SMwzqXnRKMTCW4hKlscsr5jYUwAXN5YFP2aiPr/hWrqZpqYxz3sLUThx0aYyc5Gl72FTks mc/dUWZEqerEe3EXLZfbLt9um9nci6gfiaBiFJ0ZWsh36AzcvEKHLwxMR8vwfSH1cSvtqq /yghLGb4iqhg/MzKhgSIil2zPpggEyI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-NIvPIg8dOka0XoIinW8uFA-1; Fri, 25 Sep 2020 12:19:43 -0400 X-MC-Unique: NIvPIg8dOka0XoIinW8uFA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31A4326557; Fri, 25 Sep 2020 16:19:42 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6211E5D9DC; Fri, 25 Sep 2020 16:19:41 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 10/12] Add durable_name_printk_ratelimited Date: Fri, 25 Sep 2020 11:19:27 -0500 Message-Id: <20200925161929.1136806-11-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Create a rate limited macro for durable_name_printk so that we can use this for printk_ratelimited usage in the block layers and add the durable name key/value to the log message. Signed-off-by: Tony Asleson --- include/linux/dev_printk.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h index 4d57b940b692..9fd675b9ac7c 100644 --- a/include/linux/dev_printk.h +++ b/include/linux/dev_printk.h @@ -37,6 +37,15 @@ __printf(3, 4) __cold void durable_name_printk(const char *level, const struct device *dev, const char *fmt, ...); +#define durable_name_printk_ratelimited(level, dev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + durable_name_printk(level, dev, fmt, ##__VA_ARGS__); \ +} while (0) + __printf(2, 3) __cold void _dev_emerg(const struct device *dev, const char *fmt, ...); __printf(2, 3) __cold From patchwork Fri Sep 25 16:19:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 296659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D227C4742B for ; Fri, 25 Sep 2020 16:19:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9E4622B2D for ; Fri, 25 Sep 2020 16:19:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="d8DpOf+w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729530AbgIYQTu (ORCPT ); Fri, 25 Sep 2020 12:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46060 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729354AbgIYQTr (ORCPT ); Fri, 25 Sep 2020 12:19:47 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=36St5Oeqqpx9UTR9cd+r4hzn7jyQrQgdXE6WFtjZ9NY=; b=d8DpOf+wxiLFIzDok497bSG+hr17mrL4ah26onXo/cxMbdmvLAxi5nTih/Hynm3wMMV4g3 QSuop1zg5H8PuCn0xxC43YpQY/NlJ4+HQpMbZFSxa2rQRGogkQL+sYdR3zP+5qCFS/Bhr1 ULoP+vo+P+8czWbsygfBwJzpw6E4Edg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-zhfDJ7mRODmiJN2qUJywsg-1; Fri, 25 Sep 2020 12:19:44 -0400 X-MC-Unique: zhfDJ7mRODmiJN2qUJywsg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5153810BBECD; Fri, 25 Sep 2020 16:19:43 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 833095D9DC; Fri, 25 Sep 2020 16:19:42 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 11/12] print_req_error: Use durable_name_printk_ratelimited Date: Fri, 25 Sep 2020 11:19:28 -0500 Message-Id: <20200925161929.1136806-12-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Replace printk_ratelimited with one that adds the key/value durable name to log entry. Signed-off-by: Tony Asleson --- block/blk-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 03252af8c82c..59e0ff583eb6 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -218,12 +218,15 @@ EXPORT_SYMBOL_GPL(blk_status_to_errno); static void print_req_error(struct request *req, blk_status_t status, const char *caller) { + struct device *dev; int idx = (__force int)status; if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors))) return; - printk_ratelimited(KERN_ERR + dev = req->rq_disk ? disk_to_dev(req->rq_disk) : NULL; + + durable_name_printk_ratelimited(KERN_ERR, dev, "%s: %s error, dev %s, sector %llu op 0x%x:(%s) flags 0x%x " "phys_seg %u prio class %u\n", caller, blk_errors[idx].name, From patchwork Fri Sep 25 16:19:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 257524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7806FC4363D for ; Fri, 25 Sep 2020 16:19:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CC352311D for ; Fri, 25 Sep 2020 16:19:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WfS2ojw6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729538AbgIYQTt (ORCPT ); Fri, 25 Sep 2020 12:19:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51174 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729534AbgIYQTs (ORCPT ); Fri, 25 Sep 2020 12:19:48 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=josTUHWqNyzesA2exKGBBZWjajhUHsqLRfrpS+k19OQ=; b=WfS2ojw6JESgTsa2y87aPwxj0OJJiSxQlMqu0u9/4JQDIzTj54E1h4R7Co4n5c9xcY8rT8 1kqZE04HJUyWDI84uzpDQoKJBgei3GGjw/3skwKF9q3yB4tYFvn8buyVhElOQ+1WNHt8KW iiKkJSr/F9QBHsQLbSFAWjzHfyZ661E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-432-IyxQ6YfPNM-NvfhphXgtww-1; Fri, 25 Sep 2020 12:19:45 -0400 X-MC-Unique: IyxQ6YfPNM-NvfhphXgtww-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 723AB8712FD; Fri, 25 Sep 2020 16:19:44 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3D385D9DC; Fri, 25 Sep 2020 16:19:43 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 12/12] buffer_io_error: Use durable_name_printk_ratelimited Date: Fri, 25 Sep 2020 11:19:29 -0500 Message-Id: <20200925161929.1136806-13-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Replace printk_ratelimited with one that adds the key/value durable name to log entry. Signed-off-by: Tony Asleson --- fs/buffer.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 64fe82ec65ff..5c4e5b4c82dd 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -125,10 +125,17 @@ EXPORT_SYMBOL(__wait_on_buffer); static void buffer_io_error(struct buffer_head *bh, char *msg) { - if (!test_bit(BH_Quiet, &bh->b_state)) - printk_ratelimited(KERN_ERR - "Buffer I/O error on dev %pg, logical block %llu%s\n", - bh->b_bdev, (unsigned long long)bh->b_blocknr, msg); + struct device *gendev; + + if (test_bit(BH_Quiet, &bh->b_state)) + return; + + gendev = bh->b_bdev->bd_disk ? + disk_to_dev(bh->b_bdev->bd_disk) : NULL; + + durable_name_printk_ratelimited(KERN_ERR, gendev, + "Buffer I/O error on dev %pg, logical block %llu%s\n", + bh->b_bdev, (unsigned long long)bh->b_blocknr, msg); } /*