From: David Sterba Date: Fri, 13 Nov 2020 16:58:03 +0000 (+0100) Subject: btrfs: remove stub device info from messages when we have no fs_info X-Git-Tag: v5.15~1812^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0f6d924cada10eefa526ccfa1be7888f559d9d7;p=platform%2Fkernel%2Flinux-starfive.git btrfs: remove stub device info from messages when we have no fs_info Without a NULL fs_info the helpers will print something like BTRFS error (device ): ... This can happen in contexts where fs_info is not available at all or it's potentially unsafe due to object lifetime. The stub does not bring much information and with the prefix makes the message unnecessarily longer. Remove it for the NULL fs_info case. BTRFS error: ... Callers can add the device information to the message itself if needed. Reviewed-by: Anand Jain Signed-off-by: David Sterba --- diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 6693cfc..348f889 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -240,9 +240,13 @@ void __cold btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, . vaf.fmt = fmt; vaf.va = &args; - if (__ratelimit(ratelimit)) - printk("%sBTRFS %s (device %s): %pV\n", lvl, type, - fs_info ? fs_info->sb->s_id : "", &vaf); + if (__ratelimit(ratelimit)) { + if (fs_info) + printk("%sBTRFS %s (device %s): %pV\n", lvl, type, + fs_info->sb->s_id, &vaf); + else + printk("%sBTRFS %s: %pV\n", lvl, type, &vaf); + } va_end(args); }