dmu_objset.c revision 40feaa914945406e86e193599d115ea71a171d18
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 0N/A * Use is subject to license terms. 0N/A#
pragma ident "%Z%%M% %I% %E% SMI" 3853N/A * Inheritance should have been done by now. 0N/A * Inheritance and range checking should have been done by now. 1638N/A * Inheritance and range checking should have been done by now. 1638N/A * Note: the changed_cb will be called once before the register 1638N/A * registering would complicate clone promotion. 1638N/A /* It's the meta-objset. */ 3853N/A * Metadata always gets compressed and checksummed. 1638N/A * If the data checksum is multi-bit correctable, and it's not 1638N/A * a ZBT-style checksum, then it's suitable for metadata as well. 1638N/A * Otherwise, the metadata checksum defaults to fletcher4. 1638N/A /* process the mdn last, since the other dnodes have holds on it */ 338N/A * Find the first dnode with holds. We have to do this dance 338N/A * because dnode_add_ref() only works if you already have a 338N/A * hold. If there are no holds then it has no dbufs so OK to 2086N/A * We should need only a single pass over the dnode list, since 2086N/A * nothing can be added to the list at this point. 1638N/A/* called from dsl for meta-objset */ 3853N/A * We don't want to have to increase the meta-dnode's nlevels 4134N/A * later, because then we could do it in quescing context while 3853N/A * we are also accessing it in open context. 1638N/A * This precaution is not necessary for the MOS (ds == NULL), 1638N/A * because the MOS is only updated in syncing context. 1638N/A * This is most fortunate: the MOS is the only objset that 1638N/A * needs to be synced multiple times as spa_sync() iterates 1638N/A * to convergence, so minimizing its dn_nlevels matters. 3853N/A * Determine the number of levels necessary for the meta-dnode 3853N/A * to contain DN_MAX_OBJECT dnodes. 1638N/A * You can't clone across pools. 1638N/A * You can only clone snapshots, not the head datasets. 0N/A /* This is an empty dmu_objset; not a clone. */ 0N/A * Create create time permission if any? 0N/A * You can't clone to a different type. 0N/A * If it looks like we'll be able to destroy it, and there's 868N/A * an unplayed replay log sitting around, destroy the log. 868N/A * It would be nicer to do this in dsl_dataset_destroy_sync(), 1400N/A * but the replay log objset is modified in open context. 0N/A /* XXX uncache everything? */ 1615N/A * Check permissions only when requested. This only applies when 1615N/A * doing a recursive snapshot. The permission checks for the starting 1615N/A * dataset have already been performed in zfs_secpolicy_snapshot() 1615N/A * If the objset is in an inconsistent state, return busy. 1638N/A * NB: we need to wait for all in-flight changes to get to disk, 1638N/A * so that we snapshot those changes. zil_suspend does this as 2414N/A * Initialize dn_zio outside dnode_sync() 1615N/A * Update rootbp fill count. 1638N/A /* XXX the write_done callback should really give us the tx... */ 1638N/A * This is the MOS. If we have upgraded, 1638N/A * spa_max_replication() could change, so reset 2414N/A * Sync meta-dnode - the parent IO for the sync is the root block 1638N/A * Free intent log blocks up to this tx. /* there is no next dir on a snapshot! */ * Find all objsets under name, and for each, call 'func(child_name, arg)'. /* NB: the $MOS dir doesn't have a head dataset */ * Iterate over all children. * No separating '/' because parent's name ends in /. /* XXX could probably just use name here */ * Iterate over all snapshots. /* XXX could probably just use name here */ * Apply to self if appropriate.