dnode_sync.c revision 758f6e0b258f20dcb5b772642e2a18b998ee7927
/*
* 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 2007 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 */
/* check for existing blkptrs in the dnode */
for (i = 0; i < nblkptr; i++)
break;
if (i != nblkptr) {
/* transfer dnode's block pointers to new indirect block */
}
/* set dbuf's parent pointers to new indirect buf */
for (i = 0; i < nblkptr; i++) {
continue;
continue;
}
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;
/* data_old better be zeroed */
if (dr) {
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) {
1, 1, 0) != 0);
}
return;
}
if (BP_IS_HOLE(bp))
continue;
}
}
if (trunc) {
}
}
/*
* Try to kick all the dnodes dbufs out of the cache...
*/
int
{
int progress;
int pass = 0;
do {
} 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.
* If were only asked to try to evict everything then
* return an error if we can't. Otherwise panic as the caller
* expects total eviction.
*/
if (try) {
return (1);
} else {
panic("dangling dbufs (dn=%p, dbuf=%p)\n",
}
}
}
return (0);
}
static void
{
/* XXX - use dbuf_undirty()? */
} else {
}
}
}
static void
{
(void) dnode_evict_dbufs(dn, 0);
/*
* XXX - It would be nice to assert this, but we may still
* have residual holds from async evictions from the arc...
*
* zfs_obj_to_path() also depends on this being
* commented out.
*
* 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;
dn->dn_free_txg = 0;
/*
* Now that we've released our hold, the dnode may
* be evicted, so we musn't access it.
*/
}
/*
* Write out the dnode's dirty buffers.
*
* NOTE: The dnode is kept in memory by being dirty. Once the
* dirty bit is cleared, it may be evicted. Beware of this!
*/
void
{
/* 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 */
}
}
return;
}
}
}
/*
* Although we have dropped our reference to the dnode, it
* can't be evicted until its written, and we haven't yet
* initiated the IO for the dnode's dbuf.
*/
}