btrfs: move eb subpage preallocation out of the loop
authorQu Wenruo <wqu@suse.com>
Sun, 9 Jul 2023 07:08:18 +0000 (15:08 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Aug 2023 12:52:13 +0000 (14:52 +0200)
commit52ea5bfbfa6d5432ed46e0a18b9e5ca4e4f91852
tree7922eb4f5410080f784f9602d6a0b7fc3e0839b3
parentb2cc440058baf3f4783a687a2caa35b31a1da553
btrfs: move eb subpage preallocation out of the loop

Initially we preallocate btrfs_subpage structure in the main loop of
alloc_extent_buffer().

But later commit fbca46eb46ec ("btrfs: make nodesize >= PAGE_SIZE case
to reuse the non-subpage routine") has made sure we only go subpage
routine if our nodesize is smaller than PAGE_SIZE.

This means for that case, we only need to allocate the subpage structure
once anyway.

So this patch would make the preallocation out of the main loop.  This
would slightly reduce the workload when we hold the page lock, and make
code a little easier to read.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c