btrfs: scrub: introduce a writeback helper for scrub_stripe
authorQu Wenruo <wqu@suse.com>
Mon, 20 Mar 2023 02:12:55 +0000 (10:12 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:23 +0000 (18:01 +0200)
commit058e09e6fe7ccbe5bead222eb7890277391aec0e
treee9a6f4bb17dae9fb6b6698bdb7020b19f8d81a42
parent9ecb5ef543d36e0b6aad4f74c91bec1bf3a9a074
btrfs: scrub: introduce a writeback helper for scrub_stripe

Add a new helper, scrub_write_sectors(), to submit write bios for
specified sectors to the target disk.

There are several differences compared to read path:

- Utilize btrfs_submit_scrub_write()
  Now we still rely on the @mirror_num based writeback, but the
  requirement is also a little different than regular writeback or read,
  thus we have to call btrfs_submit_scrub_write().

- We cannot write the full stripe back
  We can only write the sectors we have.  There will be two call sites
  later, one for repaired sectors, one for all utilized sectors of
  dev-replace.

  Thus the callers should specify their own write_bitmap.

This function only submit the bios, will not wait for them unless for
zoned case.

Caller must explicitly wait for the IO to finish.

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
fs/btrfs/scrub.h