Print this page
3748 zfs headers should be C++ compatible
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Will Andrews <willa@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>
Reviewed by:    Robert Mustacchi <rm@joyent.com>


 152 typedef struct ddt_ops {
 153         char ddt_op_name[32];
 154         int (*ddt_op_create)(objset_t *os, uint64_t *object, dmu_tx_t *tx,
 155             boolean_t prehash);
 156         int (*ddt_op_destroy)(objset_t *os, uint64_t object, dmu_tx_t *tx);
 157         int (*ddt_op_lookup)(objset_t *os, uint64_t object, ddt_entry_t *dde);
 158         void (*ddt_op_prefetch)(objset_t *os, uint64_t object,
 159             ddt_entry_t *dde);
 160         int (*ddt_op_update)(objset_t *os, uint64_t object, ddt_entry_t *dde,
 161             dmu_tx_t *tx);
 162         int (*ddt_op_remove)(objset_t *os, uint64_t object, ddt_entry_t *dde,
 163             dmu_tx_t *tx);
 164         int (*ddt_op_walk)(objset_t *os, uint64_t object, ddt_entry_t *dde,
 165             uint64_t *walk);
 166         uint64_t (*ddt_op_count)(objset_t *os, uint64_t object);
 167 } ddt_ops_t;
 168 
 169 #define DDT_NAMELEN     80
 170 
 171 extern void ddt_object_name(ddt_t *ddt, enum ddt_type type,
 172     enum ddt_class class, char *name);
 173 extern int ddt_object_walk(ddt_t *ddt, enum ddt_type type,
 174     enum ddt_class class, uint64_t *walk, ddt_entry_t *dde);
 175 extern uint64_t ddt_object_count(ddt_t *ddt, enum ddt_type type,
 176     enum ddt_class class);
 177 extern int ddt_object_info(ddt_t *ddt, enum ddt_type type,
 178     enum ddt_class class, dmu_object_info_t *);
 179 extern boolean_t ddt_object_exists(ddt_t *ddt, enum ddt_type type,
 180     enum ddt_class class);
 181 
 182 extern void ddt_bp_fill(const ddt_phys_t *ddp, blkptr_t *bp,
 183     uint64_t txg);
 184 extern void ddt_bp_create(enum zio_checksum checksum, const ddt_key_t *ddk,
 185     const ddt_phys_t *ddp, blkptr_t *bp);
 186 
 187 extern void ddt_key_fill(ddt_key_t *ddk, const blkptr_t *bp);
 188 
 189 extern void ddt_phys_fill(ddt_phys_t *ddp, const blkptr_t *bp);
 190 extern void ddt_phys_clear(ddt_phys_t *ddp);
 191 extern void ddt_phys_addref(ddt_phys_t *ddp);
 192 extern void ddt_phys_decref(ddt_phys_t *ddp);
 193 extern void ddt_phys_free(ddt_t *ddt, ddt_key_t *ddk, ddt_phys_t *ddp,
 194     uint64_t txg);
 195 extern ddt_phys_t *ddt_phys_select(const ddt_entry_t *dde, const blkptr_t *bp);
 196 extern uint64_t ddt_phys_total_refcnt(const ddt_entry_t *dde);
 197 
 198 extern void ddt_stat_add(ddt_stat_t *dst, const ddt_stat_t *src, uint64_t neg);
 199 
 200 extern void ddt_histogram_add(ddt_histogram_t *dst, const ddt_histogram_t *src);


 218 extern void ddt_enter(ddt_t *ddt);
 219 extern void ddt_exit(ddt_t *ddt);
 220 extern ddt_entry_t *ddt_lookup(ddt_t *ddt, const blkptr_t *bp, boolean_t add);
 221 extern void ddt_prefetch(spa_t *spa, const blkptr_t *bp);
 222 extern void ddt_remove(ddt_t *ddt, ddt_entry_t *dde);
 223 
 224 extern boolean_t ddt_class_contains(spa_t *spa, enum ddt_class max_class,
 225     const blkptr_t *bp);
 226 
 227 extern ddt_entry_t *ddt_repair_start(ddt_t *ddt, const blkptr_t *bp);
 228 extern void ddt_repair_done(ddt_t *ddt, ddt_entry_t *dde);
 229 
 230 extern int ddt_entry_compare(const void *x1, const void *x2);
 231 
 232 extern void ddt_create(spa_t *spa);
 233 extern int ddt_load(spa_t *spa);
 234 extern void ddt_unload(spa_t *spa);
 235 extern void ddt_sync(spa_t *spa, uint64_t txg);
 236 extern int ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde);
 237 extern int ddt_object_update(ddt_t *ddt, enum ddt_type type,
 238     enum ddt_class class, ddt_entry_t *dde, dmu_tx_t *tx);
 239 
 240 extern const ddt_ops_t ddt_zap_ops;
 241 
 242 #ifdef  __cplusplus
 243 }
 244 #endif
 245 
 246 #endif  /* _SYS_DDT_H */


 152 typedef struct ddt_ops {
 153         char ddt_op_name[32];
 154         int (*ddt_op_create)(objset_t *os, uint64_t *object, dmu_tx_t *tx,
 155             boolean_t prehash);
 156         int (*ddt_op_destroy)(objset_t *os, uint64_t object, dmu_tx_t *tx);
 157         int (*ddt_op_lookup)(objset_t *os, uint64_t object, ddt_entry_t *dde);
 158         void (*ddt_op_prefetch)(objset_t *os, uint64_t object,
 159             ddt_entry_t *dde);
 160         int (*ddt_op_update)(objset_t *os, uint64_t object, ddt_entry_t *dde,
 161             dmu_tx_t *tx);
 162         int (*ddt_op_remove)(objset_t *os, uint64_t object, ddt_entry_t *dde,
 163             dmu_tx_t *tx);
 164         int (*ddt_op_walk)(objset_t *os, uint64_t object, ddt_entry_t *dde,
 165             uint64_t *walk);
 166         uint64_t (*ddt_op_count)(objset_t *os, uint64_t object);
 167 } ddt_ops_t;
 168 
 169 #define DDT_NAMELEN     80
 170 
 171 extern void ddt_object_name(ddt_t *ddt, enum ddt_type type,
 172     enum ddt_class ddt_class, char *name);
 173 extern int ddt_object_walk(ddt_t *ddt, enum ddt_type type,
 174     enum ddt_class ddt_class, uint64_t *walk, ddt_entry_t *dde);
 175 extern uint64_t ddt_object_count(ddt_t *ddt, enum ddt_type type,
 176     enum ddt_class ddt_class);
 177 extern int ddt_object_info(ddt_t *ddt, enum ddt_type type,
 178     enum ddt_class ddt_class, dmu_object_info_t *);
 179 extern boolean_t ddt_object_exists(ddt_t *ddt, enum ddt_type type,
 180     enum ddt_class ddt_class);
 181 
 182 extern void ddt_bp_fill(const ddt_phys_t *ddp, blkptr_t *bp,
 183     uint64_t txg);
 184 extern void ddt_bp_create(enum zio_checksum checksum, const ddt_key_t *ddk,
 185     const ddt_phys_t *ddp, blkptr_t *bp);
 186 
 187 extern void ddt_key_fill(ddt_key_t *ddk, const blkptr_t *bp);
 188 
 189 extern void ddt_phys_fill(ddt_phys_t *ddp, const blkptr_t *bp);
 190 extern void ddt_phys_clear(ddt_phys_t *ddp);
 191 extern void ddt_phys_addref(ddt_phys_t *ddp);
 192 extern void ddt_phys_decref(ddt_phys_t *ddp);
 193 extern void ddt_phys_free(ddt_t *ddt, ddt_key_t *ddk, ddt_phys_t *ddp,
 194     uint64_t txg);
 195 extern ddt_phys_t *ddt_phys_select(const ddt_entry_t *dde, const blkptr_t *bp);
 196 extern uint64_t ddt_phys_total_refcnt(const ddt_entry_t *dde);
 197 
 198 extern void ddt_stat_add(ddt_stat_t *dst, const ddt_stat_t *src, uint64_t neg);
 199 
 200 extern void ddt_histogram_add(ddt_histogram_t *dst, const ddt_histogram_t *src);


 218 extern void ddt_enter(ddt_t *ddt);
 219 extern void ddt_exit(ddt_t *ddt);
 220 extern ddt_entry_t *ddt_lookup(ddt_t *ddt, const blkptr_t *bp, boolean_t add);
 221 extern void ddt_prefetch(spa_t *spa, const blkptr_t *bp);
 222 extern void ddt_remove(ddt_t *ddt, ddt_entry_t *dde);
 223 
 224 extern boolean_t ddt_class_contains(spa_t *spa, enum ddt_class max_class,
 225     const blkptr_t *bp);
 226 
 227 extern ddt_entry_t *ddt_repair_start(ddt_t *ddt, const blkptr_t *bp);
 228 extern void ddt_repair_done(ddt_t *ddt, ddt_entry_t *dde);
 229 
 230 extern int ddt_entry_compare(const void *x1, const void *x2);
 231 
 232 extern void ddt_create(spa_t *spa);
 233 extern int ddt_load(spa_t *spa);
 234 extern void ddt_unload(spa_t *spa);
 235 extern void ddt_sync(spa_t *spa, uint64_t txg);
 236 extern int ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde);
 237 extern int ddt_object_update(ddt_t *ddt, enum ddt_type type,
 238     enum ddt_class ddt_class, ddt_entry_t *dde, dmu_tx_t *tx);
 239 
 240 extern const ddt_ops_t ddt_zap_ops;
 241 
 242 #ifdef  __cplusplus
 243 }
 244 #endif
 245 
 246 #endif  /* _SYS_DDT_H */