]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/txg.h
ztest: scrub ddt repair
[mirror_zfs.git] / include / sys / txg.h
index f9d6dd421810cfd57fc8dc8e9f16597ede588bef..ed0e7297c2415f18c73a2852dee56f5487c2e65a 100644 (file)
@@ -23,7 +23,7 @@
  * Use is subject to license terms.
  */
 /*
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  */
 
 #ifndef _SYS_TXG_H
@@ -45,9 +45,6 @@ extern "C" {
 /* Number of txgs worth of frees we defer adding to in-core spacemaps */
 #define        TXG_DEFER_SIZE          2
 
-#define        TXG_WAIT                1ULL
-#define        TXG_NOWAIT              2ULL
-
 typedef struct tx_cpu tx_cpu_t;
 
 typedef struct txg_handle {
@@ -63,6 +60,7 @@ typedef struct txg_node {
 typedef struct txg_list {
        kmutex_t        tl_lock;
        size_t          tl_offset;
+       spa_t           *tl_spa;
        txg_node_t      *tl_head[TXG_SIZE];
 } txg_list_t;
 
@@ -77,13 +75,9 @@ extern void txg_rele_to_quiesce(txg_handle_t *txghp);
 extern void txg_rele_to_sync(txg_handle_t *txghp);
 extern void txg_register_callbacks(txg_handle_t *txghp, list_t *tx_callbacks);
 
-/*
- * Delay the caller by the specified number of ticks or until
- * the txg closes (whichever comes first).  This is intended
- * to be used to throttle writers when the system nears its
- * capacity.
- */
-extern void txg_delay(struct dsl_pool *dp, uint64_t txg, int ticks);
+extern void txg_delay(struct dsl_pool *dp, uint64_t txg, hrtime_t delta,
+    hrtime_t resolution);
+extern void txg_kick(struct dsl_pool *dp);
 
 /*
  * Wait until the given transaction group has finished syncing.
@@ -110,6 +104,8 @@ extern boolean_t txg_stalled(struct dsl_pool *dp);
 /* returns TRUE if someone is waiting for the next txg to sync */
 extern boolean_t txg_sync_waiting(struct dsl_pool *dp);
 
+extern void txg_verify(spa_t *spa, uint64_t txg);
+
 /*
  * Wait for pending commit callbacks of already-synced transactions to finish
  * processing.
@@ -122,20 +118,28 @@ extern void txg_wait_callbacks(struct dsl_pool *dp);
 
 #define        TXG_CLEAN(txg)  ((txg) - 1)
 
-extern void txg_list_create(txg_list_t *tl, size_t offset);
+extern void txg_list_create(txg_list_t *tl, spa_t *spa, size_t offset);
 extern void txg_list_destroy(txg_list_t *tl);
 extern boolean_t txg_list_empty(txg_list_t *tl, uint64_t txg);
-extern int txg_list_add(txg_list_t *tl, void *p, uint64_t txg);
-extern int txg_list_add_tail(txg_list_t *tl, void *p, uint64_t txg);
+extern boolean_t txg_all_lists_empty(txg_list_t *tl);
+extern boolean_t txg_list_add(txg_list_t *tl, void *p, uint64_t txg);
+extern boolean_t txg_list_add_tail(txg_list_t *tl, void *p, uint64_t txg);
 extern void *txg_list_remove(txg_list_t *tl, uint64_t txg);
 extern void *txg_list_remove_this(txg_list_t *tl, void *p, uint64_t txg);
-extern int txg_list_member(txg_list_t *tl, void *p, uint64_t txg);
+extern boolean_t txg_list_member(txg_list_t *tl, void *p, uint64_t txg);
 extern void *txg_list_head(txg_list_t *tl, uint64_t txg);
 extern void *txg_list_next(txg_list_t *tl, void *p, uint64_t txg);
 
 /* Global tuning */
 extern int zfs_txg_timeout;
 
+
+#ifdef ZFS_DEBUG
+#define        TXG_VERIFY(spa, txg)            txg_verify(spa, txg)
+#else
+#define        TXG_VERIFY(spa, txg)
+#endif
+
 #ifdef __cplusplus
 }
 #endif