1N/A * GRUB -- GRand Unified Bootloader 1N/A * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. 1N/A * This program is free software; you can redistribute it and/or modify 1N/A * it under the terms of the GNU General Public License as published by 1N/A * the Free Software Foundation; either version 2 of the License, or 1N/A * (at your option) any later version. 1N/A * This program is distributed in the hope that it will be useful, 1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1N/A * GNU General Public License for more details. 1N/A * You should have received a copy of the GNU General Public License 1N/A * along with this program; if not, write to the Free Software 1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 1N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 1N/A * General-purpose 32-bit and 64-bit bitfield encodings. 1N/A * We currently support nine block sizes, from 512 bytes to 128K. 1N/A * We could go higher, but the benefits are near-zero and the cost 1N/A * of COWing a giant block to modify one byte would become excessive. 1N/A * Size of block to hold the configuration data (a packed nvlist) 1N/A * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. 1N/A * The ASIZE encoding should be at least 64 times larger (6 more bits) 1N/A * to support up to 4-way RAID-Z mirror mode with worst-case gang block 1N/A * overhead, three DVAs per bp, plus one more bit in case we do anything 1N/A * else that expands the ASIZE. 1N/A * All SPA data is represented by 128-bit data virtual addresses (DVAs). 1N/A * The members of the dva_t should be considered opaque outside the SPA. 1N/A * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. 1N/A * Each block is described by its DVAs, time of birth, checksum, etc. 1N/A * The word-by-word, bit-by-bit layout of the blkptr is as follows: 1N/A * 64 56 48 40 32 24 16 8 0 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * 0 | vdev1 |ncopy|L| ASIZE | 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * 2 | vdev2 |ncopy|L| ASIZE | 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * 4 | vdev3 |ncopy|L| ASIZE | 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * 6 |BDE|lvl| type | cksum | comp | PSIZE | LSIZE | 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * 9 | physical birth txg | 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * a | logical birth txg | 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1N/A * vdev virtual device ID 1N/A * offset offset into virtual device 1N/A * LSIZE logical size 1N/A * PSIZE physical size (after compression) 1N/A * ASIZE allocated size (including RAID-Z parity and gang block headers) 1N/A * ncopy number of copies if RAID-Z, otherwise 1 1N/A * cksum checksum function 1N/A * comp compression function 1N/A * G gang block indicator 1N/A * B byteorder (endianness) 1N/A * lvl level of indirection 1N/A * type DMU object type 1N/A * phys birth txg of block allocation; zero if same as logical birth txg 1N/A * log. birth transaction group in which the block was logically born 1N/A * fill count number of non-zero blocks under this bp 1N/A * checksum[4] 256-bit checksum of the data this bp describes 1N/A * Special notes for encryption: 1N/A * A single bit is used to indicate if the block is encrypted. This is 1N/A * sufficient since all blocks in a dataset always share the same encryption 1N/A * algorithm-keylen-mode. 1N/A * When encryption is enabled blk_dva[2] holds the IV. 1N/A * When encryption is enabled level 0 blocks checksum[2] and checksum[3] hold 1N/A * the MAC output from the encryption and the normal checksum is truncated 1N/A * and stored in checksum[0] and checksum[1]. 1N/A * DVA layouts. Normally mirror vdevs contain mirrored data, RAID-Z vdevs 1N/A * contain RAID-Z data, etc. However, for latency-sensitive metadata, 1N/A * we can use a mirrored layout across the children of a RAID-Z vdev. 1N/A * This ensures that such metadata can be read in a single I/O. 1N/A * Macros to get and set fields in a bp or DVA. 1N/A/* BP_IS_RAIDZ(bp) assumes no block compression */ 1N/A * Note: the byteorder is either 0 or -1, both of which are palindromes. 1N/A * This simplifies the endianness handling a bit. 1N/A#
endif /* _SYS_SPA_H */