• Omar Sandoval's avatar
    btrfs: remove redundant i_size check in __extent_writepage_io() · f95d713b
    Omar Sandoval authored
    In __extent_writepage_io(), we check whether
    
      i_size <= page_offset(page).
    
    Note that if i_size < page_offset(page), then
    i_size >> PAGE_SHIFT < page->index.
    
    If i_size == page_offset(page), then
    i_size >> PAGE_SHIFT == page->index && offset_in_page(i_size) == 0.
    
    __extent_writepage() already has a check for these cases that
    returns without calling __extent_writepage_io():
    
      end_index = i_size >> PAGE_SHIFT
      pg_offset = offset_in_page(i_size);
      if (page->index > end_index ||
         (page->index == end_index && !pg_offset)) {
              page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
              unlock_page(page);
              return 0;
      }
    
    Get rid of the one in __extent_writepage_io(), which was obsoleted in
    211c17f5 ("Fix corners in writepage and btrfs_truncate_page").
    Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    f95d713b
extent_io.c 154 KB