Add linux compatibility
[zfs.git] / module / zfs / include / sys / dmu_tx.h
index 2727daa..c5ea50f 100644 (file)
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 #ifndef        _SYS_DMU_TX_H
 #define        _SYS_DMU_TX_H
 
-#pragma ident  "%Z%%M% %I%     %E% SMI"
-
 #include <sys/inttypes.h>
 #include <sys/dmu.h>
 #include <sys/txg.h>
@@ -59,6 +57,7 @@ struct dmu_tx {
        txg_handle_t tx_txgh;
        void *tx_tempreserve_cookie;
        struct dmu_tx_hold *tx_needassign_txh;
+       list_t tx_callbacks; /* list of dmu_tx_callback_t on this dmu_tx */
        uint8_t tx_anyobj;
        int tx_err;
 #ifdef ZFS_DEBUG
@@ -78,6 +77,7 @@ enum dmu_tx_hold_type {
        THT_FREE,
        THT_ZAP,
        THT_SPACE,
+       THT_SPILL,
        THT_NUMTYPES
 };
 
@@ -98,6 +98,11 @@ typedef struct dmu_tx_hold {
 #endif
 } dmu_tx_hold_t;
 
+typedef struct dmu_tx_callback {
+       list_node_t             dcb_node;    /* linked to tx_callbacks list */
+       dmu_tx_callback_func_t  *dcb_func;   /* caller function pointer */
+       void                    *dcb_data;   /* caller private data */
+} dmu_tx_callback_t;
 
 /*
  * These routines are defined in dmu.h, and are called by the user.
@@ -109,6 +114,10 @@ void dmu_tx_abort(dmu_tx_t *tx);
 uint64_t dmu_tx_get_txg(dmu_tx_t *tx);
 void dmu_tx_wait(dmu_tx_t *tx);
 
+void dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *dcb_func,
+    void *dcb_data);
+void dmu_tx_do_callbacks(list_t *cb_list, int error);
+
 /*
  * These routines are defined in dmu_spa.h, and are called by the SPA.
  */