Commit 4325cb22 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: support subpage in endio_readpage_update_page_status()

To handle subpage status update, add the following:

- Use btrfs_page_*() subpage-aware helpers to update page status
  Now we can handle both cases well.

- No page unlock for subpage metadata
  Since subpage metadata doesn't utilize page locking at all, skip it.
  For subpage data locking, it's handled in later commits.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 4012daf7
......@@ -2840,15 +2840,24 @@ static void endio_readpage_release_extent(struct processed_extent *processed,
processed->uptodate = uptodate;
}
static void endio_readpage_update_page_status(struct page *page, bool uptodate)
static void endio_readpage_update_page_status(struct page *page, bool uptodate,
u64 start, u32 len)
{
struct btrfs_fs_info *fs_info = btrfs_sb(page->mapping->host->i_sb);
ASSERT(page_offset(page) <= start &&
start + len <= page_offset(page) + PAGE_SIZE);
if (uptodate) {
SetPageUptodate(page);
btrfs_page_set_uptodate(fs_info, page, start, len);
} else {
ClearPageUptodate(page);
SetPageError(page);
btrfs_page_clear_uptodate(fs_info, page, start, len);
btrfs_page_set_error(fs_info, page, start, len);
}
unlock_page(page);
if (fs_info->sectorsize == PAGE_SIZE)
unlock_page(page);
/* Subpage locking will be handled in later patches */
}
/*
......@@ -2985,7 +2994,7 @@ static void end_bio_extent_readpage(struct bio *bio)
bio_offset += len;
/* Update page status and unlock */
endio_readpage_update_page_status(page, uptodate);
endio_readpage_update_page_status(page, uptodate, start, len);
endio_readpage_release_extent(&processed, BTRFS_I(inode),
start, end, uptodate);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment