Skip to content

Commit f95d713

Browse files
osandovkdave
authored andcommitted
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 211c17f ("Fix corners in writepage and btrfs_truncate_page"). Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 169d2c8 commit f95d713

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

‎fs/btrfs/extent_io.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,11 +3455,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
34553455
update_nr_written(wbc, nr_written + 1);
34563456

34573457
end = page_end;
3458-
if (i_size <= start) {
3459-
btrfs_writepage_endio_finish_ordered(page, start, page_end, 1);
3460-
goto done;
3461-
}
3462-
34633458
blocksize = inode->i_sb->s_blocksize;
34643459

34653460
while (cur <= end) {
@@ -3540,7 +3535,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
35403535
pg_offset += iosize;
35413536
nr++;
35423537
}
3543-
done:
35443538
*nr_ret = nr;
35453539
return ret;
35463540
}

0 commit comments

Comments
 (0)