• Q
    btrfs: raid56: make it more explicit that cache rbio should have all its data sectors uptodate · 88074c8b
    Qu Wenruo 提交于
    For Btrfs RAID56, we have a caching system for btrfs raid bios (rbio).
    
    We call cache_rbio_pages() to mark a qualified rbio ready for cache.
    
    The timing happens at:
    
    - finish_rmw()
    
      At this timing, we have already read all necessary sectors, along with
      the rbio sectors, we have covered all data stripes.
    
    - __raid_recover_end_io()
    
      At this timing, we have rebuild the rbio, thus all data sectors
      involved (either from stripe or bio list) are uptodate now.
    
    Thus at the timing of cache_rbio_pages(), we should have all data
    sectors uptodate.
    
    This patch will make it explicit that all data sectors are uptodate at
    cache_rbio_pages() timing, mostly to prepare for the incoming
    verification at RMW time.
    
    This patch will add:
    
    - Extra ASSERT()s in cache_rbio_pages()
      This is to make sure all data sectors, which are not covered by bio,
      are already uptodate.
    
    - Extra ASSERT()s in steal_rbio()
      Since only cached rbio can be stolen, thus every data sector should
      already be uptodate in the source rbio.
    
    - Update __raid_recover_end_io() to update recovered sector->uptodate
      Previously __raid_recover_end_io() will only mark failed sectors
      uptodate if it's doing an RMW.
    
      But this can trigger new ASSERT()s, as for recovery case, a recovered
      failed sector will not be marked uptodate, and trigger ASSERT() in
      later cache_rbio_pages() call.
    Signed-off-by: NQu Wenruo <wqu@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    88074c8b
raid56.c 73.0 KB