diff options
author | Brian Behlendorf <[email protected]> | 2010-08-26 10:53:31 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-08-31 08:38:48 -0700 |
commit | fcf37ec6c28f3d62773097c2fd0d5d56c4b2f2ff (patch) | |
tree | 56eb130211124c81541bb969788b78943da1508e /module/zfs/dsl_dir.c | |
parent | 48c67dc8f8d822dbd2fec51d5e46cdb445f66814 (diff) |
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 <[email protected]>
Diffstat (limited to 'module/zfs/dsl_dir.c')
-rw-r--r-- | module/zfs/dsl_dir.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index ec1a6bb70..6ebf17f70 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); } |