dmu_objset.c revision faafa6e33cc19afb09172d9a365a59da0dbfd965
/*
* 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>
#include <sys/dsl_prop.h>
#include <sys/dsl_pool.h>
#include <sys/dsl_synctask.h>
#include <sys/zio_checksum.h>
#include <sys/dmu_impl.h>
spa_t *
{
}
zilog_t *
{
}
{
else
}
{
}
{
}
void
{
}
{
}
static void
{
/*
* Inheritance should have been done by now.
*/
}
static void
{
/*
* Inheritance and range checking should have been done by now.
*/
}
void
{
}
int
{
if (bp)
if (err) {
return (err);
}
} else {
}
/*
* Note: the changed_cb will be called once before the register
* func returns, thus changing the checksum/compression from the
* registering would complicate clone promotion.
*/
if (err == 0)
if (err) {
return (err);
}
/* It's the meta-objset. */
}
/*
* Metadata always gets compressed and checksummed.
* If the data checksum is multi-bit correctable, and it's not
* a ZBT-style checksum, then it's suitable for metadata as well.
* Otherwise, the metadata checksum defaults to fletcher4.
*/
else
for (i = 0; i < TXG_SIZE; i++) {
}
if (winner) {
}
}
return (0);
}
/* called from zpl */
int
{
int err;
if (err) {
return (err);
}
if (err) {
return (err);
}
}
return (EINVAL);
}
return (0);
}
void
{
}
int
{
/* process the mdn last, since the other dnodes have holds on it */
/*
* Find the first dnode with holds. We have to do this dance
* because dnode_add_ref() only works if you already have a
* hold. If there are no holds then it has no dbufs so OK to
* skip.
*/
continue;
if (dn)
while (dn) {
do {
if (next_dn)
if (next_dn)
return (1);
}
}
return (0);
}
void
{
int i;
for (i = 0; i < TXG_SIZE; i++) {
}
}
/*
* We should need only a single pass over the dnode list, since
* nothing can be added to the list at this point.
*/
(void) dmu_objset_evict_dbufs(&os, 0);
}
/* called from dsl for meta-objset */
{
/*
* We don't want to have to increase the meta-dnode's nlevels
* later, because then we could do it in quescing context while
* we are also accessing it in open context.
*
* This precaution is not necessary for the MOS (ds == NULL),
* because the MOS is only updated in syncing context.
* This is most fortunate: the MOS is the only objset that
* needs to be synced multiple times as spa_sync() iterates
* to convergence, so minimizing its dn_nlevels matters.
*/
int levels = 1;
/*
* Determine the number of levels necessary for the meta-dnode
* to contain DN_MAX_OBJECT dnodes.
*/
DN_MAX_OBJECT * sizeof (dnode_phys_t))
levels++;
}
return (osi);
}
struct oscarg {
void *userarg;
const char *lastname;
};
/* ARGSUSED */
static int
{
int err;
/*
* You can't clone across pools.
*/
return (EXDEV);
/*
* You can only clone snapshots, not the head datasets.
*/
return (EINVAL);
}
return (0);
}
static void
{
if (BP_IS_HOLE(&bp)) {
/* This is an empty dmu_objset; not a clone. */
}
}
int
{
const char *tail;
int err = 0;
if (err)
return (err);
return (EEXIST);
}
if (clone_parent != NULL) {
/*
* You can't clone to a different type.
*/
return (EINVAL);
}
}
return (err);
}
int
dmu_objset_destroy(const char *name)
{
int error;
/*
* If it looks like we'll be able to destroy it, and there's
* an unplayed replay log sitting around, destroy the log.
* It would be nicer to do this in dsl_dataset_destroy_sync(),
* but the replay log objset is modified in open context.
*/
if (error == 0) {
}
return (dsl_dataset_destroy(name));
}
int
dmu_objset_rollback(const char *name)
{
int err;
if (err == 0) {
if (err == 0)
if (err == 0) {
/* XXX uncache everything? */
}
}
return (err);
}
struct snaparg {
char *snapname;
char failed[MAXPATHLEN];
};
static int
{
int err;
if (err != 0)
return (err);
/*
* NB: we need to wait for all in-flight changes to get to disk,
* so that we snapshot those changes. zil_suspend does this as
* a side effect.
*/
if (err == 0) {
}
return (err);
}
int
{
char *cp;
int err;
if (cp) {
*cp = '\0';
*cp = '/';
} else {
}
if (err)
return (err);
if (recursive) {
} else {
}
if (err)
goto out;
}
out:
if (err)
return (err);
}
static void
{
while (dn) {
/*
* This dnode requires syncing at higher
* levels; put it back onto the list.
*/
if (next)
else
}
}
}
}
/* ARGSUSED */
static void
{
int i;
/*
* Update rootbp fill count.
*/
for (i = 0; i < dnp->dn_nblkptr; i++)
}
}
/* called from dsl */
void
{
int txgoff;
int err;
/* XXX the write_done callback should really give us the tx... */
/*
* Free intent log blocks up to this tx.
*/
/*
* Sync meta-dnode
*/
/*
* Sync the root block.
*/
}
void
{
}
{
}
void
{
}
void
{
}
int
{
else
return (B_FALSE);
}
int
{
return (ENOENT);
return (ENOENT);
}
return (ENAMETOOLONG);
}
if (idp)
return (0);
}
int
{
/* there is no next dir on a snapshot! */
return (ENOENT);
return (ENOENT);
}
return (ENAMETOOLONG);
}
if (idp)
return (0);
}
/*
* Find all objsets under name, and for each, call 'func(child_name, arg)'.
*/
int
{
char *child;
if (err)
return (err);
/* NB: the $MOS dir doesn't have a head dataset */
/*
* Iterate over all children.
*/
if (flags & DS_FIND_CHILDREN) {
(void) zap_cursor_advance(&zc)) {
/*
* No separating '/' because parent's name ends in /.
*/
/* XXX could probably just use name here */
if (err)
break;
}
if (err) {
return (err);
}
}
/*
* Iterate over all snapshots.
*/
if ((flags & DS_FIND_SNAPSHOTS) &&
(void) zap_cursor_advance(&zc)) {
/* XXX could probably just use name here */
if (err)
break;
}
}
if (err)
return (err);
/*
* Apply to self if appropriate.
*/
if (do_self)
return (err);
}