btrfs: make btrfs_cleanup_ordered_extents() support large folios
authorQu Wenruo <wqu@suse.com>
Sat, 19 Jul 2025 22:26:48 +0000 (07:56 +0930)
committerDavid Sterba <dsterba@suse.com>
Thu, 7 Aug 2025 15:07:15 +0000 (17:07 +0200)
commit15fc0bec883c95007a4901fe75f247bd0ca21651
treebc57aae73933cca6f4c6e2b8ddd7ba6160651c96
parentad580dfa388fabb52af033e3f8cc5d04be985e54
btrfs: make btrfs_cleanup_ordered_extents() support large folios

When hitting a large folio, btrfs_cleanup_ordered_extents() will get the
same large folio multiple times, and clearing the same range again and
again.

Thankfully this is not causing anything wrong, just inefficiency.

This is caused by the fact that we're iterating folios using the old
page index, thus can hit the same large folio again and again.

Enhance it by increasing @index to the index of the folio end, and only
increase @index by 1 if we failed to grab a folio.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c