mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 10:10:33 +02:00
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>
This commit is contained in:
parent
113fa05c2f
commit
011134f444
1 changed files with 9 additions and 17 deletions
|
|
@ -1767,10 +1767,8 @@ static void extent_buffer_write_end_io(struct btrfs_bio *bbio)
|
||||||
struct page *page = bvec->bv_page;
|
struct page *page = bvec->bv_page;
|
||||||
u32 len = bvec->bv_len;
|
u32 len = bvec->bv_len;
|
||||||
|
|
||||||
if (!uptodate) {
|
if (!uptodate)
|
||||||
btrfs_page_clear_uptodate(fs_info, page, start, len);
|
btrfs_page_clear_uptodate(fs_info, page, start, len);
|
||||||
btrfs_page_set_error(fs_info, page, start, len);
|
|
||||||
}
|
|
||||||
btrfs_page_clear_writeback(fs_info, page, start, len);
|
btrfs_page_clear_writeback(fs_info, page, start, len);
|
||||||
bio_offset += len;
|
bio_offset += len;
|
||||||
}
|
}
|
||||||
|
|
@ -3948,7 +3946,6 @@ void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
|
||||||
continue;
|
continue;
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
btree_clear_page_dirty(page);
|
btree_clear_page_dirty(page);
|
||||||
ClearPageError(page);
|
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
}
|
}
|
||||||
WARN_ON(atomic_read(&eb->refs) == 0);
|
WARN_ON(atomic_read(&eb->refs) == 0);
|
||||||
|
|
@ -4107,10 +4104,8 @@ static void __read_extent_buffer_pages(struct extent_buffer *eb, int mirror_num,
|
||||||
__bio_add_page(&bbio->bio, eb->pages[0], eb->len,
|
__bio_add_page(&bbio->bio, eb->pages[0], eb->len,
|
||||||
eb->start - page_offset(eb->pages[0]));
|
eb->start - page_offset(eb->pages[0]));
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < num_pages; i++) {
|
for (i = 0; i < num_pages; i++)
|
||||||
ClearPageError(eb->pages[i]);
|
|
||||||
__bio_add_page(&bbio->bio, eb->pages[i], PAGE_SIZE, 0);
|
__bio_add_page(&bbio->bio, eb->pages[i], PAGE_SIZE, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
btrfs_submit_bio(bbio, mirror_num);
|
btrfs_submit_bio(bbio, mirror_num);
|
||||||
}
|
}
|
||||||
|
|
@ -4150,7 +4145,6 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_subpage_clear_error(fs_info, page, eb->start, eb->len);
|
|
||||||
btrfs_subpage_start_reader(fs_info, page, eb->start, eb->len);
|
btrfs_subpage_start_reader(fs_info, page, eb->start, eb->len);
|
||||||
|
|
||||||
__read_extent_buffer_pages(eb, mirror_num, check);
|
__read_extent_buffer_pages(eb, mirror_num, check);
|
||||||
|
|
@ -4392,18 +4386,16 @@ static void assert_eb_page_uptodate(const struct extent_buffer *eb,
|
||||||
* looked up. We don't want to complain in this case, as the page was
|
* looked up. We don't want to complain in this case, as the page was
|
||||||
* valid before, we just didn't write it out. Instead we want to catch
|
* valid before, we just didn't write it out. Instead we want to catch
|
||||||
* the case where we didn't actually read the block properly, which
|
* the case where we didn't actually read the block properly, which
|
||||||
* would have !PageUptodate && !PageError, as we clear PageError before
|
* would have !PageUptodate and !EXTENT_BUFFER_WRITE_ERR.
|
||||||
* reading.
|
|
||||||
*/
|
*/
|
||||||
if (fs_info->nodesize < PAGE_SIZE) {
|
if (test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags))
|
||||||
bool uptodate, error;
|
return;
|
||||||
|
|
||||||
uptodate = btrfs_subpage_test_uptodate(fs_info, page,
|
if (fs_info->nodesize < PAGE_SIZE) {
|
||||||
eb->start, eb->len);
|
WARN_ON(!btrfs_subpage_test_uptodate(fs_info, page,
|
||||||
error = btrfs_subpage_test_error(fs_info, page, eb->start, eb->len);
|
eb->start, eb->len));
|
||||||
WARN_ON(!uptodate && !error);
|
|
||||||
} else {
|
} else {
|
||||||
WARN_ON(!PageUptodate(page) && !PageError(page));
|
WARN_ON(!PageUptodate(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue