Deleted Added
full compact
vdev_queue.c (219089) vdev_queue.c (247265)
1/*
2 * CDDL HEADER START
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 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
1/*
2 * CDDL HEADER START
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 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26/*
27 * Copyright (c) 2012 by Delphix. All rights reserved.
28 */
29
26#include <sys/zfs_context.h>
27#include <sys/vdev_impl.h>
28#include <sys/zio.h>
29#include <sys/avl.h>
30
31/*
32 * These tunables are for performance analysis.
33 */

--- 276 unchanged lines hidden (view full) ---

310 if (fio != lio) {
311 uint64_t size = IO_SPAN(fio, lio);
312 ASSERT(size <= zfs_vdev_aggregation_limit);
313
314 aio = zio_vdev_delegated_io(fio->io_vd, fio->io_offset,
315 zio_buf_alloc(size), size, fio->io_type, ZIO_PRIORITY_AGG,
316 flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE,
317 vdev_queue_agg_io_done, NULL);
30#include <sys/zfs_context.h>
31#include <sys/vdev_impl.h>
32#include <sys/zio.h>
33#include <sys/avl.h>
34
35/*
36 * These tunables are for performance analysis.
37 */

--- 276 unchanged lines hidden (view full) ---

314 if (fio != lio) {
315 uint64_t size = IO_SPAN(fio, lio);
316 ASSERT(size <= zfs_vdev_aggregation_limit);
317
318 aio = zio_vdev_delegated_io(fio->io_vd, fio->io_offset,
319 zio_buf_alloc(size), size, fio->io_type, ZIO_PRIORITY_AGG,
320 flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE,
321 vdev_queue_agg_io_done, NULL);
322 aio->io_timestamp = fio->io_timestamp;
318
319 nio = fio;
320 do {
321 dio = nio;
322 nio = AVL_NEXT(t, dio);
323 ASSERT(dio->io_type == aio->io_type);
324 ASSERT(dio->io_vdev_tree == t);
325

--- 55 unchanged lines hidden (view full) ---

381
382 if (zio->io_type == ZIO_TYPE_READ)
383 zio->io_vdev_tree = &vq->vq_read_tree;
384 else
385 zio->io_vdev_tree = &vq->vq_write_tree;
386
387 mutex_enter(&vq->vq_lock);
388
323
324 nio = fio;
325 do {
326 dio = nio;
327 nio = AVL_NEXT(t, dio);
328 ASSERT(dio->io_type == aio->io_type);
329 ASSERT(dio->io_vdev_tree == t);
330

--- 55 unchanged lines hidden (view full) ---

386
387 if (zio->io_type == ZIO_TYPE_READ)
388 zio->io_vdev_tree = &vq->vq_read_tree;
389 else
390 zio->io_vdev_tree = &vq->vq_write_tree;
391
392 mutex_enter(&vq->vq_lock);
393
389 zio->io_deadline = (ddi_get_lbolt64() >> zfs_vdev_time_shift) +
394 zio->io_timestamp = ddi_get_lbolt64();
395 zio->io_deadline = (zio->io_timestamp >> zfs_vdev_time_shift) +
390 zio->io_priority;
391
392 vdev_queue_io_add(vq, zio);
393
394 nio = vdev_queue_io_to_issue(vq, zfs_vdev_min_pending);
395
396 mutex_exit(&vq->vq_lock);
397

--- 8 unchanged lines hidden (view full) ---

406 return (nio);
407}
408
409void
410vdev_queue_io_done(zio_t *zio)
411{
412 vdev_queue_t *vq = &zio->io_vd->vdev_queue;
413
396 zio->io_priority;
397
398 vdev_queue_io_add(vq, zio);
399
400 nio = vdev_queue_io_to_issue(vq, zfs_vdev_min_pending);
401
402 mutex_exit(&vq->vq_lock);
403

--- 8 unchanged lines hidden (view full) ---

412 return (nio);
413}
414
415void
416vdev_queue_io_done(zio_t *zio)
417{
418 vdev_queue_t *vq = &zio->io_vd->vdev_queue;
419
420 if (zio_injection_enabled)
421 delay(SEC_TO_TICK(zio_handle_io_delay(zio)));
422
414 mutex_enter(&vq->vq_lock);
415
416 avl_remove(&vq->vq_pending_tree, zio);
417
423 mutex_enter(&vq->vq_lock);
424
425 avl_remove(&vq->vq_pending_tree, zio);
426
427 vq->vq_io_complete_ts = ddi_get_lbolt64();
428 vq->vq_io_delta_ts = vq->vq_io_complete_ts - zio->io_timestamp;
429
418 for (int i = 0; i < zfs_vdev_ramp_rate; i++) {
419 zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending);
420 if (nio == NULL)
421 break;
422 mutex_exit(&vq->vq_lock);
423 if (nio->io_done == vdev_queue_agg_io_done) {
424 zio_nowait(nio);
425 } else {
426 zio_vdev_io_reissue(nio);
427 zio_execute(nio);
428 }
429 mutex_enter(&vq->vq_lock);
430 }
431
432 mutex_exit(&vq->vq_lock);
433}
430 for (int i = 0; i < zfs_vdev_ramp_rate; i++) {
431 zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending);
432 if (nio == NULL)
433 break;
434 mutex_exit(&vq->vq_lock);
435 if (nio->io_done == vdev_queue_agg_io_done) {
436 zio_nowait(nio);
437 } else {
438 zio_vdev_io_reissue(nio);
439 zio_execute(nio);
440 }
441 mutex_enter(&vq->vq_lock);
442 }
443
444 mutex_exit(&vq->vq_lock);
445}