Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp52695pxx; Wed, 28 Oct 2020 17:55:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykljriKdkjk/E+ETA5zfFP5Qc5Kf3w0Z5z1dfwVlYgrSH6jTa0NJiWdU7NCo5IO3Aecd20 X-Received: by 2002:a17:906:fa84:: with SMTP id lt4mr1725741ejb.61.1603932956163; Wed, 28 Oct 2020 17:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603932956; cv=none; d=google.com; s=arc-20160816; b=knUyJ/bcLcFAGWqbYJ8Gl0ss6MN9B8dDypuT898RVEhBcyNpXmlKVJCQd68uq0h90c qnBQqOAUP3qngKf56tECpHTTOjlzmG4tvJFsZj4d8+8wCYp5h9M01v/Xehi9PeddTsk7 sFKlzjNL772vbgYSxSY8ZVIroKzA2ozs02b4D9ldTcAEWT4SAmo+KVJe9ak6tD3fNgbr RTeI4XT1r2jMNPPnYOfbe2phZmaA7hf2jaXZ9+dar+bOY4m2cnYVH2DWl4K8hyUsn24M n5ojMPJ5VmQL56imXw0+07EQeF3YWHR1GfFtUunMghz7bNNwBc3soQHsqvU02objjWGg pMWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:reply-to:subject:from:dkim-signature; bh=S+J5ii6EZLhTqQCH/OEDhTSwFbyzMnC7lbpD84H+AYE=; b=JcDOUfZm6uf+V1bzN+opo6mm/zarGK2jVf9txlu3GmHiZsGasK8c+vDFqF4VO9NskN eNBUeW/aHNfHf8CDlZhLuKHoDnTEg49ousCBz8eXfWZ/592tMSfVFlpSTtmfXWxwEy3B ySIb5+zrhLji71nkaUu9aZnforOKRIrDlDATDSocEiqYPZhgAvNVvTOXsY2t0kgy8uN1 qzm+h4AK9qOmjiubAyPZZCi1ActN7Wdz3sLCOhmUPbhQnQCzzat4FWb5hvX74CAMeG8F uKqjwSsW5kFAvFlLMCqgfxit1W68Hu1OJwCvY0KCG38j2yhIpzGixIZD0UMKRTmiLX5o lUQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NaoebUVT; 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 q1si665565ejf.509.2020.10.28.17.55.34; Wed, 28 Oct 2020 17:55:56 -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=NaoebUVT; 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 S1726710AbgJ1VrH (ORCPT + 99 others); Wed, 28 Oct 2020 17:47:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42631 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727628AbgJ1VrD (ORCPT ); Wed, 28 Oct 2020 17:47:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603921622; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S+J5ii6EZLhTqQCH/OEDhTSwFbyzMnC7lbpD84H+AYE=; b=NaoebUVT6O46G0FF3eZa55Iiur34FK9qwhlaUXhZ799qPDeeiZsEYUO1kga4MywpbofYeg 2QtxJV+wRBOTgNwa1oXKbNEX3wvOUtcep4Wvfb5YeA0skdI1irUiXKQHMWvRXcoOMoKodn eQS1Sogcrp5GF5k3lWsMUYBQwqwFuak= 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-359-tbOc0l-tPvOW4EVvGYq8OQ-1; Wed, 28 Oct 2020 16:45:24 -0400 X-MC-Unique: tbOc0l-tPvOW4EVvGYq8OQ-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 774631009E27; Wed, 28 Oct 2020 20:45:23 +0000 (UTC) Received: from [10.10.112.242] (ovpn-112-242.rdu2.redhat.com [10.10.112.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD9615B4B2; Wed, 28 Oct 2020 20:45:22 +0000 (UTC) From: Tony Asleson Subject: Re: [PATCH] buffer_io_error: Use dev_err_ratelimited Reply-To: tasleson@redhat.com To: Andy Shevchenko Cc: Alexander Viro , Linux FS Devel , Linux Kernel Mailing List References: <20201026155730.542020-1-tasleson@redhat.com> Organization: Red Hat Message-ID: <71148b03-d880-8113-bd91-25dadef777c7@redhat.com> Date: Wed, 28 Oct 2020 15:45:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/26/20 5:07 PM, Andy Shevchenko wrote: > On Mon, Oct 26, 2020 at 10:59 PM Tony Asleson wrote: >> >> 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) > > This should go as a changelog after the cutter '---' line... Thanks, I'll correct this. >> Signed-off-by: Tony Asleson >> --- > > ...somewhere here. > > ... > >> - 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; > > I'm not sure it's a good idea to print '(null)'. I've not seen any cases where we end up with null here, but I've only tested ATA, SCSI, and NVMe subsystems. However, I would think that if this does occur it would be more obvious that it's an issue that needs to be corrected if the null ends up in the logs instead of having the same output that we have today? > Perhaps > > if (bh->b_bdev->bd_disk) > dev_err_ratelimit(disk_to_dev(bh->b_bdev->bd_disk), ...); > else > pr_err_ratelimit(...); > > ? > >> + dev_err_ratelimited(gendev, >> + "Buffer I/O error, logical block %llu%s\n", > >> + (unsigned long long)bh->b_blocknr, msg); > > It's a u64 always (via sector_t), do we really need a casting? That's a good question, grepping around shows *many* instances of this being done. I do agree that this doesn't seem to be needed, but maybe there is a reason why it's done? -Tony