Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp418063pxx; Mon, 26 Oct 2020 11:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz+eBaLvfMgpHesgzW1eFvvMOsbkKdEI4MySJPLVRna/xadH1oD8bS15HaNsyXBerPztyf X-Received: by 2002:a17:906:bb14:: with SMTP id jz20mr17389260ejb.424.1603736764529; Mon, 26 Oct 2020 11:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603736764; cv=none; d=google.com; s=arc-20160816; b=IgOwFUlbU7iQwJtkcnrUnfZtCap87Jbh3WKIhLTs3Tyx1fLIeUttx+o2vkY7S4LSsl YMBVPB5ATxaQlfuMlMP1s+WSCdWUKbvpOYLsSpAcB/PGmjGZUFf1cTSYH8P7c8U8Hxi2 W7gz702JrP6XPD+bHFLb6Wox9uVgw5JIRXrUTC0JiHV+EeX9AsKvFcHUj1m0gP5NvwTD noCPyLoZzCohZ6XNmsP/2/eZa7Yp/oHA5bEJcIk5sWfyy7Jjg7DIXRKidcNveXKS0Ele BYUyTPW4ZYa9Ysd28DJndmy7VC7U2W0tFE0x9d4ARwb6TVrsPKndTc5vik2QHAScMVyS 2+LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=XtIg8kCXjeLzHwMGzqXo41x42k9dsaG3Y++Yc06Zfug=; b=qcR4ynPFMQY7MxOufxEhonlvfnpsJVDh77s9o07OoG8DgQsVITU/UKIj1VkfeaUpPd PosBuhnk4SmvTVoXggkbSRLpnYpbFIE7SQxKbfyrdRJ9OTEt7dsc8nFs0+LbKOrbJLnv LV8gIjCc9f4hpT1Z5JjBZTI67Ak0r947Yf+ayZM0d3n0AJWakJAeZuZgxyfVEKJSlR0M NKsViEh7sSLFFPuuic1G5EdAZCsrARpoodHXgl9QNCpzOGhd1OszeGvtaxDovonRf4ZA ixUXvWW/xIkrtE5fdHyMfjQVJuev/VEIZjGGvD2/bk3LcbPLC4lJ3fY3nPknmxM847wP 8C4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GIk+20tH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si7413989edt.471.2020.10.26.11.25.41; Mon, 26 Oct 2020 11:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GIk+20tH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1784598AbgJZP6R (ORCPT + 99 others); Mon, 26 Oct 2020 11:58:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60346 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444240AbgJZP5g (ORCPT ); Mon, 26 Oct 2020 11:57:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603727855; 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; bh=XtIg8kCXjeLzHwMGzqXo41x42k9dsaG3Y++Yc06Zfug=; b=GIk+20tHj/68YBnYvBaAmTV+EdPHLdkIyKg2HT0MjXMWaDMNsV1xMGI9u1Vnn+5t4JstOc EFuyfq/RangxguVi2UD1VepML3omFhC1QdLjPPRtA2mSK1qjFCbmScVql37Qxyw9/yJKiy 2SiKXYAoL0vXgJ6zSZkCW8plO/qRidI= 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-249-IQ5xuMxoN4ejX9L8vlKzSQ-1; Mon, 26 Oct 2020 11:57:33 -0400 X-MC-Unique: IQ5xuMxoN4ejX9L8vlKzSQ-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 0513E106B26E; Mon, 26 Oct 2020 15:57:32 +0000 (UTC) Received: from sulaco.redhat.com (ovpn-112-242.rdu2.redhat.com [10.10.112.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E4F25B4B2; Mon, 26 Oct 2020 15:57:31 +0000 (UTC) From: Tony Asleson To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] buffer_io_error: Use dev_err_ratelimited Date: Mon, 26 Oct 2020 10:57:30 -0500 Message-Id: <20201026155730.542020-1-tasleson@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace printk_ratelimited with dev_err_ratelimited which adds dev_printk meta data. This is used by journald to add disk ID information to the journal entry. This re-worked change is from a different patch series and utilizes the following suggestions. - Reduce indentation level (Andy Shevchenko) - Remove unneeded () for conditional operator (Sergei Shtylyov) 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 50bbc99e3d96..18175fbb1101 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; + + dev_err_ratelimited(gendev, + "Buffer I/O error, logical block %llu%s\n", + (unsigned long long)bh->b_blocknr, msg); } /* base-commit: bbf5c979011a099af5dc76498918ed7df445635b -- 2.26.2