btrfs-progs: lowmem check: Fix false backref lost warning for keyed extent data ref
authorQu Wenruo <wqu@suse.com>
Wed, 22 Nov 2017 09:03:18 +0000 (17:03 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 3 Jan 2018 16:09:13 +0000 (17:09 +0100)
For keyed extent ref, its offset is calculated offset (file offset -
file extent offset), just like inlined extent data ref.

However the code is using file offset to hash extent data ref offset,
causing false backref lost warning like:
------
ERROR: data extent[16913485824 7577600] backref lost
------

Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree")
Reported-by: Chris Murphy <chris@colorremedies.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c

index 9f9eb50..452e715 100644 (file)
@@ -12126,7 +12126,7 @@ static int check_extent_data_item(struct btrfs_root *root,
                dbref_key.objectid = btrfs_file_extent_disk_bytenr(eb, fi);
                dbref_key.type = BTRFS_EXTENT_DATA_REF_KEY;
                dbref_key.offset = hash_extent_data_ref(root->objectid,
-                               fi_key.objectid, fi_key.offset);
+                               fi_key.objectid, fi_key.offset - offset);
 
                ret = btrfs_search_slot(NULL, root->fs_info->extent_root,
                                        &dbref_key, &path, 0, 0);