btrfs: scrub: support subpage data scrub
authorQu Wenruo <wqu@suse.com>
Wed, 2 Dec 2020 06:48:10 +0000 (14:48 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 9 Dec 2020 18:16:11 +0000 (19:16 +0100)
commitb29dca44abe216a9c29842593cbc18f9a3fe57d2
treee653ddcae4ba9330ac68373b17fc723f2da25026
parent53f3251d3b82f70c762cb7d963d70fb65f49e22c
btrfs: scrub: support subpage data scrub

Btrfs scrub is more flexible than buffered data write path, as we can
read an unaligned subpage data into page offset 0.

This ability makes subpage support much easier, we just need to check
each scrub_page::page_len and ensure we only calculate hash for [0,
page_len) of a page.

There is a small thing to notice: for subpage case, we still do sector
by sector scrub.  This means we will submit a read bio for each sector
to scrub, resulting in the same amount of read bios, just like on the 4K
page systems.

This behavior can be considered as a good thing, if we want everything
to be the same as 4K page systems.  But this also means, we're wasting
the possibility to submit larger bio using 64K page size.  This is
another problem to consider in the future.

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/scrub.c