dsl_pool.c revision 99653d4ee642c6528e88224f12409a5f23060994
/*
* 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/dsl_pool.h>
#include <sys/dsl_dataset.h>
#include <sys/dmu_objset.h>
#include <sys/zfs_context.h>
/* internal reserved dir name */
#define MOS_DIR_NAME "$MOS"
static int
{
int err;
if (err)
return (err);
}
static dsl_pool_t *
{
dsl_pool_t *dp;
return (dp);
}
int
{
int err;
if (err)
goto out;
&dp->dp_root_dir_obj);
if (err)
goto out;
if (err)
goto out;
if (err)
goto out;
out:
if (err)
else
return (err);
}
void
{
/* drop our reference from dsl_pool_open() */
if (dp->dp_mos_dir)
if (dp->dp_root_dir)
/* undo the dmu_objset_open_impl(mos) from dsl_pool_open() */
if (dp->dp_meta_objset)
arc_flush();
}
{
int err;
/* create the pool directory */
/* create and open the root dir */
/* create and open the meta-objset dir */
return (dp);
}
void
{
do {
}
/*
* We need to loop since dsl_dir_sync() could create a
* new (dirty) objset.
* XXX - isn't this taken care of by the spa's sync to
* convergence loop?
*/
}
}
void
{
}
}
int
{
/*
* Yeah, this is cheesy. But the SPA needs some way to let
* the sync threads invoke spa_open() and spa_close() while
* it holds the namespace lock. I'm certainly open to better
* ideas for how to determine whether the current thread is
* operating on behalf of spa_sync(). This works for now.
*/
}
{
/*
* Reserve about 1.6% (1/64), or at least 32MB, for allocation
* efficiency.
* XXX The intent log is not accounted for, so it must fit
* within this slop.
*
* If we're trying to assess whether it's OK to do a free,
* cut the reservation in half to allow forward progress
* (e.g. make it possible to rm(1) files from a full pool).
*/
if (netfree)
resv >>= 1;
}