Fix stack traverse_visitbp()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 27 Aug 2010 23:48:18 +0000 (16:48 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 31 Aug 2010 15:38:50 +0000 (08:38 -0700)
commit6656bf56216f36805731298ee0f4de87ae6b6b3d
tree2f28be68a0f1ee5a049b91999420fd7643d43e0c
parentda6b4005c92ce02359aabae6549f1031ad1fe41c
Fix stack traverse_visitbp()

Due to  limited stack space recursive functions are frowned upon in
the Linux kernel.  However, they often are the most elegant solution
to a problem.  The following code preserves the recursive function
traverse_visitbp() but moves the local variables AND function
arguments to the heap to minimize the stack frame size.  Enough
space is initially allocated on the stack for 20 levels of recursion.
This change does ugly-up-the-code but it reduces the worst case
usage from roughly 4160 bytes to 960 bytes on x86_64 archs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/zfs/dmu_traverse.c