dnode_sync.c revision 34f1851290e1fe5f53e9f4175aa8264618e9125e
/*
* 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 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) {
}
}
static int
{
/* Undirty all buffers */
/* XXX - use dbuf_undirty()? */
}
}
/* Undirty next bits */
/* free up all the blocks in the file. */
/*
* All dbufs should be gone, since all holds are gone...
*/
/* 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
{
/* ASSERT(dn->dn_objset->dd_snapshot == NULL); */
/*
* 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);
}
}