MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vdev_queue_init

Function vdev_queue_init

freebsd/contrib/openzfs/module/zfs/vdev_queue.c:457–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void
458vdev_queue_init(vdev_t *vd)
459{
460 vdev_queue_t *vq = &vd->vdev_queue;
461 zio_priority_t p;
462
463 mutex_init(&vq->vq_lock, NULL, MUTEX_DEFAULT, NULL);
464 vq->vq_vdev = vd;
465 taskq_init_ent(&vd->vdev_queue.vq_io_search.io_tqent);
466
467 avl_create(&vq->vq_active_tree, vdev_queue_offset_compare,
468 sizeof (zio_t), offsetof(struct zio, io_queue_node));
469 avl_create(vdev_queue_type_tree(vq, ZIO_TYPE_READ),
470 vdev_queue_offset_compare, sizeof (zio_t),
471 offsetof(struct zio, io_offset_node));
472 avl_create(vdev_queue_type_tree(vq, ZIO_TYPE_WRITE),
473 vdev_queue_offset_compare, sizeof (zio_t),
474 offsetof(struct zio, io_offset_node));
475 avl_create(vdev_queue_type_tree(vq, ZIO_TYPE_TRIM),
476 vdev_queue_offset_compare, sizeof (zio_t),
477 offsetof(struct zio, io_offset_node));
478
479 for (p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) {
480 int (*compfn) (const void *, const void *);
481
482 /*
483 * The synchronous/trim i/o queues are dispatched in FIFO rather
484 * than LBA order. This provides more consistent latency for
485 * these i/os.
486 */
487 if (p == ZIO_PRIORITY_SYNC_READ ||
488 p == ZIO_PRIORITY_SYNC_WRITE ||
489 p == ZIO_PRIORITY_TRIM) {
490 compfn = vdev_queue_timestamp_compare;
491 } else {
492 compfn = vdev_queue_offset_compare;
493 }
494 avl_create(vdev_queue_class_tree(vq, p), compfn,
495 sizeof (zio_t), offsetof(struct zio, io_queue_node));
496 }
497
498 vq->vq_last_offset = 0;
499}
500
501void
502vdev_queue_fini(vdev_t *vd)

Callers 1

vdev_alloc_commonFunction · 0.85

Calls 5

avl_createFunction · 0.85
vdev_queue_type_treeFunction · 0.85
vdev_queue_class_treeFunction · 0.85
mutex_initFunction · 0.50
taskq_init_entFunction · 0.50

Tested by

no test coverage detected