summaryrefslogtreecommitdiffstats
path: root/module/zfs/vdev_queue.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-08-05 13:57:59 -0700
committerBrian Behlendorf <[email protected]>2014-08-11 08:44:54 -0700
commit50b25b2187134ac7b19cf93bd35a420223f1d343 (patch)
tree266c3960875762f8243847ad51a96416998e50ac /module/zfs/vdev_queue.c
parentab6f407faa0188219fb4852ac5e05f1934c985ee (diff)
Avoid dynamic allocation of 'search zio'
As part of commit e8b96c6 the search zio used by the vdev_queue_io_to_issue() function was moved to the heap to minimize stack usage. Functionally this is fine, but to maximize performance it's best to minimize the number of dynamic allocations. To avoid this allocation temporary space for the search zio has been reserved in the vdev_queue structure. All access must be serialized through the vq_lock. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ned Bass <[email protected]> Closes #2572
Diffstat (limited to 'module/zfs/vdev_queue.c')
-rw-r--r--module/zfs/vdev_queue.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/module/zfs/vdev_queue.c b/module/zfs/vdev_queue.c
index 0dc733efc..e2758d1c4 100644
--- a/module/zfs/vdev_queue.c
+++ b/module/zfs/vdev_queue.c
@@ -659,7 +659,6 @@ vdev_queue_io_to_issue(vdev_queue_t *vq)
zio_priority_t p;
avl_index_t idx;
vdev_queue_class_t *vqc;
- zio_t *search;
again:
ASSERT(MUTEX_HELD(&vq->vq_lock));
@@ -678,11 +677,10 @@ again:
* For FIFO queues (sync), issue the i/o with the lowest timestamp.
*/
vqc = &vq->vq_class[p];
- search = zio_buf_alloc(sizeof (*search));
- search->io_timestamp = 0;
- search->io_offset = vq->vq_last_offset + 1;
- VERIFY3P(avl_find(&vqc->vqc_queued_tree, search, &idx), ==, NULL);
- zio_buf_free(search, sizeof (*search));
+ vq->vq_io_search.io_timestamp = 0;
+ vq->vq_io_search.io_offset = vq->vq_last_offset + 1;
+ VERIFY3P(avl_find(&vqc->vqc_queued_tree, &vq->vq_io_search,
+ &idx), ==, NULL);
zio = avl_nearest(&vqc->vqc_queued_tree, idx, AVL_AFTER);
if (zio == NULL)
zio = avl_first(&vqc->vqc_queued_tree);