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.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #7197
This commit is contained in:
Tom Caputi 2018-02-21 15:26:51 -05:00 committed by Brian Behlendorf
parent 478b3150de
commit 5121c4fb0c
1 changed files with 6 additions and 1 deletions

View 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);