• Qu Wenruo's avatar
    btrfs: scrub: introduce a writeback helper for scrub_stripe · 058e09e6
    Qu Wenruo authored
    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: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    058e09e6
scrub.h 1.15 KB