dmu_objset.c revision 745cd3c5371d020efae7a911c58c526aa1fd0dba
/*
* 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 2008 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/dsl_deleg.h>
#include <sys/zio_checksum.h>
#include <sys/dmu_impl.h>
#include <sys/zfs_ioctl.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.
*/
}
static void
{
/*
* Inheritance and range checking should have been done by now.
*/
}
void
{
}
int
{
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 == 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++) {
}
/*
* We should be the only thread trying to do this because we
* have ds_opening_lock
*/
if (ds) {
}
return (0);
}
static int
{
int err;
if (err) {
return (err);
}
}
return (EINVAL);
return (0);
}
int
{
int err;
if (err)
else
return (err);
}
/* called from zpl */
int
{
int err;
else
if (err) {
return (err);
}
if (err) {
else
} else {
}
return (err);
}
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;
while (dn) {
do {
}
}
void
{
int i;
for (i = 0; i < TXG_SIZE; i++) {
}
copies_changed_cb, osi));
}
/*
* 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);
}
/* called from dsl for meta-objset */
{
if (ds)
if (ds)
/*
* 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) {
/*
* dsl_dataset_destroy() closes the ds.
*/
}
return (error);
}
/*
* This will close the objset.
*/
int
{
int err;
return (EBUSY);
}
/*
* NB: we close the objset manually because the rollback
* actually implicitly called dmu_objset_evict(), thus freeing
* the objset_impl_t.
*/
return (err);
}
struct snaparg {
char *snapname;
char failed[MAXPATHLEN];
};
struct osnode {
};
static int
{
int err;
/*
* Check permissions only when requested. This only applies when
* doing a recursive snapshot. The permission checks for the starting
* dataset have already been performed in zfs_secpolicy_snapshot()
*/
return (err);
if (err != 0)
return (err);
/* If the objset is in an inconsistent state, return busy */
return (EBUSY);
}
/*
* 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) {
} else {
}
return (err);
}
int
{
int err;
if (err)
return (err);
if (recursive) {
} else {
}
if (err)
goto out;
}
out:
}
if (err)
return (err);
}
static void
{
/*
* Initialize dn_zio outside dnode_sync()
* to accomodate meta-dnode
*/
}
}
/* ARGSUSED */
static void
{
int i;
/*
* Update rootbp fill count.
*/
for (i = 0; i < dnp->dn_nblkptr; i++)
BP_SET_LEVEL(bp, 0);
/* We must do this after we've set the bp's type and level */
}
}
/* ARGSUSED */
static void
{
}
/* called from dsl */
void
{
int txgoff;
/* XXX the write_done callback should really give us the tx... */
/*
* This is the MOS. If we have upgraded,
* spa_max_replication() could change, so reset
* os_copies here.
*/
}
/*
* Create the root block IO
*/
}
&zb);
/*
* Sync meta-dnode - the parent IO for the sync is the root block
*/
}
/*
* Free intent log blocks up to this tx.
*/
}
void
{
}
{
}
void
{
}
void
{
}
int
{
else
return (B_FALSE);
}
int
{
return (ENOENT);
}
int
{
return (ENOENT);
return (ENOENT);
}
return (ENAMETOOLONG);
}
if (idp)
if (case_conflict)
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);
}
void
{
}
void *
{
}