]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: replace for_each_set_bit() with for_each_set_bitmap()
authorQu Wenruo <wqu@suse.com>
Wed, 10 Dec 2025 08:32:34 +0000 (19:02 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 05:38:32 +0000 (06:38 +0100)
commite6698b34fab33867ef3faeeea6feb165f31aae24
treeed4780e938ead8437213e2559cb095105bc5471c
parent44820d80026e0b509007d41c83d42f1213ee8589
btrfs: replace for_each_set_bit() with for_each_set_bitmap()

Inside extent_io.c, there are several simple call sites doing things
like:

for_each_set_bit(bit, bitmap, bitmap_size) {
/* handle one fs block */
}

The workload includes:

- set_bit()
  Inside extent_writepage_io().

  This can be replaced with a bitmap_set().

- btrfs_folio_set_lock()
- btrfs_mark_ordered_io_finished()
  Inside writepage_delalloc().

  Instead of calling it multiple times, we can pass a range into the
  function with one call.

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/extent_io.c