3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2013 by Delphix. All rights reserved.
24 * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2013 Joyent, Inc. All rights reserved.
26 */
27
28 #include <sys/zfs_context.h>
29 #include <sys/fm/fs/zfs.h>
30 #include <sys/spa.h>
31 #include <sys/txg.h>
32 #include <sys/spa_impl.h>
33 #include <sys/vdev_impl.h>
34 #include <sys/zio_impl.h>
35 #include <sys/zio_compress.h>
36 #include <sys/zio_checksum.h>
37 #include <sys/dmu_objset.h>
38 #include <sys/arc.h>
39 #include <sys/ddt.h>
40 #include <sys/zfs_zone.h>
41 #include <sys/zfeature.h>
42
43 /*
1249 ASSERT(stage <= ZIO_STAGE_DONE);
1250
1251 /*
1252 * If we are in interrupt context and this pipeline stage
1253 * will grab a config lock that is held across I/O,
1254 * or may wait for an I/O that needs an interrupt thread
1255 * to complete, issue async to avoid deadlock.
1256 *
1257 * For VDEV_IO_START, we cut in line so that the io will
1258 * be sent to disk promptly.
1259 */
1260 if ((stage & ZIO_BLOCKING_STAGES) && zio->io_vd == NULL &&
1261 zio_taskq_member(zio, ZIO_TASKQ_INTERRUPT)) {
1262 boolean_t cut = (stage == ZIO_STAGE_VDEV_IO_START) ?
1263 zio_requeue_io_start_cut_in_line : B_FALSE;
1264 zio_taskq_dispatch(zio, ZIO_TASKQ_ISSUE, cut);
1265 return;
1266 }
1267
1268 zio->io_stage = stage;
1269 rv = zio_pipeline[highbit(stage) - 1](zio);
1270
1271 if (rv == ZIO_PIPELINE_STOP)
1272 return;
1273
1274 ASSERT(rv == ZIO_PIPELINE_CONTINUE);
1275 }
1276 }
1277
1278 /*
1279 * ==========================================================================
1280 * Initiate I/O, either sync or async
1281 * ==========================================================================
1282 */
1283 int
1284 zio_wait(zio_t *zio)
1285 {
1286 int error;
1287
1288 ASSERT(zio->io_stage == ZIO_STAGE_OPEN);
1289 ASSERT(zio->io_executor == NULL);
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
24 * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2013 Joyent, Inc. All rights reserved.
26 */
27
28 #include <sys/zfs_context.h>
29 #include <sys/fm/fs/zfs.h>
30 #include <sys/spa.h>
31 #include <sys/txg.h>
32 #include <sys/spa_impl.h>
33 #include <sys/vdev_impl.h>
34 #include <sys/zio_impl.h>
35 #include <sys/zio_compress.h>
36 #include <sys/zio_checksum.h>
37 #include <sys/dmu_objset.h>
38 #include <sys/arc.h>
39 #include <sys/ddt.h>
40 #include <sys/zfs_zone.h>
41 #include <sys/zfeature.h>
42
43 /*
1249 ASSERT(stage <= ZIO_STAGE_DONE);
1250
1251 /*
1252 * If we are in interrupt context and this pipeline stage
1253 * will grab a config lock that is held across I/O,
1254 * or may wait for an I/O that needs an interrupt thread
1255 * to complete, issue async to avoid deadlock.
1256 *
1257 * For VDEV_IO_START, we cut in line so that the io will
1258 * be sent to disk promptly.
1259 */
1260 if ((stage & ZIO_BLOCKING_STAGES) && zio->io_vd == NULL &&
1261 zio_taskq_member(zio, ZIO_TASKQ_INTERRUPT)) {
1262 boolean_t cut = (stage == ZIO_STAGE_VDEV_IO_START) ?
1263 zio_requeue_io_start_cut_in_line : B_FALSE;
1264 zio_taskq_dispatch(zio, ZIO_TASKQ_ISSUE, cut);
1265 return;
1266 }
1267
1268 zio->io_stage = stage;
1269 rv = zio_pipeline[highbit64(stage) - 1](zio);
1270
1271 if (rv == ZIO_PIPELINE_STOP)
1272 return;
1273
1274 ASSERT(rv == ZIO_PIPELINE_CONTINUE);
1275 }
1276 }
1277
1278 /*
1279 * ==========================================================================
1280 * Initiate I/O, either sync or async
1281 * ==========================================================================
1282 */
1283 int
1284 zio_wait(zio_t *zio)
1285 {
1286 int error;
1287
1288 ASSERT(zio->io_stage == ZIO_STAGE_OPEN);
1289 ASSERT(zio->io_executor == NULL);
|