| 920 | } |
| 921 | |
| 922 | zio_t * |
| 923 | vdev_queue_io(zio_t *zio) |
| 924 | { |
| 925 | vdev_queue_t *vq = &zio->io_vd->vdev_queue; |
| 926 | zio_t *nio; |
| 927 | |
| 928 | if (zio->io_flags & ZIO_FLAG_DONT_QUEUE) |
| 929 | return (zio); |
| 930 | |
| 931 | /* |
| 932 | * Children i/os inherent their parent's priority, which might |
| 933 | * not match the child's i/o type. Fix it up here. |
| 934 | */ |
| 935 | if (zio->io_type == ZIO_TYPE_READ) { |
| 936 | ASSERT(zio->io_priority != ZIO_PRIORITY_TRIM); |
| 937 | |
| 938 | if (zio->io_priority != ZIO_PRIORITY_SYNC_READ && |
| 939 | zio->io_priority != ZIO_PRIORITY_ASYNC_READ && |
| 940 | zio->io_priority != ZIO_PRIORITY_SCRUB && |
| 941 | zio->io_priority != ZIO_PRIORITY_REMOVAL && |
| 942 | zio->io_priority != ZIO_PRIORITY_INITIALIZING && |
| 943 | zio->io_priority != ZIO_PRIORITY_REBUILD) { |
| 944 | zio->io_priority = ZIO_PRIORITY_ASYNC_READ; |
| 945 | } |
| 946 | } else if (zio->io_type == ZIO_TYPE_WRITE) { |
| 947 | ASSERT(zio->io_priority != ZIO_PRIORITY_TRIM); |
| 948 | |
| 949 | if (zio->io_priority != ZIO_PRIORITY_SYNC_WRITE && |
| 950 | zio->io_priority != ZIO_PRIORITY_ASYNC_WRITE && |
| 951 | zio->io_priority != ZIO_PRIORITY_REMOVAL && |
| 952 | zio->io_priority != ZIO_PRIORITY_INITIALIZING && |
| 953 | zio->io_priority != ZIO_PRIORITY_REBUILD) { |
| 954 | zio->io_priority = ZIO_PRIORITY_ASYNC_WRITE; |
| 955 | } |
| 956 | } else { |
| 957 | ASSERT(zio->io_type == ZIO_TYPE_TRIM); |
| 958 | ASSERT(zio->io_priority == ZIO_PRIORITY_TRIM); |
| 959 | } |
| 960 | |
| 961 | zio->io_flags |= ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE; |
| 962 | |
| 963 | mutex_enter(&vq->vq_lock); |
| 964 | zio->io_timestamp = gethrtime(); |
| 965 | vdev_queue_io_add(vq, zio); |
| 966 | nio = vdev_queue_io_to_issue(vq); |
| 967 | mutex_exit(&vq->vq_lock); |
| 968 | |
| 969 | if (nio == NULL) |
| 970 | return (NULL); |
| 971 | |
| 972 | if (nio->io_done == vdev_queue_agg_io_done) { |
| 973 | zio_nowait(nio); |
| 974 | return (NULL); |
| 975 | } |
| 976 | |
| 977 | return (nio); |
| 978 | } |
| 979 |
no test coverage detected