Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | |||||
int zfs_vdev_async_write_active_max_dirty_percent = 60; | int zfs_vdev_async_write_active_max_dirty_percent = 60; | ||||
/* | /* | ||||
* To reduce IOPs, we aggregate small adjacent I/Os into one large I/O. | * To reduce IOPs, we aggregate small adjacent I/Os into one large I/O. | ||||
* For read I/Os, we also aggregate across small adjacency gaps; for writes | * For read I/Os, we also aggregate across small adjacency gaps; for writes | ||||
* we include spans of optional I/Os to aid aggregation at the disk even when | * we include spans of optional I/Os to aid aggregation at the disk even when | ||||
* they aren't able to help us aggregate at this level. | * they aren't able to help us aggregate at this level. | ||||
*/ | */ | ||||
int zfs_vdev_aggregation_limit = SPA_OLD_MAXBLOCKSIZE; | int zfs_vdev_aggregation_limit = 1 << 20; | ||||
int zfs_vdev_read_gap_limit = 32 << 10; | int zfs_vdev_read_gap_limit = 32 << 10; | ||||
int zfs_vdev_write_gap_limit = 4 << 10; | int zfs_vdev_write_gap_limit = 4 << 10; | ||||
/* | /* | ||||
* Define the queue depth percentage for each top-level. This percentage is | * Define the queue depth percentage for each top-level. This percentage is | ||||
* used in conjunction with zfs_vdev_async_max_active to determine how many | * used in conjunction with zfs_vdev_async_max_active to determine how many | ||||
* allocations a specific top-level vdev should handle. Once the queue depth | * allocations a specific top-level vdev should handle. Once the queue depth | ||||
* reaches zfs_vdev_queue_depth_pct * zfs_vdev_async_write_max_active / 100 | * reaches zfs_vdev_queue_depth_pct * zfs_vdev_async_write_max_active / 100 | ||||
▲ Show 20 Lines • Show All 741 Lines • ▼ Show 20 Lines | while ((nio = vdev_queue_io_to_issue(vq)) != NULL) { | ||||
mutex_exit(&vq->vq_lock); | mutex_exit(&vq->vq_lock); | ||||
if (nio->io_done == vdev_queue_agg_io_done) { | if (nio->io_done == vdev_queue_agg_io_done) { | ||||
zio_nowait(nio); | zio_nowait(nio); | ||||
} else { | } else { | ||||
zio_vdev_io_reissue(nio); | zio_vdev_io_reissue(nio); | ||||
zio_execute(nio); | zio_execute(nio); | ||||
} | } | ||||
mutex_enter(&vq->vq_lock); | mutex_enter(&vq->vq_lock); | ||||
} | |||||
mutex_exit(&vq->vq_lock); | |||||
} | |||||
void | |||||
vdev_queue_change_io_priority(zio_t *zio, zio_priority_t priority) | |||||
{ | |||||
vdev_queue_t *vq = &zio->io_vd->vdev_queue; | |||||
avl_tree_t *tree; | |||||
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); | |||||
ASSERT3U(priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); | |||||
if (zio->io_type == ZIO_TYPE_READ) { | |||||
if (priority != ZIO_PRIORITY_SYNC_READ && | |||||
priority != ZIO_PRIORITY_ASYNC_READ && | |||||
priority != ZIO_PRIORITY_SCRUB) | |||||
priority = ZIO_PRIORITY_ASYNC_READ; | |||||
} else { | |||||
ASSERT(zio->io_type == ZIO_TYPE_WRITE); | |||||
if (priority != ZIO_PRIORITY_SYNC_WRITE && | |||||
priority != ZIO_PRIORITY_ASYNC_WRITE) | |||||
priority = ZIO_PRIORITY_ASYNC_WRITE; | |||||
} | |||||
mutex_enter(&vq->vq_lock); | |||||
/* | |||||
* If the zio is in none of the queues we can simply change | |||||
* the priority. If the zio is waiting to be submitted we must | |||||
* remove it from the queue and re-insert it with the new priority. | |||||
* Otherwise, the zio is currently active and we cannot change its | |||||
* priority. | |||||
*/ | |||||
tree = vdev_queue_class_tree(vq, zio->io_priority); | |||||
if (avl_find(tree, zio, NULL) == zio) { | |||||
avl_remove(vdev_queue_class_tree(vq, zio->io_priority), zio); | |||||
zio->io_priority = priority; | |||||
avl_add(vdev_queue_class_tree(vq, zio->io_priority), zio); | |||||
} else if (avl_find(&vq->vq_active_tree, zio, NULL) != zio) { | |||||
zio->io_priority = priority; | |||||
} | } | ||||
mutex_exit(&vq->vq_lock); | mutex_exit(&vq->vq_lock); | ||||
} | } | ||||
/* | /* | ||||
* As these three methods are only used for load calculations we're not concerned | * As these three methods are only used for load calculations we're not concerned | ||||
* if we get an incorrect value on 32bit platforms due to lack of vq_lock mutex | * if we get an incorrect value on 32bit platforms due to lack of vq_lock mutex | ||||
Show All 19 Lines |