btrfs: make csum_tree_block() handle node smaller than page
authorQu Wenruo <wqu@suse.com>
Tue, 3 Nov 2020 13:30:47 +0000 (21:30 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:54:04 +0000 (15:54 +0100)
commita26663e7a2f456b8111de0135394c04c72831930
treea76df3b11742d661a8796315d69399338f99b86e
parent2f4d60dfae0ee4ad1c8d57e102c3b032b8f9d4d5
btrfs: make csum_tree_block() handle node smaller than page

For subpage size support, metadata blocks of nodesize are smaller than
one page and this needs to be handled when calculating the checksum.

The checksummed start and length need to be adjusted but only for the
first page:

- start is simply offset in the page

- length is nodesize (subpage) or PAGE_SIZE for all other cases

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
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/disk-io.c