• Qu Wenruo's avatar
    btrfs: introduce btrfs_bio::fs_info member · 4317ff00
    Qu Wenruo authored
    Currently we're doing a lot of work for btrfs_bio:
    
    - Checksum verification for data read bios
    - Bio splits if it crosses stripe boundary
    - Read repair for data read bios
    
    However for the incoming scrub patches, we don't want this extra
    functionality at all, just plain logical + mirror -> physical mapping
    ability.
    
    Thus here we do the following changes:
    
    - Introduce btrfs_bio::fs_info
      This is for the new scrub specific btrfs_bio, which would not populate
      btrfs_bio::inode.
      Thus we need such new member to grab a fs_info
    
      This new member will always be populated.
    
    - Replace @inode argument with @fs_info for btrfs_bio_init() and its
      caller
      Since @inode is no longer a mandatory member, replace it with
      @fs_info, and let involved users populate @inode.
    
    - Skip checksum verification and generation if @bbio->inode is NULL
    
    - Add extra ASSERT()s
      To make sure:
    
      * bbio->inode is properly set for involved read repair path
      * if @file_offset is set, bbio->inode is also populated
    
    - Grab @fs_info from @bbio directly
      We can no longer go @bbio->inode->root->fs_info, as bbio->inode can be
      NULL. This involves:
    
      * btrfs_simple_end_io()
      * should_async_write()
      * btrfs_wq_submit_bio()
      * btrfs_use_zone_append()
    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>
    4317ff00
bio.h 2.71 KB