]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: avoid memory allocation at log_new_dir_dentries() for common case
authorFilipe Manana <fdmanana@suse.com>
Wed, 17 Aug 2022 11:22:38 +0000 (12:22 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2022 10:27:56 +0000 (12:27 +0200)
commitea82456e0423b5d8d716e010dfa698eee28be348
tree5cc0dd749202370a014f0dae53deb2e7f9109fc5
parent989164fed8d403a3af73a49fe4a90eb654c4a24a
btrfs: avoid memory allocation at log_new_dir_dentries() for common case

At log_new_dir_dentries() we always start by allocating a list element
for the starting inode and then do a while loop with the condition being
a list emptiness check.

This however is not needed, we can avoid allocating this initial list
element and then just check for the list emptiness at the end of the
loop's body. So just do that to save one memory allocation from the
kmalloc-32 slab.

This allows for not doing any memory allocation when we don't have any
subdirectory to log, which is a very common case.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c