diff options
author | Qu Wenruo <wqu@suse.com> | 2020-11-13 20:51:29 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-12-08 15:54:13 +0100 |
commit | e09caaf913a9d3d7fc892c0b5a85e6b2ec3728dc (patch) | |
tree | 2544371884246381287ed958c4a384addf970f88 /fs/btrfs | |
parent | 94e8c95ccba8bc25b6385b8c2ba1b9cd90e86de6 (diff) | |
download | linux-e09caaf913a9d3d7fc892c0b5a85e6b2ec3728dc.tar.bz2 |
btrfs: introduce helper to handle page status update in end_bio_extent_readpage()
Introduce a new helper to handle update page status in
end_bio_extent_readpage(). This will be later used for subpage support
where the page status update can be more complex than now.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent_io.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 519f74502a3e..4bc6beaff562 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2842,6 +2842,17 @@ update: processed->uptodate = uptodate; } +static void endio_readpage_update_page_status(struct page *page, bool uptodate) +{ + if (uptodate) { + SetPageUptodate(page); + } else { + ClearPageUptodate(page); + SetPageError(page); + } + unlock_page(page); +} + /* * after a readpage IO is done, we need to: * clear the uptodate bits on error @@ -2964,14 +2975,11 @@ readpage_ok: off = offset_in_page(i_size); if (page->index == end_index && off) zero_user_segment(page, off, PAGE_SIZE); - SetPageUptodate(page); - } else { - ClearPageUptodate(page); - SetPageError(page); } - unlock_page(page); offset += len; + /* Update page status and unlock */ + endio_readpage_update_page_status(page, uptodate); endio_readpage_release_extent(&processed, BTRFS_I(inode), start, end, uptodate); } |