From 0c524122bd07c918f1d8987879dd495b2719d3c6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 16 Jun 2010 12:39:44 -0700 Subject: [PATCH 1/2] Add fix-stack-dsl_dir_open_spa topic branch Reduce stack usage by 256 bytes by moving buf char array from the stack to the heap. --- .topdeps | 1 + .topmsg | 7 +++++++ module/zfs/dsl_dir.c | 13 ++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..07df2782c7 --- /dev/null +++ b/.topmsg @@ -0,0 +1,7 @@ +From: Brian Behlendorf +Subject: [PATCH] fix stack dsl_dir_open_spa + +Reduce stack usage by 256 bytes by moving buf char array from +the stack to the heap. + +Signed-off-by: Brian Behlendorf diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index 1cd49c8274..5ed61c5f2a 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -303,7 +303,7 @@ int dsl_dir_open_spa(spa_t *spa, const char *name, void *tag, dsl_dir_t **ddp, const char **tailp) { - char buf[MAXNAMELEN]; + char *buf; const char *next, *nextnext = NULL; int err; dsl_dir_t *dd; @@ -313,14 +313,15 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag, dprintf("%s\n", name); + buf = kmem_alloc(MAXNAMELEN, KM_SLEEP); err = getcomponent(name, buf, &next); if (err) - return (err); + goto error; if (spa == NULL) { err = spa_open(buf, &spa, FTAG); if (err) { dprintf("spa_open(%s) failed\n", buf); - return (err); + goto error; } openedspa = TRUE; @@ -336,7 +337,7 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag, rw_exit(&dp->dp_config_rwlock); if (openedspa) spa_close(spa, FTAG); - return (err); + goto error; } while (next != NULL) { @@ -372,7 +373,7 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag, dsl_dir_close(dd, tag); if (openedspa) spa_close(spa, FTAG); - return (err); + goto error; } /* @@ -391,6 +392,8 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag, if (openedspa) spa_close(spa, FTAG); *ddp = dd; +error: + kmem_free(buf, MAXNAMELEN); return (err); } From a2cbedd9e80216bfd14b814a7012cfa8f08c7996 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 16 Jun 2010 12:40:37 -0700 Subject: [PATCH 2/2] New TopGit dependency: fix-stack-dsl_dir_open_spa --- .topdeps | 1 + 1 file changed, 1 insertion(+) diff --git a/.topdeps b/.topdeps index 675463cb74..a9532822f6 100644 --- a/.topdeps +++ b/.topdeps @@ -16,3 +16,4 @@ fix-current fix-metaslab fix-kstat-xuio fix-stack-lzjb +fix-stack-dsl_dir_open_spa