Author: mav
Date: Sat Oct  3 07:35:11 2015
New Revision: 288555
URL: https://svnweb.freebsd.org/changeset/base/288555

Log:
  MFC r286593: Local addition and mismerge fix for r286579.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c       
Sat Oct  3 07:34:21 2015        (r288554)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c       
Sat Oct  3 07:35:11 2015        (r288555)
@@ -311,11 +311,12 @@ vdev_queue_class_tree(vdev_queue_t *vq, 
 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, z
        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, z
         */
        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) {
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to