summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 10:53:43 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 08:38:48 -0700
commit161ce7ce3cfc7ec1cd3c93d27f25a94b7408588f (patch)
tree0c932a74f68a925656ad6dae4c7a2124b67bbaf9
parentfcf37ec6c28f3d62773097c2fd0d5d56c4b2f2ff (diff)
Fix stack dsl_scan_visitbp()
To reduce stack overhead this topic branch moves the 128 byte blkptr_t data strucutre in dsl_scan_visitbp() to the heap. Signed-off-by: Brian Behlendorf <[email protected]>
-rw-r--r--module/zfs/dsl_scan.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c
index e18dadf44..525832b45 100644
--- a/module/zfs/dsl_scan.c
+++ b/module/zfs/dsl_scan.c
@@ -792,18 +792,21 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
{
dsl_pool_t *dp = scn->scn_dp;
arc_buf_t *buf = NULL;
- blkptr_t bp_toread = *bp;
+ blkptr_t *bp_toread;
+
+ bp_toread = kmem_alloc(sizeof (blkptr_t), KM_SLEEP);
+ *bp_toread = *bp;
/* ASSERT(pbuf == NULL || arc_released(pbuf)); */
if (dsl_scan_check_pause(scn, zb))
- return;
+ goto out;
if (dsl_scan_check_resume(scn, dnp, zb))
- return;
+ goto out;
if (bp->blk_birth == 0)
- return;
+ goto out;
scn->scn_visited_this_txg++;
@@ -814,7 +817,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
pbuf, bp);
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
- return;
+ goto out;
if (BP_GET_TYPE(bp) != DMU_OT_USERGROUP_USED) {
/*
@@ -829,12 +832,12 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
* it (original untranslated -> translations from
* deleted snap -> now).
*/
- bp_toread = *bp;
+ *bp_toread = *bp;
}
- if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx,
+ if (dsl_scan_recurse(scn, ds, ostype, dnp, bp_toread, zb, tx,
&buf) != 0)
- return;
+ goto out;
/*
* If dsl_scan_ddt() has aready visited this block, it will have
@@ -844,7 +847,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
if (ddt_class_contains(dp->dp_spa,
scn->scn_phys.scn_ddt_class_max, bp)) {
ASSERT(buf == NULL);
- return;
+ goto out;
}
/*
@@ -859,6 +862,8 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
}
if (buf)
(void) arc_buf_remove_ref(buf, &buf);
+out:
+ kmem_free(bp_toread, sizeof(blkptr_t));
}
static void