txg.c revision fa9e4066f08beec538e775443c5be79dd423fcab
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/zfs_context.h>
#include <sys/txg_impl.h>
#include <sys/dmu_impl.h>
#include <sys/dsl_pool.h>
/*
* Pool-wide transaction groups.
*/
/*
* Prepare the txg subsystem.
*/
void
{
}
/*
* Close down the txg subsystem.
*/
void
{
}
/*
* Start syncing transaction groups.
*/
void
{
}
static void
{
}
static void
{
tx->tx_threads--;
thread_exit();
}
static void
{
if (secmax)
else
}
/*
* Stop syncing transaction groups.
*/
void
{
/*
* Finish off any work in progress.
*/
txg_wait_synced(dp, 0);
/*
* Wake all 3 sync threads (one per state) and wait for them to die.
*/
while (tx->tx_threads != 0)
tx->tx_exiting = 0;
}
{
return (txg);
}
void
{
}
void
{
}
static void
{
int c;
/*
* Grab all tx_cpu locks so nobody else can get into this txg.
*/
for (c = 0; c < max_ncpus; c++)
tx->tx_open_txg++;
/*
* Now that we've incremented tx_open_txg, we can let threads
* enter the next transaction group.
*/
for (c = 0; c < max_ncpus; c++)
/*
* Quiesce the transaction group by waiting for everyone to txg_exit().
*/
for (c = 0; c < max_ncpus; c++) {
}
}
static void
{
for (;;) {
/*
* We sync when there's someone waiting on us, or the
* quiesce thread has handed off a txg to us.
*/
while (!tx->tx_exiting &&
tx->tx_quiesced_txg == 0) {
dprintf("waiting; tx_synced=%llu waiting=%llu dp=%p\n",
}
/*
* Wait until the quiesce thread hands off a txg to us,
* prompting it to do so if necessary.
*/
}
if (tx->tx_exiting)
/*
* Consume the quiesced txg which has been handed off to
* us. This may cause the quiescing thread to now be
* able to quiesce another txg, so we must signal it.
*/
tx->tx_quiesced_txg = 0;
dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
tx->tx_syncing_txg = 0;
}
}
static void
{
for (;;) {
/*
* We quiesce when there's someone waiting on us.
* However, we can only have one txg in "quiescing" or
* "quiesced, waiting to sync" state. So we wait until
* the "quiesced, waiting to sync" txg has been consumed
* by the sync thread.
*/
while (!tx->tx_exiting &&
tx->tx_quiesced_txg != 0))
if (tx->tx_exiting)
dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
/*
* Hand this txg off to the sync thread.
*/
}
}
void
{
if (txg == 0)
dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
dprintf("broadcasting sync more "
"tx_synced=%llu waiting=%llu dp=%p\n",
}
}
void
{
if (txg == 0)
dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
}
}
static void
{
while (!tx->tx_exiting) {
}
}
}
int
{
}
void
{
/* XXX some code paths suspend when they are already suspended! */
}
void
{
}
/*
* Per-txg object lists.
*/
void
{
int t;
for (t = 0; t < TXG_SIZE; t++)
}
void
{
int t;
for (t = 0; t < TXG_SIZE; t++)
}
int
{
}
/*
* Add an entry to the list.
* Returns 0 if it's a new entry, 1 if it's already there.
*/
int
{
int already_on_list;
if (!already_on_list) {
}
return (already_on_list);
}
/*
* Remove the head of the list and return it.
*/
void *
{
txg_node_t *tn;
void *p = NULL;
}
return (p);
}
/*
* Remove a specific item from the list and return it.
*/
void *
{
return (p);
}
}
return (NULL);
}
int
{
}
/*
* Walk a txg list -- only safe if you know it's not changing.
*/
void *
{
}
void *
{
}