]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: document extent mapping assumptions in checksum
authorJohannes Thumshirn <jthumshirn@suse.de>
Wed, 28 Nov 2018 08:54:56 +0000 (09:54 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:41 +0000 (14:51 +0100)
commit7864ce0e1916c35770717d34bb7d9c1782721db3
tree35131555f323b709ffa0926e0d673f156b3c4428
parent63abc46aa78c040653c5f72755de073cd86e9bb3
btrfs: document extent mapping assumptions in checksum

Document why map_private_extent_buffer() cannot return '1' (i.e. the map
spans two pages) for the csum_tree_block() case.

The current algorithm for detecting a page boundary crossing in
map_private_extent_buffer() will return a '1' *IFF* the extent buffer's
offset in the page + the offset passed in by csum_tree_block() and the
minimal length passed in by csum_tree_block() - 1 are bigger than
PAGE_SIZE.

We always pass BTRFS_CSUM_SIZE (32) as offset and a minimal length of 32
and the current extent buffer allocator always guarantees page aligned
extends, so the above condition can't be true.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c