Re: [PATCH] btrfs: simplify read_extent_buffer_pages a bit

David Sterba
2019-04-11T16:58:30Z

On Thu, Apr 11, 2019 at 06:40:59PM +0200, Johannes Thumshirn wrote:
> Currently read_extent_buffer_pages() uses a 4 pass algorithm to read an
> extent buffer's pages from disk, all 4 stages looping over all pages of
> the extent buffer.
>
> 1) Loop over all pages and lock them.
> 2) Loop over all pages and see if one is not marked as PageUptodate, so we
> can break out of the function early.
> 3) Loop over all pages and if the page is !PageUptodate read the page,
> otherwise unlock the page.
> 4) Loop over all pages and wait for stable pages.
>
> Unify the 1st two for loops, we can count the number of uptodate pages
> after we have locked them without the need for re-starting the loop.

Effectively reverting 2571e739677f1e4c0c63f5ed49adcc0857923625 that
fixed a bug. Please have a look if something has really changed so that
the split loops are no longer necessary.