Lines Matching +full:embedded +full:- +full:sync

1 /*-
7 * McAfee, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as
74 #define AVL_ISIGN(a) (((a) > 0) - ((a) < 0))
75 #define AVL_CMP(a, b) (((a) > (b)) - ((a) < (b)))
77 (((uintptr_t)(a) > (uintptr_t)(b)) - ((uintptr_t)(a) < (uintptr_t)(b)))
84 #define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */
90 #define P2ALIGN(x, align) ((x) & -(align))
91 #define P2PHASE(x, align) ((x) & ((align) - 1))
92 #define P2NPHASE(x, align) (-(x) & ((align) - 1))
93 #define P2ROUNDUP(x, align) (-(-(x) & -(align)))
94 #define P2END(x, align) (-(~(x) & -(align)))
95 #define P2PHASEUP(x, align, phase) ((phase) - (((phase) - (x)) & -(align)))
96 #define P2BOUNDARY(off, len, align) (((off) ^ ((off) + (len) - 1)) > (align) - 1)
99 * General-purpose 32-bit and 64-bit bitfield encodings.
120 BF32_SET(x, low, len, ((val) >> (shift)) - (bias))
122 BF64_SET(x, low, len, ((val) >> (shift)) - (bias))
142 * to support up to 4-way RAID-Z mirror mode with worst-case gang block
151 * All SPA data is represented by 128-bit data virtual addresses (DVAs).
159 * Each block has a 256-bit checksum -- strong enough for cryptographic hashes.
166 * Some checksums/hashes need a 256-bit initialization salt. This salt is kept
175 * The word-by-word, bit-by-bit layout of the blkptr is as follows:
178 * +-------+-------+-------+-------+-------+-------+-------+-------+
180 * +-------+-------+-------+-------+-------+-------+-------+-------+
182 * +-------+-------+-------+-------+-------+-------+-------+-------+
184 * +-------+-------+-------+-------+-------+-------+-------+-------+
186 * +-------+-------+-------+-------+-------+-------+-------+-------+
188 * +-------+-------+-------+-------+-------+-------+-------+-------+
190 * +-------+-------+-------+-------+-------+-------+-------+-------+
192 * +-------+-------+-------+-------+-------+-------+-------+-------+
194 * +-------+-------+-------+-------+-------+-------+-------+-------+
196 * +-------+-------+-------+-------+-------+-------+-------+-------+
198 * +-------+-------+-------+-------+-------+-------+-------+-------+
200 * +-------+-------+-------+-------+-------+-------+-------+-------+
202 * +-------+-------+-------+-------+-------+-------+-------+-------+
204 * +-------+-------+-------+-------+-------+-------+-------+-------+
206 * +-------+-------+-------+-------+-------+-------+-------+-------+
208 * +-------+-------+-------+-------+-------+-------+-------+-------+
210 * +-------+-------+-------+-------+-------+-------+-------+-------+
218 * ASIZE allocated size (including RAID-Z parity and gang block headers)
219 * GRID RAID-Z layout information (reserved for future use)
226 * E blkptr_t contains embedded data (see below)
231 * fill count number of non-zero blocks under this bp
232 * checksum[4] 256-bit checksum of the data this bp describes
236 * "Embedded" blkptr_t's don't actually point to a block, instead they
237 * have a data payload embedded in the blkptr_t itself. See the comment
243 * +-------+-------+-------+-------+-------+-------+-------+-------+
250 * +-------+-------+-------+-------+-------+-------+-------+-------+
252 * +-------+-------+-------+-------+-------+-------+-------+-------+
256 * +-------+-------+-------+-------+-------+-------+-------+-------+
258 * +-------+-------+-------+-------+-------+-------+-------+-------+
264 * +-------+-------+-------+-------+-------+-------+-------+-------+
268 * payload contains the embedded data
272 * E (embedded) set to one
275 * etype how to interpret embedded data (BP_EMBEDDED_TYPE_*)
283 * Note that LSIZE and PSIZE are stored in bytes, whereas for non-embedded
285 * Generally, the generic BP_GET_*() macros can be used on embedded BP's.
290 * "embedded-ness".
295 BF64_GET((bp)->blk_prop, 40, 8))
298 BF64_SET((bp)->blk_prop, 40, 8, t); \
303 BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1))
306 BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \
311 BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1))
314 BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \
326 ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
338 zio_cksum_t blk_cksum; /* 256-bit checksum */
345 BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0)
347 BF64_SET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, \
350 #define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8)
351 #define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x)
353 #define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32)
354 #define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x)
357 BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0)
359 BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x)
361 #define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1)
362 #define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x)
367 BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1))
370 BF64_SET_SB((bp)->blk_prop, \
375 BF64_GET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1)
377 BF64_SET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x)
379 #define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 7)
380 #define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 7, x)
382 #define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8)
383 #define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x)
385 #define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8)
386 #define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x)
388 #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5)
389 #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x)
391 #define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1)
393 #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1)
394 #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x)
396 #define BP_GET_BYTEORDER(bp) BF64_GET((bp)->blk_prop, 63, 1)
397 #define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x)
400 ((bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
405 (bp)->blk_birth = (logical); \
406 (bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
410 ((BP_IS_EMBEDDED(bp)) ? 1 : (bp)->blk_fill)
414 (bp)->blk_fill = fill; \
418 (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
419 DVA_GET_ASIZE(&(bp)->blk_dva[2]))
426 (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
427 !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
428 !!DVA_GET_ASIZE(&(bp)->blk_dva[2]))
431 ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
432 (dva1)->dva_word[0] == (dva2)->dva_word[0])
435 (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
436 ((zc1).zc_word[1] - (zc2).zc_word[1]) | \
437 ((zc1).zc_word[2] - (zc2).zc_word[2]) | \
438 ((zc1).zc_word[3] - (zc2).zc_word[3])))
445 (zcp)->zc_word[0] = w0; \
446 (zcp)->zc_word[1] = w1; \
447 (zcp)->zc_word[2] = w2; \
448 (zcp)->zc_word[3] = w3; \
451 #define BP_IDENTITY(bp) (&(bp)->blk_dva[0])
453 #define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \
454 (dva)->dva_word[1] == 0ULL)
456 #define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg))
460 (bp)->blk_dva[0].dva_word[0] = 0; \
461 (bp)->blk_dva[0].dva_word[1] = 0; \
462 (bp)->blk_dva[1].dva_word[0] = 0; \
463 (bp)->blk_dva[1].dva_word[1] = 0; \
464 (bp)->blk_dva[2].dva_word[0] = 0; \
465 (bp)->blk_dva[2].dva_word[1] = 0; \
466 (bp)->blk_prop = 0; \
467 (bp)->blk_pad[0] = 0; \
468 (bp)->blk_pad[1] = 0; \
469 (bp)->blk_phys_birth = 0; \
470 (bp)->blk_birth = 0; \
471 (bp)->blk_fill = 0; \
472 ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
485 ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
488 * Embedded checksum
494 zio_cksum_t zec_cksum; /* 256-bit checksum */
498 * Gang block headers are self-checksumming and contain an array
502 #define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
504 #define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
505 sizeof (zio_eck_t) - \
532 MIN(MAX((vd)->v_top->v_ashift, UBERBLOCK_SHIFT), MAX_UBERBLOCK_SHIFT)
540 char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_eck_t)];
557 char vbe_bootenv[VDEV_PAD_SIZE - sizeof (uint64_t) -
579 * Size and offset of embedded boot loader region on each label.
692 * On-disk version number.
725 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
726 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
737 * were multiple changes to on-disk structures during that version.
741 * last synced uberblock. Checking the in-flight version can
892 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
893 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
913 * The uberblock version is incremented whenever an incompatible on-disk
922 #define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */
925 #define MMP_MAGIC 0xa11cea11 /* all-see-all */
931 #define MMP_VALID(ubp) (ubp->ub_magic == UBERBLOCK_MAGIC && \
932 ubp->ub_mmp_magic == MMP_MAGIC)
933 #define MMP_INTERVAL_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \
935 #define MMP_SEQ_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \
937 #define MMP_FAIL_INT_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \
940 #define MMP_INTERVAL(ubp) ((ubp->ub_mmp_config & 0x00000000FFFFFF00) \
942 #define MMP_SEQ(ubp) ((ubp->ub_mmp_config & 0x0000FFFF00000000) \
944 #define MMP_FAIL_INT(ubp) ((ubp->ub_mmp_config & 0xFFFF000000000000) \
950 uint64_t ub_txg; /* txg of last sync */
952 uint64_t ub_timestamp; /* UTC time of last sync */
966 * fail intervals, sequence number for sub-second granularity, and
970 * +-------+-------+-------+-------+-------+-------+-------+-------+
972 * +-------+-------+-------+-------+-------+-------+-------+-------+
977 * - 0x01 - Write Interval (ms)
978 * - 0x02 - Sequence number exists
979 * - 0x04 - Fail Intervals
980 * - 0xf8 - Reserved
1033 #define DN_BONUS_SIZE(dnsize) ((dnsize) - DNODE_CORE_SIZE - \
1037 #define DN_MAX_NBLKPTR ((DNODE_MIN_SIZE - DNODE_CORE_SIZE) >> \
1042 #define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT)
1044 #define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT)
1047 #define DN_MAX_LEVELS (2 + ((DN_MAX_OFFSET_SHIFT - SPA_MINBLOCKSHIFT) / \
1048 (DN_MIN_INDBLKSHIFT - SPA_BLKPTRSHIFT)))
1050 #define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \
1051 (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t))))
1053 #define DN_USED_BYTES(dnp) (((dnp)->dn_flags & DNODE_FLAG_USED_BYTES) ? \
1054 (dnp)->dn_used : (dnp)->dn_used << SPA_MINBLOCKSHIFT)
1056 #define EPB(blkshift, typeshift) (1 << (blkshift - typeshift))
1068 uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */
1093 * +---------------+---------------+---------------+-------+
1095 * +---------------+---------------+---------------+-------+
1097 * +---------------+-----------------------+---------------+
1099 * +---------------+-----------------------+---------------+
1109 uint8_t __dn_ignore3[DN_OLD_MAX_BONUSLEN -
1117 (((dnp)->dn_extra_slots + 1) << DNODE_SHIFT) - (1 << SPA_BLKPTRSHIFT))
1131 * Allocating a new byteswap type number makes the on-disk format
1263 * sa_hdr_phys -> sa_layout_info
1266 * +--------+-------+
1268 * +--------+-------+
1270 * Bits 0-10 are the layout number
1271 * Bits 11-16 are the size of the header.
1280 #define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10)
1281 #define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
1322 * Intent log header - this on disk structure holds fields to manage
1343 char os_pad0[OBJSET_PHYS_SIZE_V2 - sizeof (dnode_phys_t)*3 -
1344 sizeof (zil_header_t) - sizeof (uint64_t)*2 -
1349 char os_pad1[OBJSET_PHYS_SIZE_V3 - OBJSET_PHYS_SIZE_V2 -
1369 /* one-word entry constants */
1374 /* two-word entry constants */
1394 #define SM_RUN_ENCODE(x) BF64_ENCODE((x) - 1, 0, SM_RUN_BITS)
1399 #define SM2_RUN_ENCODE(x) BF64_ENCODE((x) - 1, 24, SM2_RUN_BITS)
1460 * The ds_fsid_guid is a 56-bit ID that can change to avoid
1461 * collisions. The ds_guid is a 64-bit ID that will never
1521 #define FZAP_BLOCK_SHIFT(zap) ((zap)->zap_block_shift)
1523 #define ZAP_MAXCD (uint32_t)(-1)
1527 ((MZAP_MAX_BLKSZ - sizeof(mzap_phys_t)) / sizeof(mzap_ent_phys_t) + 1)
1528 #define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2)
1565 * the embedded pointer table takes up half a block:
1568 #define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
1571 * The embedded pointer table starts half-way through the block. Since
1572 * the pointer table itself is half the block, it starts at (64-bit)
1576 ((uint64_t *)(zap)->zap_phys) \
1579 #define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n))))
1604 * This structure is followed by padding, and then the embedded
1605 * pointer table. The embedded pointer table takes up second
1628 * block size (1<<l->l_bs) - hash entry size (2) * number of hash
1629 * entries - header space (2*chunksize)
1632 (((1<<(l)->l_bs) - 2*ZAP_LEAF_HASH_NUMENTRIES(l)) / \
1633 ZAP_LEAF_CHUNKSIZE - 2)
1637 * chunk size - space for type (1) - space for next pointer (2)
1639 #define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3)
1642 (((bytes)+ZAP_LEAF_ARRAY_BYTES-1)/ZAP_LEAF_ARRAY_BYTES)
1647 * "reasonably-sized" entry. 20 chunks is more than enough for the
1648 * largest directory entry (MAXNAMELEN (256) byte name, 8-byte value),
1659 #define ZAP_LEAF_HASH_SHIFT(l) ((l)->l_bs - 5)
1669 ((l)->l_phys->l_hash + ZAP_LEAF_HASH_NUMENTRIES(l)))[idx]
1673 ((ZAP_LEAF_HASH_NUMENTRIES(l)-1) & \
1675 (64 - ZAP_LEAF_HASH_SHIFT(l) - (l)->l_phys->l_hdr.lh_prefix_len)))
1676 #define ZAP_LEAF_HASH_ENTPTR(l, h) (&(l)->l_phys->l_hash[ZAP_LEAF_HASH(l, h)])
1703 } l_hdr; /* 2 24-byte chunks */
1836 * ZPL version - rev'd whenever an incompatible on-disk format change
1874 uint64_t zp_atime[2]; /* 0 - last file access time */
1875 uint64_t zp_mtime[2]; /* 16 - last file modification time */
1876 uint64_t zp_ctime[2]; /* 32 - last file change time */
1877 uint64_t zp_crtime[2]; /* 48 - creation time */
1878 uint64_t zp_gen; /* 64 - generation (txg of creation) */
1879 uint64_t zp_mode; /* 72 - file mode bits */
1880 uint64_t zp_size; /* 80 - size of file */
1881 uint64_t zp_parent; /* 88 - directory parent (`..') */
1882 uint64_t zp_links; /* 96 - number of links to file */
1883 uint64_t zp_xattr; /* 104 - DMU object for xattrs */
1884 uint64_t zp_rdev; /* 112 - dev_t for VBLK & VCHR files */
1885 uint64_t zp_flags; /* 120 - persistent flags */
1886 uint64_t zp_uid; /* 128 - file owner */
1887 uint64_t zp_gid; /* 136 - owning group */
1888 uint64_t zp_pad[4]; /* 144 - future */
1889 zfs_znode_acl_t zp_acl; /* 176 - 263 ACL */
1893 * |<---------------------- dnode_phys (512) ------------------------>|
1894 * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->|
1895 * |<---- znode (264) ---->|<---- data (56) ---->|
1902 * In-core vdev representation.
1917 * the one-bit "mark", used for garbage collection (by zdb)
1929 BF64_GET_SB((vimep)->vimep_src, 0, 63, SPA_MINBLOCKSHIFT, 0)
1931 BF64_SET_SB((vimep)->vimep_src, 0, 63, SPA_MINBLOCKSHIFT, 0, x)
1978 * On-disk indirect vdev state.
2044 * In-core pool representation.