btrfs: scrub: introduce helper to find and fill sector info for a scrub_stripe
authorQu Wenruo <wqu@suse.com>
Mon, 20 Mar 2023 02:12:51 +0000 (10:12 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:23 +0000 (18:01 +0200)
commitb979547513ff060ebe4a381b69d8478b18e1cc4e
treeaa7d72e8d007bc4c66bc9f0481bcd0f208a59aaa
parent2af2aaf982054cd2377bb0046b624df0f0d44d85
btrfs: scrub: introduce helper to find and fill sector info for a scrub_stripe

The new helper will search the extent tree to find the first extent of a
logical range, then fill the sectors array by two loops:

- Loop 1 to fill common bits and metadata generation

- Loop 2 to fill csum data (only for data bgs)
  This loop will use the new btrfs_lookup_csums_bitmap() to fill
  the full csum buffer, and set scrub_sector_verification::csum.

With all the needed info filled by this function, later we only need to
submit and verify the stripe.

Here we temporarily export the helper to avoid warning on unused static
function.

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/file-item.c
fs/btrfs/file-item.h
fs/btrfs/raid56.c
fs/btrfs/scrub.c
fs/btrfs/scrub.h