]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: tree-check: reduce stack consumption in check_dir_item
authorDavid Sterba <dsterba@suse.com>
Wed, 10 Jan 2018 14:13:07 +0000 (15:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Dec 2018 18:41:12 +0000 (19:41 +0100)
commite07e1c7561a7e087a5e512c972aa7d3e1388c057
tree29856ea500c3629ee5ad84e8c4b831515484ae30
parent52ea16655aeed2571b9042c18db3eb089c37910c
btrfs: tree-check: reduce stack consumption in check_dir_item

commit e2683fc9d219430f5b78889b50cde7f40efeba7b upstream.

I've noticed that the updated item checker stack consumption increased
dramatically in 542f5385e20cf97447 ("btrfs: tree-checker: Add checker
for dir item")

tree-checker.c:check_leaf                    +552 (176 -> 728)

The array is 255 bytes long, dynamic allocation would slow down the
sanity checks so it's more reasonable to keep it on-stack. Moving the
variable to the scope of use reduces the stack usage again

tree-checker.c:check_leaf                    -264 (728 -> 464)

Reviewed-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tree-checker.c