usr/src/uts/common/fs/zfs/dmu_object.c
changeset 6992 20c04e18c58c
parent 3025 4e5ee8301d84
child 8986 45c289aff7c9
equal deleted inserted replaced
6991:c0faefde7d97 6992:20c04e18c58c
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 /*
    21 /*
    22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
    22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
    23  * Use is subject to license terms.
    23  * Use is subject to license terms.
    24  */
    24  */
    25 
    25 
    26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
    26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
    27 
    27 
    52 		 * If we can't find one, just keep going from here.
    52 		 * If we can't find one, just keep going from here.
    53 		 */
    53 		 */
    54 		if (P2PHASE(object, L2_dnode_count) == 0) {
    54 		if (P2PHASE(object, L2_dnode_count) == 0) {
    55 			uint64_t offset = restarted ? object << DNODE_SHIFT : 0;
    55 			uint64_t offset = restarted ? object << DNODE_SHIFT : 0;
    56 			int error = dnode_next_offset(osi->os_meta_dnode,
    56 			int error = dnode_next_offset(osi->os_meta_dnode,
    57 			    B_TRUE, &offset, 2, DNODES_PER_BLOCK >> 2, 0);
    57 			    DNODE_FIND_HOLE,
       
    58 			    &offset, 2, DNODES_PER_BLOCK >> 2, 0);
    58 			restarted = B_TRUE;
    59 			restarted = B_TRUE;
    59 			if (error == 0)
    60 			if (error == 0)
    60 				object = offset >> DNODE_SHIFT;
    61 				object = offset >> DNODE_SHIFT;
    61 		}
    62 		}
    62 		osi->os_obj_next = ++object;
    63 		osi->os_obj_next = ++object;
   137 	    FTAG, &dn);
   138 	    FTAG, &dn);
   138 	if (err)
   139 	if (err)
   139 		return (err);
   140 		return (err);
   140 
   141 
   141 	ASSERT(dn->dn_type != DMU_OT_NONE);
   142 	ASSERT(dn->dn_type != DMU_OT_NONE);
       
   143 	dnode_free_range(dn, 0, DMU_OBJECT_END, tx);
   142 	dnode_free(dn, tx);
   144 	dnode_free(dn, tx);
   143 	dnode_rele(dn, FTAG);
   145 	dnode_rele(dn, FTAG);
   144 
   146 
   145 	return (0);
   147 	return (0);
   146 }
   148 }
   150 {
   152 {
   151 	uint64_t offset = (*objectp + 1) << DNODE_SHIFT;
   153 	uint64_t offset = (*objectp + 1) << DNODE_SHIFT;
   152 	int error;
   154 	int error;
   153 
   155 
   154 	error = dnode_next_offset(os->os->os_meta_dnode,
   156 	error = dnode_next_offset(os->os->os_meta_dnode,
   155 	    hole, &offset, 0, DNODES_PER_BLOCK, txg);
   157 	    (hole ? DNODE_FIND_HOLE : 0), &offset, 0, DNODES_PER_BLOCK, txg);
   156 
   158 
   157 	*objectp = offset >> DNODE_SHIFT;
   159 	*objectp = offset >> DNODE_SHIFT;
   158 
   160 
   159 	return (error);
   161 	return (error);
   160 }
   162 }