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

Function zio_create

freebsd/contrib/openzfs/module/zfs/zio.c:807–896  ·  view source on GitHub ↗

* ========================================================================== * Create the various types of I/O (read, write, free, etc) * ========================================================================== */

Source from the content-addressed store, hash-verified

805 * ==========================================================================
806 */
807static zio_t *
808zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
809 abd_t *data, uint64_t lsize, uint64_t psize, zio_done_func_t *done,
810 void *private, zio_type_t type, zio_priority_t priority,
811 enum zio_flag flags, vdev_t *vd, uint64_t offset,
812 const zbookmark_phys_t *zb, enum zio_stage stage,
813 enum zio_stage pipeline)
814{
815 zio_t *zio;
816
817 IMPLY(type != ZIO_TYPE_TRIM, psize <= SPA_MAXBLOCKSIZE);
818 ASSERT(P2PHASE(psize, SPA_MINBLOCKSIZE) == 0);
819 ASSERT(P2PHASE(offset, SPA_MINBLOCKSIZE) == 0);
820
821 ASSERT(!vd || spa_config_held(spa, SCL_STATE_ALL, RW_READER));
822 ASSERT(!bp || !(flags & ZIO_FLAG_CONFIG_WRITER));
823 ASSERT(vd || stage == ZIO_STAGE_OPEN);
824
825 IMPLY(lsize != psize, (flags & ZIO_FLAG_RAW_COMPRESS) != 0);
826
827 zio = kmem_cache_alloc(zio_cache, KM_SLEEP);
828 bzero(zio, sizeof (zio_t));
829
830 mutex_init(&zio->io_lock, NULL, MUTEX_NOLOCKDEP, NULL);
831 cv_init(&zio->io_cv, NULL, CV_DEFAULT, NULL);
832
833 list_create(&zio->io_parent_list, sizeof (zio_link_t),
834 offsetof(zio_link_t, zl_parent_node));
835 list_create(&zio->io_child_list, sizeof (zio_link_t),
836 offsetof(zio_link_t, zl_child_node));
837 metaslab_trace_init(&zio->io_alloc_list);
838
839 if (vd != NULL)
840 zio->io_child_type = ZIO_CHILD_VDEV;
841 else if (flags & ZIO_FLAG_GANG_CHILD)
842 zio->io_child_type = ZIO_CHILD_GANG;
843 else if (flags & ZIO_FLAG_DDT_CHILD)
844 zio->io_child_type = ZIO_CHILD_DDT;
845 else
846 zio->io_child_type = ZIO_CHILD_LOGICAL;
847
848 if (bp != NULL) {
849 zio->io_bp = (blkptr_t *)bp;
850 zio->io_bp_copy = *bp;
851 zio->io_bp_orig = *bp;
852 if (type != ZIO_TYPE_WRITE ||
853 zio->io_child_type == ZIO_CHILD_DDT)
854 zio->io_bp = &zio->io_bp_copy; /* so caller can free */
855 if (zio->io_child_type == ZIO_CHILD_LOGICAL)
856 zio->io_logical = zio;
857 if (zio->io_child_type > ZIO_CHILD_GANG && BP_IS_GANG(bp))
858 pipeline |= ZIO_GANG_STAGES;
859 }
860
861 zio->io_spa = spa;
862 zio->io_txg = txg;
863 zio->io_done = done;
864 zio->io_private = private;

Callers 12

zio_nullFunction · 0.85
zio_readFunction · 0.85
zio_writeFunction · 0.85
zio_rewriteFunction · 0.85
zio_free_syncFunction · 0.85
zio_claimFunction · 0.85
zio_ioctlFunction · 0.85
zio_trimFunction · 0.85
zio_read_physFunction · 0.85
zio_write_physFunction · 0.85
zio_vdev_child_ioFunction · 0.85
zio_vdev_delegated_ioFunction · 0.85

Calls 9

spa_config_heldFunction · 0.85
kmem_cache_allocFunction · 0.85
bzeroFunction · 0.85
metaslab_trace_initFunction · 0.85
zio_add_childFunction · 0.85
mutex_initFunction · 0.50
cv_initFunction · 0.50
list_createFunction · 0.50
taskq_init_entFunction · 0.50

Tested by

no test coverage detected