btrfs-progs: fsck-tests: add test case with keyed data backref with reloc tree blocks
commite6203e6ff9fc0ee2f15dd06b4db61b89eaace982
authorSu Yue <suy.fnst@cn.fujitsu.com>
Tue, 3 Jul 2018 07:58:51 +0000 (3 15:58 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Aug 2018 13:03:16 +0000 (6 15:03 +0200)
tree496bfb515649a56a6169964868c5e300fec035f5
parentd53d42fa21831b15a5f5cdab98b391be78081246
btrfs-progs: fsck-tests: add test case with keyed data backref with reloc tree blocks

For trees have been balanced, leaves are with flag BTRFS_HEADER_FLAG_RELOC and
extent data backrefs are shared. Like:
=====================
       item 0 key (11927552 EXTENT_ITEM 524288) itemoff 3932 itemsize 63
                refs 129 gen 7 flags DATA
                shared data backref parent 35897344 count 41
                shared data backref parent 35426304 count 37
                shared data backref parent 35422208 count 51
=====================

Then make the leaf which owns the extent data cowed. The shared data
backref was to transferred to keyed data ref, but remaining backrefs are
still shared. Like:
=====================
        item 0 key (11927552 EXTENT_ITEM 524288) itemoff 3887 itemsize 108
                refs 129 gen 7 flags DATA
                extent data backref root 5 objectid 258 offset 0 count 40
                extent data backref root 5 objectid 257 offset 0 count 1
                shared data backref parent 35426304 count 37
                shared data backref parent 35422208 count 51
=====================

However lowmem mode used to iterate the whole inode to find all
references, and doesn't care if a reference is already counted by the
shared tree block.

Add the test case to check it.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
tests/fsck-tests/020-extent-ref-cases/keyed_data_ref_with_reloc_leaf.img [new file with mode: 0644]