btrfs-progs: fsck-tests: Introduce test case with keyed data backref with shared...
authorQu Wenruo <wqu@suse.com>
Wed, 22 Nov 2017 09:03:25 +0000 (17:03 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 3 Jan 2018 16:09:27 +0000 (17:09 +0100)
commit263184c7d286efe5200939686818400d0e3afa5d
treee74306244cd4586ff7da6b0109d49cfc592a960b
parentee147df75f71b87ad9c505a71deaacc3b78b3632
btrfs-progs: fsck-tests: Introduce test case with keyed data backref with shared tree blocks

For snapshot shared tree blocks with source subvolume, the keyed backref
counter only counts the exclusive owned references.

In the following case, 258 is a snapshot of 257, which inherits all the
reference to this data extent.
------
        item 4 key (12582912 EXTENT_ITEM 524288) itemoff 3741 itemsize 140
                refs 179 gen 9 flags DATA
                extent data backref root 257 objectid 258 offset 0 count 49
                extent data backref root 257 objectid 257 offset 0 count 1
                extent data backref root 256 objectid 258 offset 0 count 128
                extent data backref root 256 objectid 257 offset 0 count 1
------

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: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
tests/fsck-tests/020-extent-ref-cases/keyed_data_ref_with_shared_leaf.img [new file with mode: 0644]