From e0affc8f9b7135b137a55d791bf79691ba92d81d Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Thu, 15 Feb 2018 14:38:49 -0500 Subject: [PATCH] Remove unnecessary txg syncs from receive_object() 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. Signed-off-by: Tom Caputi --- module/zfs/dmu_send.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index 2c2ed8fb3191..8ca77e95dbf0 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -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);