Skip to content

Commit f3d315e

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: don't check for uptodate pages in read_extent_buffer_pages
The only place that reads in pages and thus marks them uptodate for the btree inode is read_extent_buffer_pages. Which means that either pages are already uptodate from an old buffer when creating a new one in alloc_extent_buffer, or they will be updated by ca call to read_extent_buffer_pages. This means the checks for uptodate pages in read_extent_buffer_pages and read_extent_buffer_subpage are superfluous and can be removed. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 011134f commit f3d315e

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

fs/btrfs/extent_io.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,10 +4136,7 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
41364136
return ret;
41374137
}
41384138

4139-
if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags) ||
4140-
PageUptodate(page) ||
4141-
btrfs_subpage_test_uptodate(fs_info, page, eb->start, eb->len)) {
4142-
set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
4139+
if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) {
41434140
unlock_extent(io_tree, eb->start, eb->start + eb->len - 1,
41444141
&cached_state);
41454142
return 0;
@@ -4166,7 +4163,6 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
41664163
int i;
41674164
struct page *page;
41684165
int locked_pages = 0;
4169-
int all_uptodate = 1;
41704166
int num_pages;
41714167

41724168
if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
@@ -4201,21 +4197,6 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
42014197
}
42024198
locked_pages++;
42034199
}
4204-
/*
4205-
* We need to firstly lock all pages to make sure that
4206-
* the uptodate bit of our pages won't be affected by
4207-
* clear_extent_buffer_uptodate().
4208-
*/
4209-
for (i = 0; i < num_pages; i++) {
4210-
page = eb->pages[i];
4211-
if (!PageUptodate(page))
4212-
all_uptodate = 0;
4213-
}
4214-
4215-
if (all_uptodate) {
4216-
set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
4217-
goto unlock_exit;
4218-
}
42194200

42204201
__read_extent_buffer_pages(eb, mirror_num, check);
42214202

0 commit comments

Comments
 (0)