• Qu Wenruo's avatar
    btrfs: refactor __extent_writepage_io() to improve readability · 6bc5636a
    Qu Wenruo authored
    The refactoring involves the following modifications:
    
    - iosize alignment
      In fact we don't really need to manually do alignment at all.
      All extent maps should already be aligned, thus basic ASSERT() check
      would be enough.
    
    - redundant variables
      We have extra variable like blocksize/pg_offset/end.
      They are all unnecessary.
    
      @blocksize can be replaced by sectorsize size directly, and it's only
      used to verify the em start/size is aligned.
    
      @pg_offset can be easily calculated using @cur and page_offset(page).
    
      @end is just assigned from @page_end and never modified, use
      "start + PAGE_SIZE - 1" directly and remove @page_end.
    
    - remove some BUG_ON()s
      The BUG_ON()s are for extent map, which we have tree-checker to check
      on-disk extent data item and runtime check.
      ASSERT() should be enough.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    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>
    6bc5636a
extent_io.c 162 KB