[04/11] btrfs-progs: lowmem check: Fix false backref lost warning for keyed extent data ref
diff mbox

Message ID 20171122090325.29458-5-wqu@suse.com
State New
Headers show

Commit Message

Qu Wenruo Nov. 22, 2017, 9:03 a.m. UTC
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>
---
 cmds-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox

diff --git a/cmds-check.c b/cmds-check.c
index 9f9eb504ae8e..452e715bf245 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -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);