Skip to content

Commit

Permalink
Update vdev_queue.c
Browse files Browse the repository at this point in the history
  • Loading branch information
GeLiXin committed May 16, 2016
1 parent e6cfd63 commit c137bc0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion module/zfs/vdev_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,23 @@ 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;
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 be issued before the pool finish the process of
* initialization, which means we can't get the statistics of dirty
* data from the spa. typically this happens when the self-healing
* zio was issued by mirror while importing. we push data out as fast
* as possible to speed up the initialization.
*/
if (spa->spa_dsl_pool == 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.
Expand All @@ -263,6 +274,7 @@ vdev_queue_max_async_writes(spa_t *spa)
return (zfs_vdev_async_write_max_active);
}

dirty = spa->spa_dsl_pool->dp_dirty_total;
if (dirty < min_bytes)
return (zfs_vdev_async_write_min_active);
if (dirty > max_bytes)
Expand Down

0 comments on commit c137bc0

Please sign in to comment.