]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: free list element sooner at log_new_dir_dentries()
authorFilipe Manana <fdmanana@suse.com>
Wed, 17 Aug 2022 11:22:37 +0000 (12:22 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2022 10:27:56 +0000 (12:27 +0200)
commitbd89cdd714bb02fbdf1b294c84fb5884e4eef322
treeb78c789dd580f0fa0c05b04d4a5b8691ceb0bf03
parent4be6da3f842d8d1c52509a62dc1bd4d23432efda
btrfs: free list element sooner at log_new_dir_dentries()

At log_new_dir_dentries(), there's no need to keep the current list
element allocated while processing the leaves with directory items for
the current directory, and while logging other inodes. Plus in case we
find a subdirectory, we also end up allocating a new list element while
the current one is still allocated, temporarily using more memory than
necessary.

So free the current list element early on, before processing leaves.
Also make the removal and release of all list elements in case of an
error more simple by eliminating the label and goto, adding an explicit
loop to release all list elements in case an error happens.

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