Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs change dsl_scan_v...



details:   https://anonhg.NetBSD.org/src/rev/4042a99be219
branches:  trunk
changeset: 1011262:4042a99be219
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Jun 24 16:23:16 2020 +0000

description:
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

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (49 lines):

diff -r d6c88796b282 -r 4042a99be219 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c     Wed Jun 24 16:16:01 2020 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c     Wed Jun 24 16:23:16 2020 +0000
@@ -778,10 +778,7 @@
     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 @@
        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 @@
         */
        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 @@
        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



Home | Main Index | Thread Index | Old Index