Skip to contentSkip to conversation

Btrfs: remove unwanted kernel log output

PATCH New Stefan Behrens 1 participant 3 messages Jul 17, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover Btrfs: remove unwanted kernel log output

People complained about unwanted kernel log output at mount time, related to btrfs device I/O statistics. With these two commits, the two messages are removed or filtered, respectively.

Stefan Behrens (2):
Btrfs: remove unwanted printk() for btrfs device I/O stats
Btrfs: suppress printk() if all device I/O stats are zero

 fs/btrfs/volumes.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.11.2
#1 lore raw

PATCH 1/2 Btrfs: remove unwanted printk() for btrfs device I/O stats

People complained about the annoying kernel log message "btrfs: no dev_stats entry found ... (OK on first mount after mkfs)" everytime a filesystem is mounted for the first time after running mkfs. Since the distribution of the btrfs-progs is not synchronized to the kernel version, mkfs like it is now will be used also in the future. Then this message is not useful to find errors, it is just annoying. This commit removes the printk().

---
 fs/btrfs/volumes.c | 3 ---
 1 file changed, 3 deletions(-)
fs/btrfs/volumes.c +0 -3
index ecaad40..6f04dae 100644
@@ -4736,9 +4736,6 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
 		key.offset = device->devid;
 		ret = btrfs_search_slot(NULL, dev_root, &key, path, 0, 0);
 		if (ret) {
-			printk_in_rcu(KERN_WARNING "btrfs: no dev_stats entry found for device %s (devid %llu) (OK on first mount after mkfs)\n",
-				      rcu_str_deref(device->name),
-				      (unsigned long long)device->devid);
 			__btrfs_reset_dev_stats(device);
 			device->dev_stats_valid = 1;
 			btrfs_release_path(path);
Signature · 1 line
1.7.11.2
#2 lore raw

PATCH 2/2 Btrfs: suppress printk() if all device I/O stats are zero

In reply to Stefan Behrens

Code is added to suppress the I/O stats printing at mount time if all statistic values are zero.

---
 fs/btrfs/volumes.c | 8 ++++++++
 1 file changed, 8 insertions(+)
fs/btrfs/volumes.c +8 -0
index 6f04dae..d11606c 100644
@@ -4877,6 +4877,14 @@ void btrfs_dev_stat_print_on_error(struct btrfs_device *dev)
 
 static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev)
 {
+	int i;
+
+	for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++)
+		if (btrfs_dev_stat_read(dev, i) != 0)
+			break;
+	if (i == BTRFS_DEV_STAT_VALUES_MAX)
+		return; /* all values == 0, suppress message */
+
 	printk_in_rcu(KERN_INFO "btrfs: bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n",
 	       rcu_str_deref(dev->name),
 	       btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
Signature · 1 line
1.7.11.2