txg.c revision 8f38d41910063e19709864b025684a228961299f
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 0N/A * Use is subject to license terms. 1879N/A#
pragma ident "%Z%%M% %I% %E% SMI" 0N/A * Pool-wide transaction groups. 0N/Aint txg_time =
5;
/* max 5 seconds worth of delta per txg */ 0N/A * Prepare the txg subsystem. 0N/A * Close down the txg subsystem. 0N/A * Start syncing transaction groups. 0N/A * Stop syncing transaction groups. 0N/A * Finish off any work in progress. 0N/A * Wake all 3 sync threads (one per state) and wait for them to die. 0N/A * Grab all tx_cpu locks so nobody else can get into this txg. 0N/A * Now that we've incremented tx_open_txg, we can let threads 0N/A * enter the next transaction group. 0N/A * Quiesce the transaction group by waiting for everyone to txg_exit(). 0N/A * We sync when there's someone waiting on us, or the 0N/A * quiesce thread has handed off a txg to us. 0N/A dprintf(
"waiting; tx_synced=%llu waiting=%llu dp=%p\n",
0N/A * Wait until the quiesce thread hands off a txg to us, 0N/A * prompting it to do so if necessary. 0N/A * Consume the quiesced txg which has been handed off to 0N/A * us. This may cause the quiescing thread to now be 0N/A * able to quiesce another txg, so we must signal it. 0N/A dprintf(
"txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
0N/A * We quiesce when there's someone waiting on us. 0N/A * However, we can only have one txg in "quiescing" or 0N/A * "quiesced, waiting to sync" state. So we wait until 0N/A * the "quiesced, waiting to sync" txg has been consumed 0N/A * by the sync thread. 0N/A dprintf(
"txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
0N/A * Hand this txg off to the sync thread. dprintf(
"txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
"tx_synced=%llu waiting=%llu dp=%p\n",
dprintf(
"txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
/* XXX some code paths suspend when they are already suspended! */ * Add an entry to the list. * Returns 0 if it's a new entry, 1 if it's already there. * Remove the head of the list and return it. * Remove a specific item from the list and return it. * Walk a txg list -- only safe if you know it's not changing.