btrfs: tree-checker: Add simple keyed refs check
authorQu Wenruo <wqu@suse.com>
Fri, 9 Aug 2019 01:24:23 +0000 (09:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:12 +0000 (14:59 +0200)
commite2406a6f13bdc7df43bf7e4e66cb06348daef618
treee1e6afcec2d3b385010a0b261dfc676578ef4064
parentf82d1c7ca8ae1bf89e8d78c5ecb56b6b228c1a75
btrfs: tree-checker: Add simple keyed refs check

For TREE_BLOCK_REF, SHARED_DATA_REF and SHARED_BLOCK_REF we need to
check:
              | TREE_BLOCK_REF | SHARED_BLOCK_REF | SHARED_BLOCK_REF
--------------+----------------+-----------------+------------------
key->objectid |    Alignment   |     Alignment    |    Alignment
key->offset   |    Any value   |     Alignment    |    Alignment
item_size     |        0       |        0         |   sizeof(le32) (*)

*: sizeof(struct btrfs_shared_data_ref)

So introduce a check to check all these 3 key types together.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-checker.c