]> www.infradead.org Git - users/dwmw2/linux.git/commit
btrfs: simplify the page uptodate preparation for prepare_pages()
authorQu Wenruo <wqu@suse.com>
Tue, 1 Oct 2024 23:17:49 +0000 (08:47 +0930)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:14 +0000 (14:34 +0100)
commit7f91c6a78a0e0125e69f6aef05914aeb2d91a2eb
tree07cf3f8491b1f106633d6d012e91ff0fb5eaa51f
parent00c5135dceaf57b212a808444d719d321444c819
btrfs: simplify the page uptodate preparation for prepare_pages()

Currently inside prepare_pages(), we handle the leading and tailing page
differently, and skip the middle pages (if any).  This is to avoid
reading pages which are fully covered by the dirty range.

Refactor the code by moving all checks (alignment check, range check,
force read check) into prepare_uptodate_page().

So that prepare_pages() only needs to iterate all the pages
unconditionally.

And since we're here, also update prepare_uptodate_page() to use
folio API other than the old page API.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c