Jorgen Lundman | 4d3c95f | 2012-07-19 20:48:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * GRUB -- GRand Unified Bootloader |
| 3 | * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Jorgen Lundman | 4d3c95f | 2012-07-19 20:48:25 +0000 | [diff] [blame] | 6 | */ |
| 7 | /* |
| 8 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
| 9 | * Use is subject to license terms. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _SYS_UBERBLOCK_IMPL_H |
| 13 | #define _SYS_UBERBLOCK_IMPL_H |
| 14 | |
| 15 | #define UBMAX(a, b) ((a) > (b) ? (a) : (b)) |
| 16 | |
| 17 | /* |
| 18 | * The uberblock version is incremented whenever an incompatible on-disk |
| 19 | * format change is made to the SPA, DMU, or ZAP. |
| 20 | * |
| 21 | * Note: the first two fields should never be moved. When a storage pool |
| 22 | * is opened, the uberblock must be read off the disk before the version |
| 23 | * can be checked. If the ub_version field is moved, we may not detect |
| 24 | * version mismatch. If the ub_magic field is moved, applications that |
| 25 | * expect the magic number in the first word won't work. |
| 26 | */ |
| 27 | #define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ |
| 28 | #define UBERBLOCK_SHIFT 10 /* up to 1K */ |
| 29 | |
| 30 | typedef struct uberblock { |
| 31 | uint64_t ub_magic; /* UBERBLOCK_MAGIC */ |
| 32 | uint64_t ub_version; /* ZFS_VERSION */ |
| 33 | uint64_t ub_txg; /* txg of last sync */ |
| 34 | uint64_t ub_guid_sum; /* sum of all vdev guids */ |
| 35 | uint64_t ub_timestamp; /* UTC time of last sync */ |
| 36 | blkptr_t ub_rootbp; /* MOS objset_phys_t */ |
| 37 | } uberblock_t; |
| 38 | |
| 39 | #define VDEV_UBERBLOCK_SHIFT(as) UBMAX(as, UBERBLOCK_SHIFT) |
| 40 | #define UBERBLOCK_SIZE(as) (1ULL << VDEV_UBERBLOCK_SHIFT(as)) |
| 41 | |
| 42 | /* Number of uberblocks that can fit in the ring at a given ashift */ |
| 43 | #define UBERBLOCK_COUNT(as) (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(as)) |
| 44 | |
| 45 | #endif /* _SYS_UBERBLOCK_IMPL_H */ |