diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f7afdfd0bae7..e448394451f1 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -646,6 +646,14 @@ enum {
 #endif
 };
 
+enum btrfs_msgid_type {
+	BTRFS_MSGID_DEVICE,
+	BTRFS_MSGID_UUID,
+	BTRFS_MSGID_UUID_SHORT,
+	BTRFS_MSGID_LABEL,
+	BTRFS_MSGID_COUNT
+};
+
 /*
  * Exclusive operations (device replace, resize, device add/remove, balance)
  */
@@ -744,6 +752,8 @@ struct btrfs_fs_info {
 	 */
 	u64 max_inline;
 
+	enum btrfs_msgid_type msgid_type;
+
 	struct btrfs_transaction *running_transaction;
 	wait_queue_head_t transaction_throttle;
 	wait_queue_head_t transaction_wait;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 800ad3a9c68e..d1c6d372d5f7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3138,6 +3138,9 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
 
 	fs_info->bg_reclaim_threshold = BTRFS_DEFAULT_RECLAIM_THRESH;
 	INIT_WORK(&fs_info->reclaim_bgs_work, btrfs_reclaim_bgs_work);
+
+	/* Set default here */
+	fs_info->msgid_type = BTRFS_MSGID_UUID;
 }
 
 static int init_mount_fs_info(struct btrfs_fs_info *fs_info, struct super_block *sb)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 719dda57dc7a..8227bcce9817 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -291,10 +291,37 @@ void __cold _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt,
 	if (__ratelimit(ratelimit)) {
 		if (fs_info) {
 			char statestr[STATE_STRING_BUF_LEN];
+			char *idtype;
+			char id[64] = { 0 };
+			bool short_fsid = false;
+
+			switch (READ_ONCE(fs_info->msgid_type)) {
+			default:
+			case BTRFS_MSGID_DEVICE:
+				idtype = "device";
+				scnprintf(id, sizeof(id), "%s", fs_info->sb->s_id);
+				break;
+			case BTRFS_MSGID_UUID_SHORT:
+				short_fsid = true;
+				fallthrough;
+			case BTRFS_MSGID_UUID:
+				idtype = "fsid";
+				scnprintf(id, sizeof(id), "%pU",
+					  fs_info->fs_devices->fsid);
+				if (short_fsid)
+					id[13] = 0;
+				break;
+			case BTRFS_MSGID_LABEL:
+				idtype = "label";
+				/* Fixme: first 64 from label */
+				scnprintf(id, sizeof(id), "%s",
+					  fs_info->super_copy->label);
+				break;
+			}
 
 			btrfs_state_to_string(fs_info, statestr);
-			_printk("%sBTRFS %s (device %s%s): %pV\n", lvl, type,
-				fs_info->sb->s_id, statestr, &vaf);
+			_printk("%sBTRFS %s (%s %s%s): %pV\n", lvl, type,
+				idtype, id, statestr, &vaf);
 		} else {
 			_printk("%sBTRFS %s: %pV\n", lvl, type, &vaf);
 		}
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 3554c7b4204f..94dd28112414 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -962,6 +962,8 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
 	memcpy(fs_info->super_copy->label, buf, p_len);
 	spin_unlock(&fs_info->super_lock);
 
+	/* Fixme: if label is empty, reset msgid_type to default */
+
 	/*
 	 * We don't want to do full transaction commit from inside sysfs
 	 */
@@ -1214,6 +1216,43 @@ static ssize_t btrfs_bg_reclaim_threshold_store(struct kobject *kobj,
 BTRFS_ATTR_RW(, bg_reclaim_threshold, btrfs_bg_reclaim_threshold_show,
 	      btrfs_bg_reclaim_threshold_store);
 
+static const char *msgid_strings[] = {
+	[BTRFS_MSGID_DEVICE]	= "device",
+	[BTRFS_MSGID_UUID]	= "uuid",
+	[BTRFS_MSGID_UUID_SHORT] = "uuid-short",
+	[BTRFS_MSGID_LABEL]	= "label",
+};
+
+static ssize_t btrfs_msgid_show(struct kobject *kobj,
+				struct kobj_attribute *a,
+				char *buf)
+{
+	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
+
+	return sysfs_emit(buf, "%s\n", msgid_strings[fs_info->msgid_type]);
+}
+
+static ssize_t btrfs_msgid_store(struct kobject *kobj,
+				 struct kobj_attribute *a,
+				 const char *buf, size_t len)
+{
+	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
+	int i;
+
+	for (i = 0; i < BTRFS_MSGID_COUNT; i++) {
+		/* Fixme: if label is empty do a fallback */
+		if (strmatch(buf, msgid_strings[i])) {
+			WRITE_ONCE(fs_info->msgid_type, i);
+			break;
+		}
+	}
+	if (i == BTRFS_MSGID_COUNT)
+		return -EINVAL;
+
+	return len;
+}
+BTRFS_ATTR_RW(, msgid, btrfs_msgid_show, btrfs_msgid_store);
+
 /*
  * Per-filesystem information and stats.
  *
@@ -1231,6 +1270,7 @@ static const struct attribute *btrfs_attrs[] = {
 	BTRFS_ATTR_PTR(, generation),
 	BTRFS_ATTR_PTR(, read_policy),
 	BTRFS_ATTR_PTR(, bg_reclaim_threshold),
+	BTRFS_ATTR_PTR(, msgid),
 	NULL,
 };
 
