Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero


2121 /*
2122  * ==========================================================================
2123  * Allocate and free blocks
2124  * ==========================================================================
2125  */
2126 static int
2127 zio_dva_allocate(zio_t *zio)
2128 {
2129         spa_t *spa = zio->io_spa;
2130         metaslab_class_t *mc = spa_normal_class(spa);
2131         blkptr_t *bp = zio->io_bp;
2132         int error;
2133         int flags = 0;
2134 
2135         if (zio->io_gang_leader == NULL) {
2136                 ASSERT(zio->io_child_type > ZIO_CHILD_GANG);
2137                 zio->io_gang_leader = zio;
2138         }
2139 
2140         ASSERT(BP_IS_HOLE(bp));
2141         ASSERT3U(BP_GET_NDVAS(bp), ==, 0);
2142         ASSERT3U(zio->io_prop.zp_copies, >, 0);
2143         ASSERT3U(zio->io_prop.zp_copies, <=, spa_max_replication(spa));
2144         ASSERT3U(zio->io_size, ==, BP_GET_PSIZE(bp));
2145 
2146         /*
2147          * The dump device does not support gang blocks so allocation on
2148          * behalf of the dump device (i.e. ZIO_FLAG_NODATA) must avoid
2149          * the "fast" gang feature.
2150          */
2151         flags |= (zio->io_flags & ZIO_FLAG_NODATA) ? METASLAB_GANG_AVOID : 0;
2152         flags |= (zio->io_flags & ZIO_FLAG_GANG_CHILD) ?
2153             METASLAB_GANG_CHILD : 0;
2154         error = metaslab_alloc(spa, mc, zio->io_size, bp,
2155             zio->io_prop.zp_copies, zio->io_txg, NULL, flags);
2156 
2157         if (error) {
2158                 spa_dbgmsg(spa, "%s: metaslab allocation failure: zio %p, "
2159                     "size %llu, error %d", spa_name(spa), zio, zio->io_size,
2160                     error);
2161                 if (error == ENOSPC && zio->io_size > SPA_MINBLOCKSIZE)




2121 /*
2122  * ==========================================================================
2123  * Allocate and free blocks
2124  * ==========================================================================
2125  */
2126 static int
2127 zio_dva_allocate(zio_t *zio)
2128 {
2129         spa_t *spa = zio->io_spa;
2130         metaslab_class_t *mc = spa_normal_class(spa);
2131         blkptr_t *bp = zio->io_bp;
2132         int error;
2133         int flags = 0;
2134 
2135         if (zio->io_gang_leader == NULL) {
2136                 ASSERT(zio->io_child_type > ZIO_CHILD_GANG);
2137                 zio->io_gang_leader = zio;
2138         }
2139 
2140         ASSERT(BP_IS_HOLE(bp));
2141         ASSERT0(BP_GET_NDVAS(bp));
2142         ASSERT3U(zio->io_prop.zp_copies, >, 0);
2143         ASSERT3U(zio->io_prop.zp_copies, <=, spa_max_replication(spa));
2144         ASSERT3U(zio->io_size, ==, BP_GET_PSIZE(bp));
2145 
2146         /*
2147          * The dump device does not support gang blocks so allocation on
2148          * behalf of the dump device (i.e. ZIO_FLAG_NODATA) must avoid
2149          * the "fast" gang feature.
2150          */
2151         flags |= (zio->io_flags & ZIO_FLAG_NODATA) ? METASLAB_GANG_AVOID : 0;
2152         flags |= (zio->io_flags & ZIO_FLAG_GANG_CHILD) ?
2153             METASLAB_GANG_CHILD : 0;
2154         error = metaslab_alloc(spa, mc, zio->io_size, bp,
2155             zio->io_prop.zp_copies, zio->io_txg, NULL, flags);
2156 
2157         if (error) {
2158                 spa_dbgmsg(spa, "%s: metaslab allocation failure: zio %p, "
2159                     "size %llu, error %d", spa_name(spa), zio, zio->io_size,
2160                     error);
2161                 if (error == ENOSPC && zio->io_size > SPA_MINBLOCKSIZE)