summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-10-03 07:35:11 +0000
committermav <mav@FreeBSD.org>2015-10-03 07:35:11 +0000
commiteae1444b6e30ea05a3b44f850f064dadf0c0d5c3 (patch)
tree01292b2e0b5c8e938597e1e3f45c1b3f02b29a50 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
parente332f4773349c62b5a2597610d7ef0ce63f7abed (diff)
downloadFreeBSD-src-eae1444b6e30ea05a3b44f850f064dadf0c0d5c3.zip
FreeBSD-src-eae1444b6e30ea05a3b44f850f064dadf0c0d5c3.tar.gz
MFC r286593: Local addition and mismerge fix for r286579.
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
index 245f360..49d87e6 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
@@ -311,11 +311,12 @@ vdev_queue_class_tree(vdev_queue_t *vq, zio_priority_t p)
static inline avl_tree_t *
vdev_queue_type_tree(vdev_queue_t *vq, zio_type_t t)
{
- ASSERT(t == ZIO_TYPE_READ || t == ZIO_TYPE_WRITE);
if (t == ZIO_TYPE_READ)
return (&vq->vq_read_offset_tree);
- else
+ else if (t == ZIO_TYPE_WRITE)
return (&vq->vq_write_offset_tree);
+ else
+ return (NULL);
}
int
@@ -397,10 +398,13 @@ static void
vdev_queue_io_add(vdev_queue_t *vq, zio_t *zio)
{
spa_t *spa = zio->io_spa;
+ avl_tree_t *qtt;
ASSERT(MUTEX_HELD(&vq->vq_lock));
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
avl_add(vdev_queue_class_tree(vq, zio->io_priority), zio);
- avl_add(vdev_queue_type_tree(vq, zio->io_type), zio);
+ qtt = vdev_queue_type_tree(vq, zio->io_type);
+ if (qtt)
+ avl_add(qtt, zio);
#ifdef illumos
mutex_enter(&spa->spa_iokstat_lock);
@@ -415,10 +419,13 @@ static void
vdev_queue_io_remove(vdev_queue_t *vq, zio_t *zio)
{
spa_t *spa = zio->io_spa;
+ avl_tree_t *qtt;
ASSERT(MUTEX_HELD(&vq->vq_lock));
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
avl_remove(vdev_queue_class_tree(vq, zio->io_priority), zio);
- avl_remove(vdev_queue_type_tree(vq, zio->io_type), zio);
+ qtt = vdev_queue_type_tree(vq, zio->io_type);
+ if (qtt)
+ avl_remove(qtt, zio);
#ifdef illumos
mutex_enter(&spa->spa_iokstat_lock);
@@ -636,15 +643,6 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
if (zio->io_flags & ZIO_FLAG_DONT_AGGREGATE)
return (NULL);
- /*
- * The synchronous i/o queues are not sorted by LBA, so we can't
- * find adjacent i/os. These i/os tend to not be tightly clustered,
- * or too large to aggregate, so this has little impact on performance.
- */
- if (zio->io_priority == ZIO_PRIORITY_SYNC_READ ||
- zio->io_priority == ZIO_PRIORITY_SYNC_WRITE)
- return (NULL);
-
first = last = zio;
if (zio->io_type == ZIO_TYPE_READ)
@@ -671,7 +669,7 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
*/
flags = zio->io_flags & ZIO_FLAG_AGG_INHERIT;
t = vdev_queue_type_tree(vq, zio->io_type);
- while ((dio = AVL_PREV(t, first)) != NULL &&
+ while (t != NULL && (dio = AVL_PREV(t, first)) != NULL &&
(dio->io_flags & ZIO_FLAG_AGG_INHERIT) == flags &&
IO_SPAN(dio, last) <= zfs_vdev_aggregation_limit &&
IO_GAP(dio, first) <= maxgap) {
OpenPOWER on IntegriCloud