From 98e570fb4658252aa06716df381f92b09af2560e Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 8 May 2016 14:13:41 +0200 Subject: [PATCH 238/257] dmu_tx_assign(): Use local variable and use the whole v_free_count if it's below the target Obtained from: ElectroBSD --- .../contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c index 6342d397928a..0c10b307698b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c @@ -1382,27 +1382,29 @@ dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how) * honor that as a hard cap so it remains a usable tunable value. */ if (zio_use_uma && zfs_dynamic_write_buffer) { - zfs_dirty_data_max_internal = MIN(zfs_dirty_data_max, zfs_dirty_data_max_max); + uint64_t new_max; + + new_max = MIN(zfs_dirty_data_max, zfs_dirty_data_max_max); if (vm_cnt.v_free_count > vm_cnt.v_free_target) { - zfs_dirty_data_max_internal = MIN(zfs_dirty_data_max_internal, + new_max = MIN(new_max, ptob(vm_cnt.v_free_count - vm_cnt.v_free_target)); } else { - zfs_dirty_data_max_internal = MIN(zfs_dirty_data_max_internal, - ptob(vm_cnt.v_free_count / 2)); + new_max = MIN(new_max, vm_cnt.v_free_count); } - zfs_dirty_data_max_internal = MIN(last_max + zfs_dirty_data_max_min, zfs_dirty_data_max_internal); - if (last_max != zfs_dirty_data_max_internal) { - last_max = zfs_dirty_data_max_internal; + new_max = MIN(last_max + zfs_dirty_data_max_min, new_max); + if (last_max != new_max) { + last_max = new_max; DTRACE_PROBE1(dmu__tx_dirty, uint64_t, last_max / (1024 * 1024)); } - zfs_dirty_data_max_internal = MAX(zfs_dirty_data_max_internal, zfs_dirty_data_max_min); - if (zfs_dirty_data_max_internal < zfs_dirty_data_max) { + new_max = MAX(new_max, zfs_dirty_data_max_min); + if (new_max < zfs_dirty_data_max) { zfs_dynamic_write_buffer_hits++; } if (zfs_lowest_dynamic_write_buffer_limit == 0 || - zfs_lowest_dynamic_write_buffer_limit >= zfs_dirty_data_max_internal) { - zfs_lowest_dynamic_write_buffer_limit = zfs_dirty_data_max_internal; + zfs_lowest_dynamic_write_buffer_limit >= new_max) { + zfs_lowest_dynamic_write_buffer_limit = new_max; } + zfs_dirty_data_max_internal = new_max; } else { zfs_dirty_data_max_internal = zfs_dirty_data_max; } -- 2.11.0