Skip to content

Commit 011134f

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: stop using PageError for extent_buffers
PageError is only used to limit the uptodate check in assert_eb_page_uptodate. But we have a much more useful flag indicating the exact condition we are about with the EXTENT_BUFFER_WRITE_ERR flag, so use that instead and help the kernel toward eventually removing PageError. 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 113fa05 commit 011134f

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

fs/btrfs/extent_io.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,10 +1767,8 @@ static void extent_buffer_write_end_io(struct btrfs_bio *bbio)
17671767
struct page *page = bvec->bv_page;
17681768
u32 len = bvec->bv_len;
17691769

1770-
if (!uptodate) {
1770+
if (!uptodate)
17711771
btrfs_page_clear_uptodate(fs_info, page, start, len);
1772-
btrfs_page_set_error(fs_info, page, start, len);
1773-
}
17741772
btrfs_page_clear_writeback(fs_info, page, start, len);
17751773
bio_offset += len;
17761774
}
@@ -3948,7 +3946,6 @@ void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
39483946
continue;
39493947
lock_page(page);
39503948
btree_clear_page_dirty(page);
3951-
ClearPageError(page);
39523949
unlock_page(page);
39533950
}
39543951
WARN_ON(atomic_read(&eb->refs) == 0);
@@ -4107,10 +4104,8 @@ static void __read_extent_buffer_pages(struct extent_buffer *eb, int mirror_num,
41074104
__bio_add_page(&bbio->bio, eb->pages[0], eb->len,
41084105
eb->start - page_offset(eb->pages[0]));
41094106
} else {
4110-
for (i = 0; i < num_pages; i++) {
4111-
ClearPageError(eb->pages[i]);
4107+
for (i = 0; i < num_pages; i++)
41124108
__bio_add_page(&bbio->bio, eb->pages[i], PAGE_SIZE, 0);
4113-
}
41144109
}
41154110
btrfs_submit_bio(bbio, mirror_num);
41164111
}
@@ -4150,7 +4145,6 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
41504145
return 0;
41514146
}
41524147

4153-
btrfs_subpage_clear_error(fs_info, page, eb->start, eb->len);
41544148
btrfs_subpage_start_reader(fs_info, page, eb->start, eb->len);
41554149

41564150
__read_extent_buffer_pages(eb, mirror_num, check);
@@ -4392,18 +4386,16 @@ static void assert_eb_page_uptodate(const struct extent_buffer *eb,
43924386
* looked up. We don't want to complain in this case, as the page was
43934387
* valid before, we just didn't write it out. Instead we want to catch
43944388
* the case where we didn't actually read the block properly, which
4395-
* would have !PageUptodate && !PageError, as we clear PageError before
4396-
* reading.
4389+
* would have !PageUptodate and !EXTENT_BUFFER_WRITE_ERR.
43974390
*/
4398-
if (fs_info->nodesize < PAGE_SIZE) {
4399-
bool uptodate, error;
4391+
if (test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags))
4392+
return;
44004393

4401-
uptodate = btrfs_subpage_test_uptodate(fs_info, page,
4402-
eb->start, eb->len);
4403-
error = btrfs_subpage_test_error(fs_info, page, eb->start, eb->len);
4404-
WARN_ON(!uptodate && !error);
4394+
if (fs_info->nodesize < PAGE_SIZE) {
4395+
WARN_ON(!btrfs_subpage_test_uptodate(fs_info, page,
4396+
eb->start, eb->len));
44054397
} else {
4406-
WARN_ON(!PageUptodate(page) && !PageError(page));
4398+
WARN_ON(!PageUptodate(page));
44074399
}
44084400
}
44094401

0 commit comments

Comments
 (0)