1789Sahrens /* 2789Sahrens * CDDL HEADER START 3789Sahrens * 4789Sahrens * The contents of this file are subject to the terms of the 56245Smaybee * Common Development and Distribution License (the "License"). 66245Smaybee * You may not use this file except in compliance with the License. 7789Sahrens * 8789Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9789Sahrens * or http://www.opensolaris.org/os/licensing. 10789Sahrens * See the License for the specific language governing permissions 11789Sahrens * and limitations under the License. 12789Sahrens * 13789Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14789Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15789Sahrens * If applicable, add the following below this CDDL HEADER, with the 16789Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17789Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18789Sahrens * 19789Sahrens * CDDL HEADER END 20789Sahrens */ 21789Sahrens /* 22*10612SRicardo.M.Correia@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23789Sahrens * Use is subject to license terms. 24789Sahrens */ 25789Sahrens 26789Sahrens #ifndef _SYS_TXG_IMPL_H 27789Sahrens #define _SYS_TXG_IMPL_H 28789Sahrens 29789Sahrens #include <sys/spa.h> 30789Sahrens #include <sys/txg.h> 31789Sahrens 32789Sahrens #ifdef __cplusplus 33789Sahrens extern "C" { 34789Sahrens #endif 35789Sahrens 36789Sahrens struct tx_cpu { 37789Sahrens kmutex_t tc_lock; 38789Sahrens kcondvar_t tc_cv[TXG_SIZE]; 39789Sahrens uint64_t tc_count[TXG_SIZE]; 40*10612SRicardo.M.Correia@Sun.COM list_t tc_callbacks[TXG_SIZE]; /* commit cb list */ 41789Sahrens char tc_pad[16]; 42789Sahrens }; 43789Sahrens 44789Sahrens typedef struct tx_state { 45789Sahrens tx_cpu_t *tx_cpu; /* protects right to enter txg */ 46789Sahrens kmutex_t tx_sync_lock; /* protects tx_state_t */ 47789Sahrens uint64_t tx_open_txg; /* currently open txg id */ 48789Sahrens uint64_t tx_quiesced_txg; /* quiesced txg waiting for sync */ 49789Sahrens uint64_t tx_syncing_txg; /* currently syncing txg id */ 50789Sahrens uint64_t tx_synced_txg; /* last synced txg id */ 51789Sahrens 52789Sahrens uint64_t tx_sync_txg_waiting; /* txg we're waiting to sync */ 53789Sahrens uint64_t tx_quiesce_txg_waiting; /* txg we're waiting to open */ 54789Sahrens 55789Sahrens kcondvar_t tx_sync_more_cv; 56789Sahrens kcondvar_t tx_sync_done_cv; 57789Sahrens kcondvar_t tx_quiesce_more_cv; 58789Sahrens kcondvar_t tx_quiesce_done_cv; 596245Smaybee kcondvar_t tx_timeout_cv; 60789Sahrens kcondvar_t tx_exit_cv; /* wait for all threads to exit */ 61789Sahrens 62789Sahrens uint8_t tx_threads; /* number of threads */ 63789Sahrens uint8_t tx_exiting; /* set when we're exiting */ 64789Sahrens 65789Sahrens kthread_t *tx_sync_thread; 66789Sahrens kthread_t *tx_quiesce_thread; 67*10612SRicardo.M.Correia@Sun.COM 68*10612SRicardo.M.Correia@Sun.COM taskq_t *tx_commit_cb_taskq; /* commit callback taskq */ 69789Sahrens } tx_state_t; 70789Sahrens 71789Sahrens #ifdef __cplusplus 72789Sahrens } 73789Sahrens #endif 74789Sahrens 75789Sahrens #endif /* _SYS_TXG_IMPL_H */ 76