dnode_sync.c revision f676ed3419ae468da6c6831c143b0b54173e08d2
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 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/dmu_objset.h>
#include <sys/dsl_dataset.h>
static void
{
int i;
/* this dnode can't be paged out because it's dirty */
break;
/* copy dnode's block pointers to new indirect block */
}
dprintf("os=%p obj=%llu, increase to %d\n",
/* set dbuf's parent pointers to new indirect buf */
continue;
continue;
}
"changing db_blkptr to new indirect %s", "");
} else {
}
"changed db_blkptr to new indirect %s", "");
}
}
}
static void
{
uint64_t bytesfreed = 0;
int i;
if (BP_IS_HOLE(bp))
continue;
}
}
#ifdef ZFS_DEBUG
static void
{
int j;
continue;
/* db_data_old better be zeroed */
if (buf[j] != 0) {
panic("freed data not zero: "
"child=%p i=%d off=%d num=%d\n",
}
}
}
/*
* db_data better be zeroed unless it's dirty in a
* future txg.
*/
if (buf[j] != 0) {
panic("freed data not zero: "
"child=%p i=%d off=%d num=%d\n",
}
}
}
}
}
#endif
static int
{
} else {
}
else if (all)
return (all);
}
if (BP_IS_HOLE(bp))
continue;
} else {
}
}
#ifdef ZFS_DEBUG
continue;
continue;
}
#endif
return (all);
}
/*
* free_range: Traverse the indicated range of the provided file
* and "free" all the blocks contained there.
*/
static void
{
return;
if (trunc)
/* There are no indirect blocks in the object */
if (dnlevel == 1) {
/* this range was never made persistent */
return;
}
if (trunc) {
}
return;
}
if (BP_IS_HOLE(bp))
continue;
}
}
if (trunc) {
}
}
/*
* Try to kick all the dnodes dbufs out of the cache...
*/
void
{
int progress;
int pass = 0;
do {
/* dbuf_clear() may remove db from this list */
} else {
}
}
/*
* NB: we need to drop dn_dbufs_mtx between passes so
* that any DB_EVICTING dbufs can make progress.
* Ideally, we would have some cv we could wait on, but
* since we don't, just wait a bit to give the other
* thread a chance to run.
*/
if (evicting)
delay(1);
pass++;
} while (progress);
/*
* This function works fine even if it can't evict everything,
* but all of our callers need this assertion, so let's put it
* here (for now). Perhaps in the future there will be a try vs
* doall flag.
*/
panic("dangling dbufs (dn=%p, dbuf=%p)\n",
}
}
}
static int
{
/* Undirty all buffers */
/* XXX - use dbuf_undirty()? */
}
}
/*
* XXX - It would be nice to assert this, but we may still
* have residual holds from async evictions from the arc...
*
* ASSERT3U(refcount_count(&dn->dn_holds), ==, 1);
*/
/* Undirty next bits */
/* free up all the blocks in the file. */
/* ASSERT(blkptrs are zero); */
dn->dn_maxblkid = 0;
dn->dn_allocated_txg = 0;
/*
* Now that we've released our hold, the dnode may
* be evicted, so we musn't access it.
*/
return (1);
}
/*
* Write out the dnode's dirty buffers at the specified level.
* This may create more dirty buffers at the next level up.
*
* NOTE: The dnode is kept in memory by being dirty. Once the
* dirty bit is cleared, it may be evicted. Beware of this!
*/
int
{
/*
* Make sure the dbuf for the dn_phys is released before we modify it.
*/
/* The dnode is newly allocated or reallocated */
/* this is a first alloc, not a realloc */
/* XXX shouldn't the phys already be zeroed? */
}
/* zero the new blkptrs we are gaining */
sizeof (blkptr_t) *
}
}
SPA_MINBLOCKSIZE) == 0);
}
}
/*
* Just take the live (open-context) values for checksum and compress.
* Strictly speaking it's a future leak, but nothing bad happens if we
* start using the new checksum or compress algorithm a little early.
*/
/* process all the "freed" ranges in the file */
}
}
}
}
/* we've already synced out all data and indirect blocks */
/* there are no more dirty dbufs under this dnode */
/* XXX this is expensive. remove once 6343073 is closed. */
/* NB: the "off < maxblkid" is to catch overflow */
/*
* NB: if blocksize is changing, we could get confused,
* so only bother if there are multiple blocks and thus
* it can't be changing.
*/
}
/*
* Now that we've dropped the reference, the dnode may
* be evicted, so we musn't access it.
*/
return (1);
} else {
/*
* Iterate over the list, removing and sync'ing dbufs
* which are on the level we want, and leaving others.
*/
}
}
return (0);
}
}