]> granicus.if.org Git - zfs/commitdiff
Remove unnecessary txg syncs from receive_object()
authorTom Caputi <tcaputi@datto.com>
Wed, 21 Feb 2018 20:26:51 +0000 (15:26 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Feb 2018 20:26:51 +0000 (12:26 -0800)
1b66810b introduced serveral changes which improved the reliability
of zfs sends when large dnodes were involved. However, these fixes
required adding a few calls to txg_wait_synced() in the DRR_OBJECT
handling code. Although most of them are currently necessary, this
patch allows the code to continue without waiting in some cases
where it doesn't have to.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #7197

module/zfs/dmu_send.c

index 2c2ed8fb31911e445e7975182d6b0563639ca8c2..8ca77e95dbf0c58f173ea1707d643f6b6c545f31 100644 (file)
@@ -2546,6 +2546,8 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro,
         * these objects before we attempt to allocate the new dnode.
         */
        if (drro->drr_dn_slots > 1) {
+               boolean_t need_sync = B_FALSE;
+
                for (uint64_t slot = drro->drr_object + 1;
                    slot < drro->drr_object + drro->drr_dn_slots;
                    slot++) {
@@ -2564,9 +2566,12 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro,
 
                        if (err != 0)
                                return (err);
+
+                       need_sync = B_TRUE;
                }
 
-               txg_wait_synced(dmu_objset_pool(rwa->os), 0);
+               if (need_sync)
+                       txg_wait_synced(dmu_objset_pool(rwa->os), 0);
        }
 
        tx = dmu_tx_create(rwa->os);