]> git.hungrycats.org Git - linux/commit
Btrfs: correctly get tree level in tree_backref_for_extent zygo-3.17.7-zb64
authorFilipe Manana <fdmanana@suse.com>
Mon, 15 Dec 2014 16:04:42 +0000 (16:04 +0000)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Mon, 5 Jan 2015 21:46:14 +0000 (16:46 -0500)
commit5ece2a5895b5e683c717b57f04d5fa88b2da2648
treec86b828e3a2cd398775af716ca0a93754f557889
parent749cfdb9015a6cab28bbfea391eeb8cae1f82adb
Btrfs: correctly get tree level in tree_backref_for_extent

If we are using skinny metadata, the block's tree level is in the offset
of the key and not in a btrfs_tree_block_info structure following the
extent item (it doesn't exist). Therefore fix it.

Besides returning the correct level in the tree, this also prevents reading
past the leaf's end in the case where the extent item is the last item in
the leaf (eb) and it has only 1 inline reference - this is because
sizeof(struct btrfs_tree_block_info) is greater than
sizeof(struct btrfs_extent_inline_ref).

Got it while running a scrub which produced the following warning:

    BTRFS: checksum error at logical 42123264 on dev /dev/sde, sector 15840: metadata node (level 24) in tree 5

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit a1317f455ab936a9447f17b08e3e874c27742870)
fs/btrfs/backref.c