[RFC 9/9] __xfs_printk: Add durable name to output

Tony Asleson
2019-12-23T22:56:22Z

Add persistent durable name to xfs messages so we can
correlate them with other messages for the same block
device.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
---
fs/xfs/xfs_message.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
index 9804efe525a9..8447cdd985b4 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -20,6 +20,23 @@ __xfs_printk(
const struct xfs_mount *mp,
struct va_format *vaf)
{
+ char dict[128];
+ int dict_len = 0;
+
+ if (mp && mp->m_super && mp->m_super->s_bdev &&
+ mp->m_super->s_bdev->bd_disk) {
+ dict_len = dev_durable_name(
+ disk_to_dev(mp->m_super->s_bdev->bd_disk)->parent,
+ dict,
+ sizeof(dict));
+ if (dict_len) {
+ printk_emit(
+ 0, level[1] - '0', dict, dict_len,
+ "XFS (%s): %pV\n", mp->m_fsname, vaf);
+ return;
+ }
+ }
+
if (mp && mp->m_fsname) {
printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf);
return;
--
2.21.0