dnode_sync.c revision b24ab6762772a3f6a89393947930c7fa61306783
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#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 int
{
uint64_t bytesfreed = 0;
int i, blocks_freed = 0;
if (BP_IS_HOLE(bp))
continue;
blocks_freed += 1;
}
return (blocks_freed);
}
#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
#define ALL -1
static int
{
int blocks_freed = 0;
/*
* There is a small possibility that this block will not be cached:
* 1 - if level > 1 and there are no children with level <= 1
* 2 - if we didn't get a dirty hold (because this block had just
* finished being written -- and so had no holds), and then this
* block got evicted before we got here.
*/
} else {
}
else if (all)
}
if (BP_IS_HOLE(bp))
continue;
} else {
}
}
#ifdef ZFS_DEBUG
continue;
continue;
}
#endif
}
/*
* 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 {
} 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);
}
}
static void
{
/* XXX - use dbuf_undirty()? */
}
}
}
static void
{
/*
* Our contents should have been freed in dnode_sync() by the
* free range record inserted by the caller of dnode_free().
*/
/*
* 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 */
/* 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.
*/
void
{
static const dnode_phys_t zerodn = { 0 };
} else {
/* Once we account for it, we should always account for it. */
}
/* The dnode is newly allocated or reallocated */
/* this is a first alloc, not a realloc */
}
}
SPA_MINBLOCKSIZE) == 0);
}
dnp->dn_bonuslen = 0;
else
}
}
/*
* 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 */
/* grab the mutex so we don't race with dnode_block_freed() */
}
return;
}
/* this should only happen on a realloc */
/* zero the new blkptrs we are gaining */
sizeof (blkptr_t) *
#ifdef ZFS_DEBUG
} else {
int i;
/* the blkptrs we are losing better be unallocated */
i < dnp->dn_nblkptr; i++)
#endif
}
}
}
}
/*
* 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.
*/
}