usr/src/uts/common/fs/zfs/sys/uberblock_impl.h
author eschrock
Tue, 16 May 2006 11:20:11 -0700
changeset 1986 628267397204
parent 1760 e1ad2821c30d
child 4577 ed36b0e652bc
permissions -rw-r--r--
6424405 zpool import destroyed_pool can damage existing pool using same devices
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     1
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     2
 * CDDL HEADER START
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     3
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
     5
 * Common Development and Distribution License (the "License").
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
     6
 * You may not use this file except in compliance with the License.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     7
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    11
 * and limitations under the License.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    12
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    18
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    19
 * CDDL HEADER END
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    20
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    21
/*
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    22
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    23
 * Use is subject to license terms.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    24
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    25
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    26
#ifndef _SYS_UBERBLOCK_IMPL_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#define	_SYS_UBERBLOCK_IMPL_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    28
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    29
#pragma ident	"%Z%%M%	%I%	%E% SMI"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    30
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    31
#include <sys/uberblock.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
extern "C" {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    36
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    37
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
 * The uberblock version is incremented whenever an incompatible on-disk
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    39
 * format change is made to the SPA, DMU, or ZAP.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    40
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    41
 * Note: the first two fields should never be moved.  When a storage pool
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    42
 * is opened, the uberblock must be read off the disk before the version
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    43
 * can be checked.  If the ub_version field is moved, we may not detect
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    44
 * version mismatch.  If the ub_magic field is moved, applications that
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    45
 * expect the magic number in the first word won't work.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    46
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    47
#define	UBERBLOCK_MAGIC		0x00bab10c		/* oo-ba-bloc!	*/
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    48
#define	UBERBLOCK_SHIFT		10			/* up to 1K	*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    49
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    50
struct uberblock {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
	uint64_t	ub_magic;	/* UBERBLOCK_MAGIC		*/
1760
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1732
diff changeset
    52
	uint64_t	ub_version;	/* ZFS_VERSION			*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
	uint64_t	ub_txg;		/* txg of last sync		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    54
	uint64_t	ub_guid_sum;	/* sum of all vdev guids	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    55
	uint64_t	ub_timestamp;	/* UTC time of last sync	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    56
	blkptr_t	ub_rootbp;	/* MOS objset_phys_t		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    57
};
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    58
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    59
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    61
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    62
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    63
#endif	/* _SYS_UBERBLOCK_IMPL_H */