Lines Matching refs:bp

345 #define	BPE_GET_ETYPE(bp)	\  argument
346 (ASSERT(BP_IS_EMBEDDED(bp)), \
347 BF64_GET((bp)->blk_prop, 40, 8))
348 #define BPE_SET_ETYPE(bp, t) do { \ argument
349 ASSERT(BP_IS_EMBEDDED(bp)); \
350 BF64_SET((bp)->blk_prop, 40, 8, t); \
353 #define BPE_GET_LSIZE(bp) \ argument
354 (ASSERT(BP_IS_EMBEDDED(bp)), \
355 BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1))
356 #define BPE_SET_LSIZE(bp, x) do { \ argument
357 ASSERT(BP_IS_EMBEDDED(bp)); \
358 BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \
361 #define BPE_GET_PSIZE(bp) \ argument
362 (ASSERT(BP_IS_EMBEDDED(bp)), \
363 BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1))
364 #define BPE_SET_PSIZE(bp, x) do { \ argument
365 ASSERT(BP_IS_EMBEDDED(bp)); \
366 BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \
377 #define BPE_IS_PAYLOADWORD(bp, wp) \ argument
378 ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
427 #define BP_GET_LSIZE(bp) \ argument
428 (BP_IS_EMBEDDED(bp) ? \
429 (BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA ? BPE_GET_LSIZE(bp) : 0): \
430 BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1))
431 #define BP_SET_LSIZE(bp, x) do { \ argument
432 ASSERT(!BP_IS_EMBEDDED(bp)); \
433 BF64_SET_SB((bp)->blk_prop, \
437 #define BP_GET_PSIZE(bp) \ argument
438 (BP_IS_EMBEDDED(bp) ? 0 : \
439 BF64_GET_SB((bp)->blk_prop, 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1))
440 #define BP_SET_PSIZE(bp, x) do { \ argument
441 ASSERT(!BP_IS_EMBEDDED(bp)); \
442 BF64_SET_SB((bp)->blk_prop, \
446 #define BP_GET_COMPRESS(bp) \ argument
447 BF64_GET((bp)->blk_prop, 32, SPA_COMPRESSBITS)
448 #define BP_SET_COMPRESS(bp, x) \ argument
449 BF64_SET((bp)->blk_prop, 32, SPA_COMPRESSBITS, x)
451 #define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1) argument
452 #define BP_SET_EMBEDDED(bp, x) BF64_SET((bp)->blk_prop, 39, 1, x) argument
454 #define BP_GET_CHECKSUM(bp) \ argument
455 (BP_IS_EMBEDDED(bp) ? ZIO_CHECKSUM_OFF : \
456 BF64_GET((bp)->blk_prop, 40, 8))
457 #define BP_SET_CHECKSUM(bp, x) do { \ argument
458 ASSERT(!BP_IS_EMBEDDED(bp)); \
459 BF64_SET((bp)->blk_prop, 40, 8, x); \
462 #define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) argument
463 #define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) argument
465 #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) argument
466 #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) argument
469 #define BP_USES_CRYPT(bp) BF64_GET((bp)->blk_prop, 61, 1) argument
470 #define BP_SET_CRYPT(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x) argument
472 #define BP_IS_ENCRYPTED(bp) \ argument
473 (BP_USES_CRYPT(bp) && \
474 BP_GET_LEVEL(bp) == 0 && \
475 DMU_OT_IS_ENCRYPTED(BP_GET_TYPE(bp)))
477 #define BP_IS_AUTHENTICATED(bp) \ argument
478 (BP_USES_CRYPT(bp) && \
479 BP_GET_LEVEL(bp) == 0 && \
480 !DMU_OT_IS_ENCRYPTED(BP_GET_TYPE(bp)))
482 #define BP_HAS_INDIRECT_MAC_CKSUM(bp) \ argument
483 (BP_USES_CRYPT(bp) && BP_GET_LEVEL(bp) > 0)
485 #define BP_IS_PROTECTED(bp) \ argument
486 (BP_IS_ENCRYPTED(bp) || BP_IS_AUTHENTICATED(bp))
488 #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1) argument
489 #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x) argument
491 #define BP_GET_BYTEORDER(bp) BF64_GET((bp)->blk_prop, 63, 1) argument
492 #define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) argument
494 #define BP_PHYSICAL_BIRTH(bp) \ argument
495 (BP_IS_EMBEDDED(bp) ? 0 : \
496 (bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
498 #define BP_SET_BIRTH(bp, logical, physical) \ argument
500 ASSERT(!BP_IS_EMBEDDED(bp)); \
501 (bp)->blk_birth = (logical); \
502 (bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
505 #define BP_GET_FILL(bp) \ argument
506 ((BP_IS_ENCRYPTED(bp)) ? BF64_GET((bp)->blk_fill, 0, 32) : \
507 ((BP_IS_EMBEDDED(bp)) ? 1 : (bp)->blk_fill))
509 #define BP_SET_FILL(bp, fill) \ argument
511 if (BP_IS_ENCRYPTED(bp)) \
512 BF64_SET((bp)->blk_fill, 0, 32, fill); \
514 (bp)->blk_fill = fill; \
517 #define BP_GET_IV2(bp) \ argument
518 (ASSERT(BP_IS_ENCRYPTED(bp)), \
519 BF64_GET((bp)->blk_fill, 32, 32))
520 #define BP_SET_IV2(bp, iv2) \ argument
522 ASSERT(BP_IS_ENCRYPTED(bp)); \
523 BF64_SET((bp)->blk_fill, 32, 32, iv2); \
526 #define BP_IS_METADATA(bp) \ argument
527 (BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))
529 #define BP_GET_ASIZE(bp) \ argument
530 (BP_IS_EMBEDDED(bp) ? 0 : \
531 DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
532 DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
533 (DVA_GET_ASIZE(&(bp)->blk_dva[2]) * !BP_IS_ENCRYPTED(bp)))
535 #define BP_GET_UCSIZE(bp) \ argument
536 (BP_IS_METADATA(bp) ? BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp))
538 #define BP_GET_NDVAS(bp) \ argument
539 (BP_IS_EMBEDDED(bp) ? 0 : \
540 !!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
541 !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
542 (!!DVA_GET_ASIZE(&(bp)->blk_dva[2]) * !BP_IS_ENCRYPTED(bp)))
544 #define BP_COUNT_GANG(bp) \ argument
545 (BP_IS_EMBEDDED(bp) ? 0 : \
546 (DVA_GET_GANG(&(bp)->blk_dva[0]) + \
547 DVA_GET_GANG(&(bp)->blk_dva[1]) + \
548 (DVA_GET_GANG(&(bp)->blk_dva[2]) * !BP_IS_ENCRYPTED(bp))))
594 #define BP_IDENTITY(bp) (ASSERT(!BP_IS_EMBEDDED(bp)), &(bp)->blk_dva[0]) argument
595 #define BP_IS_GANG(bp) \ argument
596 (BP_IS_EMBEDDED(bp) ? B_FALSE : DVA_GET_GANG(BP_IDENTITY(bp)))
599 #define BP_IS_HOLE(bp) \ argument
600 (!BP_IS_EMBEDDED(bp) && DVA_IS_EMPTY(BP_IDENTITY(bp)))
603 #define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \ argument
604 BP_GET_PSIZE(bp))
606 #define BP_ZERO(bp) \ argument
608 (bp)->blk_dva[0].dva_word[0] = 0; \
609 (bp)->blk_dva[0].dva_word[1] = 0; \
610 (bp)->blk_dva[1].dva_word[0] = 0; \
611 (bp)->blk_dva[1].dva_word[1] = 0; \
612 (bp)->blk_dva[2].dva_word[0] = 0; \
613 (bp)->blk_dva[2].dva_word[1] = 0; \
614 (bp)->blk_prop = 0; \
615 (bp)->blk_pad[0] = 0; \
616 (bp)->blk_pad[1] = 0; \
617 (bp)->blk_phys_birth = 0; \
618 (bp)->blk_birth = 0; \
619 (bp)->blk_fill = 0; \
620 ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
629 #define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) argument
638 #define SNPRINTF_BLKPTR(func, ws, buf, size, bp, type, checksum, compress) \ argument
645 if (bp != NULL) { \
646 if (BP_IS_ENCRYPTED(bp)) { \
648 } else if (BP_IS_AUTHENTICATED(bp)) { \
650 } else if (BP_HAS_INDIRECT_MAC_CKSUM(bp)) { \
656 if (bp == NULL) { \
658 } else if (BP_IS_HOLE(bp)) { \
662 (u_longlong_t)BP_GET_LEVEL(bp), \
664 (u_longlong_t)BP_GET_LSIZE(bp), \
665 (u_longlong_t)bp->blk_birth); \
666 } else if (BP_IS_EMBEDDED(bp)) { \
670 (u_longlong_t)BP_GET_LEVEL(bp), \
672 (int)BPE_GET_ETYPE(bp), \
674 (u_longlong_t)BPE_GET_LSIZE(bp), \
675 (u_longlong_t)BPE_GET_PSIZE(bp), \
676 (u_longlong_t)bp->blk_birth); \
678 for (int d = 0; d < BP_GET_NDVAS(bp); d++) { \
679 const dva_t *dva = &bp->blk_dva[d]; \
689 if (BP_IS_ENCRYPTED(bp)) { \
692 (u_longlong_t)bp->blk_dva[2].dva_word[0], \
693 (u_longlong_t)bp->blk_dva[2].dva_word[1], \
694 (u_longlong_t)BP_GET_IV2(bp), \
697 if (BP_IS_GANG(bp) && \
698 DVA_GET_ASIZE(&bp->blk_dva[2]) <= \
699 DVA_GET_ASIZE(&bp->blk_dva[1]) / 2) \
705 (u_longlong_t)BP_GET_LEVEL(bp), \
710 BP_GET_BYTEORDER(bp) == 0 ? "BE" : "LE", \
711 BP_IS_GANG(bp) ? "gang" : "contiguous", \
712 BP_GET_DEDUP(bp) ? "dedup" : "unique", \
715 (u_longlong_t)BP_GET_LSIZE(bp), \
716 (u_longlong_t)BP_GET_PSIZE(bp), \
717 (u_longlong_t)bp->blk_birth, \
718 (u_longlong_t)BP_PHYSICAL_BIRTH(bp), \
719 (u_longlong_t)BP_GET_FILL(bp), \
721 (u_longlong_t)bp->blk_cksum.zc_word[0], \
722 (u_longlong_t)bp->blk_cksum.zc_word[1], \
723 (u_longlong_t)bp->blk_cksum.zc_word[2], \
724 (u_longlong_t)bp->blk_cksum.zc_word[3]); \
729 #define BP_GET_BUFC_TYPE(bp) \ argument
730 (BP_IS_METADATA(bp) ? ARC_BUFC_METADATA : ARC_BUFC_DATA)
951 extern void spa_set_rootblkptr(spa_t *spa, const blkptr_t *bp);
1007 extern void snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp);
1016 extern uint64_t bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp);
1017 extern uint64_t bp_get_dsize(spa_t *spa, const blkptr_t *bp);
1030 extern void zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp);
1032 const blkptr_t *bp);
1035 extern boolean_t spa_remap_blkptr(spa_t *spa, blkptr_t *bp,
1110 #define dprintf_bp(bp, fmt, ...) do { \ argument
1113 snprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, (bp)); \
1119 #define dprintf_bp(bp, fmt, ...) argument