Btrfs: remove BUG() in print_extent_item
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 18 Aug 2017 21:15:21 +0000 (15:15 -0600)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Aug 2017 15:47:43 +0000 (17:47 +0200)
btrfs_print_leaf() is used in btrfs_get_extent_inline_ref_type, so
here we really want to print the invalid value of ref type instead of
causing a kernel panic.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/print-tree.c

index 6e7a8c40dcd90504694da85b47b7e55336d9a949..c1acbdcb476c531c3fc536686b39732f5481901a 100644 (file)
@@ -121,7 +121,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
                               offset, btrfs_shared_data_ref_count(eb, sref));
                        break;
                default:
-                       BUG();
+                       btrfs_err(eb->fs_info,
+                                 "extent %llu has invalid ref type %d",
+                                 eb->start, type);
+                       return;
                }
                ptr += btrfs_extent_inline_ref_size(type);
        }