[PATCH] exportfs: reduce stack usage

From: Randy.Dunlap
Date: Wed Sep 29 2004 - 00:00:51 EST



find_exported_dentry() declares
char nbuf[NAME_MAX+1];
in 2 separate places, and gcc allocates space on the stack for both
of them. Having just one of them will suffice, if we can put put
with its scope.

Reduces function stack usage on x86-32 from 0x230 to 0x130.

Signed-off-by: Randy Dunlap <rddunlap@xxxxxxxx>


diffstat:=
fs/exportfs/expfs.c | 4 +---
1 files changed, 1 insertion(+), 3 deletions(-)

diff -Naurp ./fs/exportfs/expfs.c~expfs_stack ./fs/exportfs/expfs.c
--- ./fs/exportfs/expfs.c~expfs_stack 2004-09-15 19:27:42.000000000 -0700
+++ ./fs/exportfs/expfs.c 2004-09-28 21:35:42.339816784 -0700
@@ -55,7 +55,7 @@ find_exported_dentry(struct super_block
struct list_head *le, *head;
struct dentry *toput = NULL;
int noprogress;
-
+ char nbuf[NAME_MAX+1];

/*
* Attempt to find the inode.
@@ -176,7 +176,6 @@ find_exported_dentry(struct super_block
*/
struct dentry *ppd;
struct dentry *npd;
- char nbuf[NAME_MAX+1];

down(&pd->d_inode->i_sem);
ppd = CALL(nops,get_parent)(pd);
@@ -241,7 +240,6 @@ find_exported_dentry(struct super_block
/* if we weren't after a directory, have one more step to go */
if (result != target_dir) {
struct dentry *nresult;
- char nbuf[NAME_MAX+1];
err = CALL(nops,get_name)(target_dir, nbuf, result);
if (!err) {
down(&target_dir->d_inode->i_sem);


--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/