OSDN Git Service

Btrfs: print btrfs specific info for some fatal error cases
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Fri, 4 Jul 2014 09:59:06 +0000 (17:59 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:37:28 +0000 (13:37 -0700)
Marc argued that if there are several btrfs filesystems mounted,
while users even don't know which filesystem hit the corrupted
errors something like generation verification failure.

Since @extent_buffer structure has a member @fs_info, let's output
btrfs device info.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/disk-io.c

index 508bbee..d14847d 100644 (file)
@@ -348,9 +348,9 @@ static int verify_parent_transid(struct extent_io_tree *io_tree,
                ret = 0;
                goto out;
        }
-       printk_ratelimited("parent transid verify failed on %llu wanted %llu "
-                      "found %llu\n",
-                      eb->start, parent_transid, btrfs_header_generation(eb));
+       printk_ratelimited(KERN_INFO "BTRFS (device %s): parent transid verify failed on %llu wanted %llu found %llu\n",
+                       eb->fs_info->sb->s_id, eb->start,
+                       parent_transid, btrfs_header_generation(eb));
        ret = 1;
 
        /*
@@ -614,15 +614,15 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 
        found_start = btrfs_header_bytenr(eb);
        if (found_start != eb->start) {
-               printk_ratelimited(KERN_INFO "BTRFS: bad tree block start "
+               printk_ratelimited(KERN_INFO "BTRFS (device %s): bad tree block start "
                               "%llu %llu\n",
-                              found_start, eb->start);
+                              eb->fs_info->sb->s_id, found_start, eb->start);
                ret = -EIO;
                goto err;
        }
        if (check_tree_block_fsid(root, eb)) {
-               printk_ratelimited(KERN_INFO "BTRFS: bad fsid on block %llu\n",
-                              eb->start);
+               printk_ratelimited(KERN_INFO "BTRFS (device %s): bad fsid on block %llu\n",
+                              eb->fs_info->sb->s_id, eb->start);
                ret = -EIO;
                goto err;
        }