Print this page
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
        
@@ -617,11 +617,11 @@
 
         ASSERT(zp->zp_checksum >= ZIO_CHECKSUM_OFF &&
             zp->zp_checksum < ZIO_CHECKSUM_FUNCTIONS &&
             zp->zp_compress >= ZIO_COMPRESS_OFF &&
             zp->zp_compress < ZIO_COMPRESS_FUNCTIONS &&
-            zp->zp_type < DMU_OT_NUMTYPES &&
+            DMU_OT_IS_VALID(zp->zp_type) &&
             zp->zp_level < 32 &&
             zp->zp_copies > 0 &&
             zp->zp_copies <= spa_max_replication(spa) &&
             zp->zp_dedup <= 1 &&
             zp->zp_dedup_verify <= 1);
@@ -901,11 +901,11 @@
                 void *cbuf = zio_buf_alloc(psize);
 
                 zio_push_transform(zio, cbuf, psize, psize, zio_decompress);
         }
 
-        if (!dmu_ot[BP_GET_TYPE(bp)].ot_metadata && BP_GET_LEVEL(bp) == 0)
+        if (!DMU_OT_IS_METADATA(BP_GET_TYPE(bp)) && BP_GET_LEVEL(bp) == 0)
                 zio->io_flags |= ZIO_FLAG_DONT_CACHE;
 
         if (BP_GET_TYPE(bp) == DMU_OT_DDT_ZAP)
                 zio->io_flags |= ZIO_FLAG_DONT_CACHE;
 
@@ -2987,5 +2987,47 @@
         zio_vdev_io_done,
         zio_vdev_io_assess,
         zio_checksum_verify,
         zio_done
 };
+
+/* dnp is the dnode for zb1->zb_object */
+boolean_t
+zbookmark_is_before(const dnode_phys_t *dnp, const zbookmark_t *zb1,
+    const zbookmark_t *zb2)
+{
+        uint64_t zb1nextL0, zb2thisobj;
+
+        ASSERT(zb1->zb_objset == zb2->zb_objset);
+        ASSERT(zb2->zb_level == 0);
+
+        /*
+         * A bookmark in the deadlist is considered to be after
+         * everything else.
+         */
+        if (zb2->zb_object == DMU_DEADLIST_OBJECT)
+                return (B_TRUE);
+
+        /* The objset_phys_t isn't before anything. */
+        if (dnp == NULL)
+                return (B_FALSE);
+
+        zb1nextL0 = (zb1->zb_blkid + 1) <<
+            ((zb1->zb_level) * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT));
+
+        zb2thisobj = zb2->zb_object ? zb2->zb_object :
+            zb2->zb_blkid << (DNODE_BLOCK_SHIFT - DNODE_SHIFT);
+
+        if (zb1->zb_object == DMU_META_DNODE_OBJECT) {
+                uint64_t nextobj = zb1nextL0 *
+                    (dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT) >> DNODE_SHIFT;
+                return (nextobj <= zb2thisobj);
+        }
+
+        if (zb1->zb_object < zb2thisobj)
+                return (B_TRUE);
+        if (zb1->zb_object > zb2thisobj)
+                return (B_FALSE);
+        if (zb2->zb_object == DMU_META_DNODE_OBJECT)
+                return (B_FALSE);
+        return (zb1nextL0 <= zb2->zb_blkid);
+}