spa.h revision 0a48a24e663a04e34e2ed4e55390ad96f178dbea
3N/A * The contents of this file are subject to the terms of the 3N/A * Common Development and Distribution License (the "License"). 3N/A * You may not use this file except in compliance with the License. 3N/A * See the License for the specific language governing permissions 3N/A * and limitations under the License. 3N/A * When distributing Covered Code, include this CDDL HEADER in each 3N/A * If applicable, add the following below this CDDL HEADER, with the 3N/A * fields enclosed by brackets "[]" replaced with your own identifying 3N/A * information: Portions Copyright [yyyy] [name of copyright owner] 3N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 3N/A * Use is subject to license terms. 850N/A#
pragma ident "%Z%%M% %I% %E% SMI" 193N/A * Forward references that lots of things need. 936N/A * General-purpose 32-bit and 64-bit bitfield encodings. 3N/A * We currently support nine block sizes, from 512 bytes to 128K. 1013N/A * We could go higher, but the benefits are near-zero and the cost 1013N/A * of COWing a giant block to modify one byte would become excessive. 1013N/A * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. 3N/A * The ASIZE encoding should be at least 64 times larger (6 more bits) 974N/A * to support up to 4-way RAID-Z mirror mode with worst-case gang block 974N/A * overhead, three DVAs per bp, plus one more bit in case we do anything 3N/A * else that expands the ASIZE. 974N/A * All SPA data is represented by 128-bit data virtual addresses (DVAs). 3N/A * The members of the dva_t should be considered opaque outside the SPA. 3N/A * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. 3N/A * Each block is described by its DVAs, time of birth, checksum, etc. 3N/A * The word-by-word, bit-by-bit layout of the blkptr is as follows: 974N/A * 64 56 48 40 32 24 16 8 0 3N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 3N/A * 0 | vdev1 | GRID | ASIZE | 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 199N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 193N/A * 2 | vdev2 | GRID | ASIZE | 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 193N/A * 4 | vdev3 | GRID | ASIZE | 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 193N/A * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 193N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 936N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1020N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 3N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 3N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 974N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 974N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 1013N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 974N/A * +-------+-------+-------+-------+-------+-------+-------+-------+ 3N/A * vdev virtual device ID 974N/A * offset offset into virtual device 3N/A * LSIZE logical size 3N/A * PSIZE physical size (after compression) 974N/A * ASIZE allocated size (including RAID-Z parity and gang block headers) 1013N/A * GRID RAID-Z layout information (reserved for future use) 974N/A * cksum checksum function 1013N/A * comp compression function 271N/A * G gang block indicator 271N/A * lvl level of indirection 3N/A * birth txg transaction group in which the block was born 3N/A * fill count number of non-zero blocks under this bp 974N/A * checksum[4] 256-bit checksum of the data this bp describes * Macros to get and set fields in a bp or DVA. * Note: the byteorder is either 0 or -1, both of which are palindromes. * This simplifies the endianness handling a bit. * Routines found in spa.c /* state manipulation functions */ /* device manipulation */ /* spare state (which is global across all pools) */ /* L2ARC state (which is global across all pools) */ /* spa namespace global mutex */ /* Namespace manipulation */ /* Pool configuration lock */ /* Miscellaneous support routines */ /* Initialization and termination */ /* asynchronous event notification */ extern int spa_mode;
/* mode, e.g. FREAD | FWRITE */