Module Name:    src
Committed By:   jdolecek
Date:           Wed Jun 24 16:23:16 UTC 2020

Modified Files:
        src/external/cddl/osnet/dist/uts/common/fs/zfs: dsl_scan.c

Log Message:
change dsl_scan_visitbp() to allocate blkptr_t dynamically rather than
on-stack - this function is called recursively, and the 120 bytes per call
add up; also remove unused variable

part of fix for PR kern/55402 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.2
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.1.1.1	Mon May 28 20:52:57 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c	Wed Jun 24 16:23:16 2020
@@ -778,10 +778,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
     dmu_objset_type_t ostype, dmu_tx_t *tx)
 {
 	dsl_pool_t *dp = scn->scn_dp;
-	arc_buf_t *buf = NULL;
-	blkptr_t bp_toread = *bp;
-
-	/* ASSERT(pbuf == NULL || arc_released(pbuf)); */
+	blkptr_t *bp_toread = NULL;
 
 	if (dsl_scan_check_pause(scn, zb))
 		return;
@@ -803,8 +800,11 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 	if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
 		return;
 
-	if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx) != 0)
-		return;
+	bp_toread = kmem_alloc(sizeof (blkptr_t), KM_SLEEP);
+	*bp_toread = *bp;
+
+	if (dsl_scan_recurse(scn, ds, ostype, dnp, bp_toread, zb, tx) != 0)
+		goto out;
 
 	/*
 	 * If dsl_scan_ddt() has aready visited this block, it will have
@@ -813,8 +813,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 	 */
 	if (ddt_class_contains(dp->dp_spa,
 	    scn->scn_phys.scn_ddt_class_max, bp)) {
-		ASSERT(buf == NULL);
-		return;
+		goto out;
 	}
 
 	/*
@@ -827,6 +826,9 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 	if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) {
 		scan_funcs[scn->scn_phys.scn_func](dp, bp, zb);
 	}
+
+out:
+	kmem_free(bp_toread, sizeof (blkptr_t));
 }
 
 static void

Reply via email to