]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - include/sys/zio.h
Imported Upstream version 0.6.4.2
[mirror_zfs-debian.git] / include / sys / zio.h
index d4350badc10087e845212d6ae5293c457add6089..18e7a40a308085f60ebb70d2c62c38bce1949a2e 100644 (file)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  */
 
@@ -82,6 +82,12 @@ enum zio_checksum {
        ZIO_CHECKSUM_FUNCTIONS
 };
 
+/*
+ * The number of "legacy" compression functions which can be set on individual
+ * objects.
+ */
+#define        ZIO_CHECKSUM_LEGACY_FUNCTIONS ZIO_CHECKSUM_ZILOG2
+
 #define        ZIO_CHECKSUM_ON_VALUE   ZIO_CHECKSUM_FLETCHER_4
 #define        ZIO_CHECKSUM_DEFAULT    ZIO_CHECKSUM_ON
 
@@ -111,6 +117,12 @@ enum zio_compress {
        ZIO_COMPRESS_FUNCTIONS
 };
 
+/*
+ * The number of "legacy" compression functions which can be set on individual
+ * objects.
+ */
+#define        ZIO_COMPRESS_LEGACY_FUNCTIONS ZIO_COMPRESS_LZ4
+
 #define        ZIO_COMPRESS_ON_VALUE   ZIO_COMPRESS_LZJB
 #define        ZIO_COMPRESS_DEFAULT    ZIO_COMPRESS_OFF
 
@@ -155,19 +167,20 @@ enum zio_flag {
        ZIO_FLAG_RESILVER       = 1 << 3,
        ZIO_FLAG_SCRUB          = 1 << 4,
        ZIO_FLAG_SCAN_THREAD    = 1 << 5,
+       ZIO_FLAG_PHYSICAL       = 1 << 6,
 
 #define        ZIO_FLAG_AGG_INHERIT    (ZIO_FLAG_CANFAIL - 1)
 
        /*
         * Flags inherited by ddt, gang, and vdev children.
         */
-       ZIO_FLAG_CANFAIL        = 1 << 6,       /* must be first for INHERIT */
-       ZIO_FLAG_SPECULATIVE    = 1 << 7,
-       ZIO_FLAG_CONFIG_WRITER  = 1 << 8,
-       ZIO_FLAG_DONT_RETRY     = 1 << 9,
-       ZIO_FLAG_DONT_CACHE     = 1 << 10,
-       ZIO_FLAG_NODATA         = 1 << 11,
-       ZIO_FLAG_INDUCE_DAMAGE  = 1 << 12,
+       ZIO_FLAG_CANFAIL        = 1 << 7,       /* must be first for INHERIT */
+       ZIO_FLAG_SPECULATIVE    = 1 << 8,
+       ZIO_FLAG_CONFIG_WRITER  = 1 << 9,
+       ZIO_FLAG_DONT_RETRY     = 1 << 10,
+       ZIO_FLAG_DONT_CACHE     = 1 << 11,
+       ZIO_FLAG_NODATA         = 1 << 12,
+       ZIO_FLAG_INDUCE_DAMAGE  = 1 << 13,
 
 #define        ZIO_FLAG_DDT_INHERIT    (ZIO_FLAG_IO_RETRY - 1)
 #define        ZIO_FLAG_GANG_INHERIT   (ZIO_FLAG_IO_RETRY - 1)
@@ -175,28 +188,28 @@ enum zio_flag {
        /*
         * Flags inherited by vdev children.
         */
-       ZIO_FLAG_IO_RETRY       = 1 << 13,      /* must be first for INHERIT */
-       ZIO_FLAG_PROBE          = 1 << 14,
-       ZIO_FLAG_TRYHARD        = 1 << 15,
-       ZIO_FLAG_OPTIONAL       = 1 << 16,
+       ZIO_FLAG_IO_RETRY       = 1 << 14,      /* must be first for INHERIT */
+       ZIO_FLAG_PROBE          = 1 << 15,
+       ZIO_FLAG_TRYHARD        = 1 << 16,
+       ZIO_FLAG_OPTIONAL       = 1 << 17,
 
 #define        ZIO_FLAG_VDEV_INHERIT   (ZIO_FLAG_DONT_QUEUE - 1)
 
        /*
         * Flags not inherited by any children.
         */
-       ZIO_FLAG_DONT_QUEUE     = 1 << 17,      /* must be first for INHERIT */
-       ZIO_FLAG_DONT_PROPAGATE = 1 << 18,
-       ZIO_FLAG_IO_BYPASS      = 1 << 19,
-       ZIO_FLAG_IO_REWRITE     = 1 << 20,
-       ZIO_FLAG_RAW            = 1 << 21,
-       ZIO_FLAG_GANG_CHILD     = 1 << 22,
-       ZIO_FLAG_DDT_CHILD      = 1 << 23,
-       ZIO_FLAG_GODFATHER      = 1 << 24,
-       ZIO_FLAG_NOPWRITE       = 1 << 25,
-       ZIO_FLAG_REEXECUTED     = 1 << 26,
-       ZIO_FLAG_DELEGATED      = 1 << 27,
-       ZIO_FLAG_FASTWRITE      = 1 << 28
+       ZIO_FLAG_DONT_QUEUE     = 1 << 18,      /* must be first for INHERIT */
+       ZIO_FLAG_DONT_PROPAGATE = 1 << 19,
+       ZIO_FLAG_IO_BYPASS      = 1 << 20,
+       ZIO_FLAG_IO_REWRITE     = 1 << 21,
+       ZIO_FLAG_RAW            = 1 << 22,
+       ZIO_FLAG_GANG_CHILD     = 1 << 23,
+       ZIO_FLAG_DDT_CHILD      = 1 << 24,
+       ZIO_FLAG_GODFATHER      = 1 << 25,
+       ZIO_FLAG_NOPWRITE       = 1 << 26,
+       ZIO_FLAG_REEXECUTED     = 1 << 27,
+       ZIO_FLAG_DELEGATED      = 1 << 28,
+       ZIO_FLAG_FASTWRITE      = 1 << 29,
 };
 
 #define        ZIO_FLAG_MUSTSUCCEED            0
@@ -251,16 +264,15 @@ extern const char *zio_type_name[ZIO_TYPES];
  * Note: this structure is called a bookmark because its original purpose
  * was to remember where to resume a pool-wide traverse.
  *
- * Note: this structure is passed between userland and the kernel.
- * Therefore it must not change size or alignment between 32/64 bit
- * compilation options.
+ * Note: this structure is passed between userland and the kernel, and is
+ * stored on disk (by virtue of being incorporated into other on-disk
+ * structures, e.g. dsl_scan_phys_t).
  */
-struct zbookmark {
+struct zbookmark_phys {
        uint64_t        zb_objset;
        uint64_t        zb_object;
        int64_t         zb_level;
        uint64_t        zb_blkid;
-       char *          zb_func;
 };
 
 #define        SET_BOOKMARK(zb, objset, object, level, blkid)  \
@@ -269,7 +281,6 @@ struct zbookmark {
        (zb)->zb_object = object;                       \
        (zb)->zb_level = level;                         \
        (zb)->zb_blkid = blkid;                         \
-       (zb)->zb_func = FTAG;                           \
 }
 
 #define        ZB_DESTROYED_OBJSET     (-1ULL)
@@ -373,7 +384,7 @@ typedef struct zio_link {
 
 struct zio {
        /* Core information about this I/O */
-       zbookmark_t     io_bookmark;
+       zbookmark_phys_t        io_bookmark;
        zio_prop_t      io_prop;
        zio_type_t      io_type;
        enum zio_child  io_child_type;
@@ -454,17 +465,17 @@ extern zio_t *zio_root(spa_t *spa,
 
 extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data,
     uint64_t size, zio_done_func_t *done, void *private,
-    zio_priority_t priority, enum zio_flag flags, const zbookmark_t *zb);
+    zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb);
 
 extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
     void *data, uint64_t size, const zio_prop_t *zp,
     zio_done_func_t *ready, zio_done_func_t *physdone, zio_done_func_t *done,
     void *private,
-    zio_priority_t priority, enum zio_flag flags, const zbookmark_t *zb);
+    zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb);
 
 extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
     void *data, uint64_t size, zio_done_func_t *done, void *private,
-    zio_priority_t priority, enum zio_flag flags, zbookmark_t *zb);
+    zio_priority_t priority, enum zio_flag flags, zbookmark_phys_t *zb);
 
 extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies,
     boolean_t nopwrite);
@@ -511,8 +522,6 @@ extern void *zio_buf_alloc(size_t size);
 extern void zio_buf_free(void *buf, size_t size);
 extern void *zio_data_buf_alloc(size_t size);
 extern void zio_data_buf_free(void *buf, size_t size);
-extern void *zio_vdev_alloc(void);
-extern void zio_vdev_free(void *buf);
 
 extern void zio_resubmit_stage_async(void *);
 
@@ -585,9 +594,9 @@ extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd,
 /* Called from spa_sync(), but primarily an injection handler */
 extern void spa_handle_ignored_writes(spa_t *spa);
 
-/* zbookmark functions */
+/* zbookmark_phys functions */
 boolean_t zbookmark_is_before(const struct dnode_phys *dnp,
-    const zbookmark_t *zb1, const zbookmark_t *zb2);
+    const zbookmark_phys_t *zb1, const zbookmark_phys_t *zb2);
 
 #ifdef __cplusplus
 }