]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - module/zfs/vdev_queue.c
Imported Upstream version 0.6.5.8
[mirror_zfs-debian.git] / module / zfs / vdev_queue.c
index 0c62a6fa3c7df4b3de618166dab6c710d7b6642a..4ed62f96328c8da8aee7a083afe2c9b3a07c1093 100644 (file)
@@ -249,20 +249,29 @@ static int
 vdev_queue_max_async_writes(spa_t *spa)
 {
        int writes;
-       uint64_t dirty = spa->spa_dsl_pool->dp_dirty_total;
+       uint64_t dirty = 0;
+       dsl_pool_t *dp = spa_get_dsl(spa);
        uint64_t min_bytes = zfs_dirty_data_max *
            zfs_vdev_async_write_active_min_dirty_percent / 100;
        uint64_t max_bytes = zfs_dirty_data_max *
            zfs_vdev_async_write_active_max_dirty_percent / 100;
 
+       /*
+        * Async writes may occur before the assignment of the spa's
+        * dsl_pool_t if a self-healing zio is issued prior to the
+        * completion of dmu_objset_open_impl().
+        */
+       if (dp == NULL)
+               return (zfs_vdev_async_write_max_active);
+
        /*
         * Sync tasks correspond to interactive user actions. To reduce the
         * execution time of those actions we push data out as fast as possible.
         */
-       if (spa_has_pending_synctask(spa)) {
+       if (spa_has_pending_synctask(spa))
                return (zfs_vdev_async_write_max_active);
-       }
 
+       dirty = dp->dp_dirty_total;
        if (dirty < min_bytes)
                return (zfs_vdev_async_write_min_active);
        if (dirty > max_bytes)