From patchwork Tue Jun 23 19:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 213708 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=-7.1 required=3.0 tests=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 5F3E9C433DF for ; Tue, 23 Jun 2020 19:18:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 312BB20888 for ; Tue, 23 Jun 2020 19:18:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JvmYPyeH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387510AbgFWTSB (ORCPT ); Tue, 23 Jun 2020 15:18:01 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34992 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387478AbgFWTSA (ORCPT ); Tue, 23 Jun 2020 15:18:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592939879; 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=Mw38SrAOK4PZpvbcKWC3wVsl3jfKtIJjGqTKE+RHMHI=; b=JvmYPyeHwWoE0WzsFKt2BjyaXGtG8yxD4GWb3RPmjqnN6qaE16B0I9w6KMwXzCRflhER67 OB5xwJ50ORt6aZFPHyEVtZE7ssQhKGH6eQvXTtlgfBVM/1alJyIKILwMm1z2N+g2od21nK ELjijTJTpDcKzr+wtay6+lO1rARm9Io= 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-37-h5LrkLiZO1yElnw2pIGn3w-1; Tue, 23 Jun 2020 15:17:58 -0400 X-MC-Unique: h5LrkLiZO1yElnw2pIGn3w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 057E418585A1; Tue, 23 Jun 2020 19:17:57 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.3.128.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0B4A71694; Tue, 23 Jun 2020 19:17:55 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org Subject: [RFC PATCH v3 4/8] buffer_io_error: Use dev_printk Date: Tue, 23 Jun 2020 14:17:45 -0500 Message-Id: <20200623191749.115200-5-tasleson@redhat.com> In-Reply-To: <20200623191749.115200-1-tasleson@redhat.com> References: <20200623191749.115200-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Tony Asleson --- fs/buffer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index a60f60396cfa..97b8f455c031 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -133,10 +133,16 @@ __clear_page_buffers(struct page *page) static void buffer_io_error(struct buffer_head *bh, char *msg) { - if (!test_bit(BH_Quiet, &bh->b_state)) - printk_ratelimited(KERN_ERR + if (!test_bit(BH_Quiet, &bh->b_state)) { + struct device *gendev; + + gendev = (bh->b_bdev->bd_disk) ? + disk_to_dev(bh->b_bdev->bd_disk) : NULL; + + dev_err_ratelimited(gendev, "Buffer I/O error on dev %pg, logical block %llu%s\n", bh->b_bdev, (unsigned long long)bh->b_blocknr, msg); + } } /* From patchwork Tue Jun 23 19:17:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 213707 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=-4.3 required=3.0 tests=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, UNWANTED_LANGUAGE_BODY 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 2570DC433E1 for ; Tue, 23 Jun 2020 19:18:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECEF12084D for ; Tue, 23 Jun 2020 19:18:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R6rlJ4GE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387492AbgFWTSC (ORCPT ); Tue, 23 Jun 2020 15:18:02 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:22925 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387502AbgFWTSB (ORCPT ); Tue, 23 Jun 2020 15:18:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592939880; 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=2pEwcRgLvtMw24J+haf2mTbN9rcYAaYqY5Ij/FN/Jf0=; b=R6rlJ4GEa/Zb4o3C+1+OY9OruU/Vq06n4eiFYzwD4pJtvaQELG7jmGMSPCZIXXVM2wFk7p ow6kxYfF1jEYD7o0D7r8dqdLGkD0Z8KeWZbOx7ENW0UT+l9B/+q8WmMdSQHhHuRPj9ngEG NPjFYkS5FrmFBy7NTFMsargoCVB6bZQ= 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-46-HZBeNS4BOFK4k7JsVqXFwQ-1; Tue, 23 Jun 2020 15:17:59 -0400 X-MC-Unique: HZBeNS4BOFK4k7JsVqXFwQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8344410059A5; Tue, 23 Jun 2020 19:17:58 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.3.128.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 730E171699; Tue, 23 Jun 2020 19:17:57 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org Subject: [RFC PATCH v3 5/8] ata_dev_printk: Use dev_printk Date: Tue, 23 Jun 2020 14:17:46 -0500 Message-Id: <20200623191749.115200-6-tasleson@redhat.com> In-Reply-To: <20200623191749.115200-1-tasleson@redhat.com> References: <20200623191749.115200-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Utilize the dev_printk function which will add structured data to the log message. Signed-off-by: Tony Asleson --- drivers/ata/libata-core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index beca5f91bb4c..44c874367fe3 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6475,6 +6475,7 @@ EXPORT_SYMBOL(ata_link_printk); void ata_dev_printk(const struct ata_device *dev, const char *level, const char *fmt, ...) { + const struct device *gendev; struct va_format vaf; va_list args; @@ -6483,9 +6484,12 @@ 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); + gendev = (dev->sdev) ? &dev->sdev->sdev_gendev : &dev->tdev; + + dev_printk(level, gendev, "ata%u.%02u: %pV", + dev->link->ap->print_id, + dev->link->pmp + dev->devno, + &vaf); va_end(args); } From patchwork Tue Jun 23 19:17:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 213706 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=-7.1 required=3.0 tests=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 88E60C433DF for ; Tue, 23 Jun 2020 19:18:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 601D92082F for ; Tue, 23 Jun 2020 19:18:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SlH5olNw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387453AbgFWTSG (ORCPT ); Tue, 23 Jun 2020 15:18:06 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49488 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733308AbgFWTSF (ORCPT ); Tue, 23 Jun 2020 15:18:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592939883; 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=3FlvC4WnnfR6GPyXEm/QWq5hfr2bBZHvjMhaZjhHQsU=; b=SlH5olNwThH1X/Bn99pJBTHbUft2gTQno5e78SzYJthktJ0NAI9ZQjFFZgpt8pV4HIzi6E 6wjiGDBq8TRnRW/lctMMe4YRPJz3+cFlKjBPjQZBLGcr4xvkyIvbC3NTk6py5/zw/pPa6l yWkPW8wi+as2VICXISu59AnPnNgovLc= 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-59-js0mMmBcOn-ygKuTfAMeUg-1; Tue, 23 Jun 2020 15:18:02 -0400 X-MC-Unique: js0mMmBcOn-ygKuTfAMeUg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C43B10059A4; Tue, 23 Jun 2020 19:18:01 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.3.128.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 671687169D; Tue, 23 Jun 2020 19:18:00 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org Subject: [RFC PATCH v3 7/8] nvme: Add durable name for dev_printk Date: Tue, 23 Jun 2020 14:17:48 -0500 Message-Id: <20200623191749.115200-8-tasleson@redhat.com> In-Reply-To: <20200623191749.115200-1-tasleson@redhat.com> References: <20200623191749.115200-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Corrections from Keith Busch review comments. 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 f3c037f5a9ba..f2e5b91668a1 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2667,6 +2667,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) +{ + char serial[144]; /* Max 141 for wwid_show */ + ssize_t serial_len = wwid_show((struct device *)dev, NULL, serial); + + if (serial_len > 0 && serial_len < len) { + serial_len -= 1; /* Remove the '\n' from the string */ + strncpy(buf, serial, serial_len); + return serial_len; + } + return 0; +} + static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) { struct nvme_subsystem *subsys, *found; @@ -3616,6 +3632,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; __nvme_revalidate_disk(disk, id);