]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Refactor main loop in extent_readpages
authorNikolay Borisov <nborisov@suse.com>
Thu, 29 Nov 2018 16:41:31 +0000 (18:41 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:49 +0000 (14:51 +0100)
commitf4469d8eb28d0fdebc8000f481c3420b9bf04121
tree805a03861d79339eed44394ebe54ccd32453cf8e
parent7ba4a713f2514be9a19c44dcf2955ceeda5fe3cb
btrfs: Refactor main loop in extent_readpages

extent_readpages processes all pages in the readlist in batches of 16,
this is implemented by a single for loop but thanks to an if condition
the loop does 2 things based on whether we've filled the batch or not.
Additionally due to the structure of the code there is an additional
check which deals with partial batches.

Streamline all of this by explicitly using two loops. The outter one is
used to process all pages while the inner one just fills in the batch
of 16 (currently). Due to this new structure the code guarantees that
all pages are processed in the loop hence the code to deal with any
leftovers is eliminated.

This also enable the compiler to inline __extent_readpages:

./scripts/bloat-o-meter fs/btrfs/extent_io.o extent_io.for

add/remove: 0/1 grow/shrink: 1/0 up/down: 660/-820 (-160)
Function                                     old     new   delta
extent_readpages                             476    1136    +660
__extent_readpages                           820       -    -820
Total: Before=44315, After=44155, chg -0.36%

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c