From: Tony Asleson <tasleson@redhat.com>
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 [thread overview]
Message-ID: <20201026155730.542020-1-tasleson@redhat.com> (raw)
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 <tasleson@redhat.com>
---
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
next reply other threads:[~2020-10-26 15:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 15:57 Tony Asleson [this message]
2020-10-26 22:07 ` [PATCH] buffer_io_error: Use dev_err_ratelimited Andy Shevchenko
2020-10-28 20:45 ` Tony Asleson
2020-10-28 21:05 ` Tony Asleson
2020-10-28 23:22 ` Andy Shevchenko
2020-11-17 20:38 ` Tony Asleson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026155730.542020-1-tasleson@redhat.com \
--to=tasleson@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).