]> git.proxmox.com Git - mirror_zfs.git/blobdiff - module/zfs/dsl_pool.c
OpenZFS 6569 - large file delete can starve out write ops
[mirror_zfs.git] / module / zfs / dsl_pool.c
index 2ff3ae45681ff1cee85fd17d7b64adc10b5aedb0..1b8b780aa40175231fc9c6ce87861f818950cc3c 100644 (file)
@@ -23,6 +23,7 @@
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <sys/dsl_pool.h>
@@ -509,6 +510,16 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
         */
        dsl_pool_undirty_space(dp, dp->dp_dirty_pertxg[txg & TXG_MASK], txg);
 
+       /*
+        * Update the long range free counter after
+        * we're done syncing user data
+        */
+       mutex_enter(&dp->dp_lock);
+       ASSERT(spa_sync_pass(dp->dp_spa) == 1 ||
+           dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] == 0);
+       dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] = 0;
+       mutex_exit(&dp->dp_lock);
+
        /*
         * After the data blocks have been written (ensured by the zio_wait()
         * above), update the user/group space accounting.