diff options
-rw-r--r-- | fs/btrfs/disk-io.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index c4e673a94426..1cd325765aaa 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -559,7 +559,15 @@ static noinline int check_leaf(struct btrfs_root *root, | |||
559 | u32 nritems = btrfs_header_nritems(leaf); | 559 | u32 nritems = btrfs_header_nritems(leaf); |
560 | int slot; | 560 | int slot; |
561 | 561 | ||
562 | if (nritems == 0) { | 562 | /* |
563 | * Extent buffers from a relocation tree have a owner field that | ||
564 | * corresponds to the subvolume tree they are based on. So just from an | ||
565 | * extent buffer alone we can not find out what is the id of the | ||
566 | * corresponding subvolume tree, so we can not figure out if the extent | ||
567 | * buffer corresponds to the root of the relocation tree or not. So skip | ||
568 | * this check for relocation trees. | ||
569 | */ | ||
570 | if (nritems == 0 && !btrfs_header_flag(leaf, BTRFS_HEADER_FLAG_RELOC)) { | ||
563 | struct btrfs_root *check_root; | 571 | struct btrfs_root *check_root; |
564 | 572 | ||
565 | key.objectid = btrfs_header_owner(leaf); | 573 | key.objectid = btrfs_header_owner(leaf); |
@@ -587,6 +595,9 @@ static noinline int check_leaf(struct btrfs_root *root, | |||
587 | return 0; | 595 | return 0; |
588 | } | 596 | } |
589 | 597 | ||
598 | if (nritems == 0) | ||
599 | return 0; | ||
600 | |||
590 | /* Check the 0 item */ | 601 | /* Check the 0 item */ |
591 | if (btrfs_item_offset_nr(leaf, 0) + btrfs_item_size_nr(leaf, 0) != | 602 | if (btrfs_item_offset_nr(leaf, 0) + btrfs_item_size_nr(leaf, 0) != |
592 | BTRFS_LEAF_DATA_SIZE(root)) { | 603 | BTRFS_LEAF_DATA_SIZE(root)) { |