Commit f95d713b authored by Omar Sandoval's avatar Omar Sandoval Committed by David Sterba

btrfs: remove redundant i_size check in __extent_writepage_io()

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>
parent 169d2c87
...@@ -3455,11 +3455,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3455,11 +3455,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
update_nr_written(wbc, nr_written + 1); update_nr_written(wbc, nr_written + 1);
end = page_end; end = page_end;
if (i_size <= start) {
btrfs_writepage_endio_finish_ordered(page, start, page_end, 1);
goto done;
}
blocksize = inode->i_sb->s_blocksize; blocksize = inode->i_sb->s_blocksize;
while (cur <= end) { while (cur <= end) {
...@@ -3540,7 +3535,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3540,7 +3535,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
pg_offset += iosize; pg_offset += iosize;
nr++; nr++;
} }
done:
*nr_ret = nr; *nr_ret = nr;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment