]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/abd.h
ztest: scrub ddt repair
[mirror_zfs.git] / include / sys / abd.h
index 6e3530aeca56b5f182499deeca2c2774c659af05..3d9fdbf102aa15149e244df59157108e3f6d52db 100644 (file)
@@ -27,7 +27,6 @@
 #define        _ABD_H
 
 #include <sys/isa_defs.h>
-#include <sys/int_types.h>
 #include <sys/debug.h>
 #include <sys/refcount.h>
 #ifdef _KERNEL
@@ -43,19 +42,21 @@ extern "C" {
 typedef enum abd_flags {
        ABD_FLAG_LINEAR = 1 << 0,       /* is buffer linear (or scattered)? */
        ABD_FLAG_OWNER  = 1 << 1,       /* does it own its data buffers? */
-       ABD_FLAG_META   = 1 << 2        /* does this represent FS metadata? */
+       ABD_FLAG_META   = 1 << 2,       /* does this represent FS metadata? */
+       ABD_FLAG_MULTI_ZONE  = 1 << 3,  /* pages split over memory zones */
+       ABD_FLAG_MULTI_CHUNK = 1 << 4   /* pages split over multiple chunks */
 } abd_flags_t;
 
 typedef struct abd {
        abd_flags_t     abd_flags;
        uint_t          abd_size;       /* excludes scattered abd_offset */
        struct abd      *abd_parent;
-       refcount_t      abd_children;
+       zfs_refcount_t  abd_children;
        union {
                struct abd_scatter {
                        uint_t          abd_offset;
-                       uint_t          abd_chunk_size;
-                       struct page     *abd_chunks[];
+                       uint_t          abd_nents;
+                       struct scatterlist *abd_sgl;
                } abd_scatter;
                struct abd_linear {
                        void            *abd_buf;
@@ -71,7 +72,7 @@ extern int zfs_abd_scatter_enabled;
 static inline boolean_t
 abd_is_linear(abd_t *abd)
 {
-       return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0);
+       return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0 ? B_TRUE : B_FALSE);
 }
 
 /*
@@ -84,6 +85,7 @@ abd_t *abd_alloc_for_io(size_t, boolean_t);
 abd_t *abd_alloc_sametype(abd_t *, size_t);
 void abd_free(abd_t *);
 abd_t *abd_get_offset(abd_t *, size_t);
+abd_t *abd_get_offset_size(abd_t *, size_t, size_t);
 abd_t *abd_get_from_buf(void *, size_t);
 void abd_put(abd_t *);
 
@@ -113,12 +115,21 @@ int abd_cmp(abd_t *, abd_t *);
 int abd_cmp_buf_off(abd_t *, const void *, size_t, size_t);
 void abd_zero_off(abd_t *, size_t, size_t);
 
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
 unsigned int abd_scatter_bio_map_off(struct bio *, abd_t *, unsigned int,
                size_t);
 unsigned long abd_nr_pages_off(abd_t *, unsigned int, size_t);
 #endif
 
+void abd_raidz_gen_iterate(abd_t **cabds, abd_t *dabd,
+       ssize_t csize, ssize_t dsize, const unsigned parity,
+       void (*func_raidz_gen)(void **, const void *, size_t, size_t));
+void abd_raidz_rec_iterate(abd_t **cabds, abd_t **tabds,
+       ssize_t tsize, const unsigned parity,
+       void (*func_raidz_rec)(void **t, const size_t tsize, void **c,
+       const unsigned *mul),
+       const unsigned *mul);
+
 /*
  * Wrappers for calls with offsets of 0
  */
@@ -130,7 +141,7 @@ abd_copy(abd_t *dabd, abd_t *sabd, size_t size)
 }
 
 static inline void
-abd_copy_from_buf(abd_t *abd, void *buf, size_t size)
+abd_copy_from_buf(abd_t *abd, const void *buf, size_t size)
 {
        abd_copy_from_buf_off(abd, buf, 0, size);
 }
@@ -142,7 +153,7 @@ abd_copy_to_buf(void* buf, abd_t *abd, size_t size)
 }
 
 static inline int
-abd_cmp_buf(abd_t *abd, void *buf, size_t size)
+abd_cmp_buf(abd_t *abd, const void *buf, size_t size)
 {
        return (abd_cmp_buf_off(abd, buf, 0, size));
 }