btrfs: add stripe_len < PAGE_SIZE support for steal_rbio()
The function steal_rbio() is utilized to use the pages that belongs to
uptodate data blocks, without doing a page copy.
That is done by just updating the dest->stripe_pages[] pointer to use
the point inside @src directly.
That function previously will reject stripe_len < PAGE_SIZE cases, as a
page can contain both data and P/Q blocks.
But that shouldn't be a big deal, as long as the corresponding P/Q
blocks are not marked uptodate, we can still steal the page that also
contains P/Q blocks.
So rework steal_rbio() to support stripe_len < PAGE_SIZE by:
- Calculate the last page index correctly
Instead of iterating all pages but skip P/Q pages, calculate the last
page index properly.
The last page may contain both data and P/Q blocks, but we can still
steal the page.
- Update the bitmap in one go
Instead of updating the stripe_uptodate_bitmap for every page, we can
do the update in just one go, out of the main loop.
* full_page_sectors_uptodate()
This one is very annoying, because of its __maybe_unused
attribution.
They are based on the old BTRFS_STRIPE_LEN >= PAGE_SIZE assumption,
and no longer utilized.
- Make index_stripe_sectors() update the stripe_paddrs[] without a page
This doesn't cause any functional change for now, as there is no one
accessing the source stripe_paddrs[] after a steal.
But this should still make the function a little more robust.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Qu Wenruo <wqu@suse.com>