K 10 svn:author V 7 asomers K 8 svn:date V 27 2019-10-11T14:59:28.488586Z K 7 svn:log V 1816 MFZol: Fix performance of "zfs recv" with many deletions This patch fixes 2 issues with the DMU free throttle implemented in dmu_free_long_range(). The first issue is that get_next_chunk() was calculating the number of L1 blocks the free would dirty incorrectly. In some cases involving extremely large files, this code would greatly overestimate the number of affected L1 blocks, causing excessive calls to txg_wait_open(). This patch corrects the calculation. The second issue is that the free throttle uses the total number of free'd blocks in all (open, quiescing, and syncing) txgs to determine whether to throttle. This causes large frees (such as those created by the first issue) to cause 4 txg syncs before any further frees were allowed to proceed. This patch ensures that the accounting is done entirely in a per-txg fashion, so that frees from a given txg don't affect those that immediately follow it. Reviewed-by: Brian Behlendorf Reviewed-by: Matthew Ahrens Signed-off-by: Tom Caputi zfsonlinux/zfs@f4c594da94d856c422512a54e48070f890b2685b Freeing throttle should account for holes Deletion throttle currently does not account for holes in a file. This means that it can activate when it shouldn't. To fix it we switch the throttle to be based on the number of L1 blocks we will have to dirty when freeing Reviewed-by: Tom Caputi Reviewed-by: Matt Ahrens Reviewed-by: Brian Behlendorf Signed-off-by: Alek Pinchuk zfsonlinux/zfs@65282ee9e06b130f1f0169baf5d9bf0dd8fc1ef9 Submitted by: Alek Pinchuk Reviewed by: allanjude MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D21895 END