]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:44:56 +0000 (09:44 -0600)
commit1a8c79346037edf7d5a8564223383899fde50705
treeeb274278c8ba1fc59779490b1ce7081c26b9403a
parent530c0684e7069d692df32b0347b36684f53f3d44
btrfs: tree-check: reduce stack consumption in check_dir_item

BugLink: https://bugs.launchpad.net/bugs/1836968
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/btrfs/tree-checker.c