Lines Matching refs:bp
340 #define BPE_GET_ETYPE(bp) \ argument
341 (ASSERT(BP_IS_EMBEDDED(bp)), \
342 BF64_GET((bp)->blk_prop, 40, 8))
343 #define BPE_SET_ETYPE(bp, t) do { \ argument
344 ASSERT(BP_IS_EMBEDDED(bp)); \
345 BF64_SET((bp)->blk_prop, 40, 8, t); \
348 #define BPE_GET_LSIZE(bp) \ argument
349 (ASSERT(BP_IS_EMBEDDED(bp)), \
350 BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1))
351 #define BPE_SET_LSIZE(bp, x) do { \ argument
352 ASSERT(BP_IS_EMBEDDED(bp)); \
353 BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \
356 #define BPE_GET_PSIZE(bp) \ argument
357 (ASSERT(BP_IS_EMBEDDED(bp)), \
358 BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1))
359 #define BPE_SET_PSIZE(bp, x) do { \ argument
360 ASSERT(BP_IS_EMBEDDED(bp)); \
361 BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \
372 #define BPE_IS_PAYLOADWORD(bp, wp) \ argument
373 ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
422 #define BP_GET_LSIZE(bp) \ argument
423 (BP_IS_EMBEDDED(bp) ? \
424 (BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA ? BPE_GET_LSIZE(bp) : 0): \
425 BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1))
426 #define BP_SET_LSIZE(bp, x) do { \ argument
427 ASSERT(!BP_IS_EMBEDDED(bp)); \
428 BF64_SET_SB((bp)->blk_prop, \
432 #define BP_GET_PSIZE(bp) \ argument
433 (BP_IS_EMBEDDED(bp) ? 0 : \
434 BF64_GET_SB((bp)->blk_prop, 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1))
435 #define BP_SET_PSIZE(bp, x) do { \ argument
436 ASSERT(!BP_IS_EMBEDDED(bp)); \
437 BF64_SET_SB((bp)->blk_prop, \
441 #define BP_GET_COMPRESS(bp) \ argument
442 BF64_GET((bp)->blk_prop, 32, SPA_COMPRESSBITS)
443 #define BP_SET_COMPRESS(bp, x) \ argument
444 BF64_SET((bp)->blk_prop, 32, SPA_COMPRESSBITS, x)
446 #define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1) argument
447 #define BP_SET_EMBEDDED(bp, x) BF64_SET((bp)->blk_prop, 39, 1, x) argument
449 #define BP_GET_CHECKSUM(bp) \ argument
450 (BP_IS_EMBEDDED(bp) ? ZIO_CHECKSUM_OFF : \
451 BF64_GET((bp)->blk_prop, 40, 8))
452 #define BP_SET_CHECKSUM(bp, x) do { \ argument
453 ASSERT(!BP_IS_EMBEDDED(bp)); \
454 BF64_SET((bp)->blk_prop, 40, 8, x); \
457 #define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) argument
458 #define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) argument
460 #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) argument
461 #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) argument
464 #define BP_USES_CRYPT(bp) BF64_GET((bp)->blk_prop, 61, 1) argument
465 #define BP_SET_CRYPT(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x) argument
467 #define BP_IS_ENCRYPTED(bp) \ argument
468 (BP_USES_CRYPT(bp) && \
469 BP_GET_LEVEL(bp) == 0 && \
470 DMU_OT_IS_ENCRYPTED(BP_GET_TYPE(bp)))
472 #define BP_IS_AUTHENTICATED(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_HAS_INDIRECT_MAC_CKSUM(bp) \ argument
478 (BP_USES_CRYPT(bp) && BP_GET_LEVEL(bp) > 0)
480 #define BP_IS_PROTECTED(bp) \ argument
481 (BP_IS_ENCRYPTED(bp) || BP_IS_AUTHENTICATED(bp))
483 #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1) argument
484 #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x) argument
486 #define BP_GET_BYTEORDER(bp) BF64_GET((bp)->blk_prop, 63, 1) argument
487 #define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) argument
489 #define BP_PHYSICAL_BIRTH(bp) \ argument
490 (BP_IS_EMBEDDED(bp) ? 0 : \
491 (bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
493 #define BP_SET_BIRTH(bp, logical, physical) \ argument
495 ASSERT(!BP_IS_EMBEDDED(bp)); \
496 (bp)->blk_birth = (logical); \
497 (bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
500 #define BP_GET_FILL(bp) \ argument
501 ((BP_IS_ENCRYPTED(bp)) ? BF64_GET((bp)->blk_fill, 0, 32) : \
502 ((BP_IS_EMBEDDED(bp)) ? 1 : (bp)->blk_fill))
504 #define BP_SET_FILL(bp, fill) \ argument
506 if (BP_IS_ENCRYPTED(bp)) \
507 BF64_SET((bp)->blk_fill, 0, 32, fill); \
509 (bp)->blk_fill = fill; \
512 #define BP_GET_IV2(bp) \ argument
513 (ASSERT(BP_IS_ENCRYPTED(bp)), \
514 BF64_GET((bp)->blk_fill, 32, 32))
515 #define BP_SET_IV2(bp, iv2) \ argument
517 ASSERT(BP_IS_ENCRYPTED(bp)); \
518 BF64_SET((bp)->blk_fill, 32, 32, iv2); \
521 #define BP_IS_METADATA(bp) \ argument
522 (BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))
524 #define BP_GET_ASIZE(bp) \ argument
525 (BP_IS_EMBEDDED(bp) ? 0 : \
526 DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
527 DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
528 (DVA_GET_ASIZE(&(bp)->blk_dva[2]) * !BP_IS_ENCRYPTED(bp)))
530 #define BP_GET_UCSIZE(bp) \ argument
531 (BP_IS_METADATA(bp) ? BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp))
533 #define BP_GET_NDVAS(bp) \ argument
534 (BP_IS_EMBEDDED(bp) ? 0 : \
535 !!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
536 !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
537 (!!DVA_GET_ASIZE(&(bp)->blk_dva[2]) * !BP_IS_ENCRYPTED(bp)))
539 #define BP_COUNT_GANG(bp) \ argument
540 (BP_IS_EMBEDDED(bp) ? 0 : \
541 (DVA_GET_GANG(&(bp)->blk_dva[0]) + \
542 DVA_GET_GANG(&(bp)->blk_dva[1]) + \
543 (DVA_GET_GANG(&(bp)->blk_dva[2]) * !BP_IS_ENCRYPTED(bp))))
558 #define BP_IDENTITY(bp) (ASSERT(!BP_IS_EMBEDDED(bp)), &(bp)->blk_dva[0]) argument
559 #define BP_IS_GANG(bp) \ argument
560 (BP_IS_EMBEDDED(bp) ? B_FALSE : DVA_GET_GANG(BP_IDENTITY(bp)))
563 #define BP_IS_HOLE(bp) \ argument
564 (!BP_IS_EMBEDDED(bp) && DVA_IS_EMPTY(BP_IDENTITY(bp)))
567 #define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \ argument
568 BP_GET_PSIZE(bp))
570 #define BP_ZERO(bp) \ argument
572 (bp)->blk_dva[0].dva_word[0] = 0; \
573 (bp)->blk_dva[0].dva_word[1] = 0; \
574 (bp)->blk_dva[1].dva_word[0] = 0; \
575 (bp)->blk_dva[1].dva_word[1] = 0; \
576 (bp)->blk_dva[2].dva_word[0] = 0; \
577 (bp)->blk_dva[2].dva_word[1] = 0; \
578 (bp)->blk_prop = 0; \
579 (bp)->blk_pad[0] = 0; \
580 (bp)->blk_pad[1] = 0; \
581 (bp)->blk_phys_birth = 0; \
582 (bp)->blk_birth = 0; \
583 (bp)->blk_fill = 0; \
584 ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
593 #define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) argument
602 #define SNPRINTF_BLKPTR(func, ws, buf, size, bp, type, checksum, compress) \ argument
609 if (bp != NULL) { \
610 if (BP_IS_ENCRYPTED(bp)) { \
612 } else if (BP_IS_AUTHENTICATED(bp)) { \
614 } else if (BP_HAS_INDIRECT_MAC_CKSUM(bp)) { \
620 if (bp == NULL) { \
622 } else if (BP_IS_HOLE(bp)) { \
626 (u_longlong_t)BP_GET_LEVEL(bp), \
628 (u_longlong_t)BP_GET_LSIZE(bp), \
629 (u_longlong_t)bp->blk_birth); \
630 } else if (BP_IS_EMBEDDED(bp)) { \
634 (u_longlong_t)BP_GET_LEVEL(bp), \
636 (int)BPE_GET_ETYPE(bp), \
638 (u_longlong_t)BPE_GET_LSIZE(bp), \
639 (u_longlong_t)BPE_GET_PSIZE(bp), \
640 (u_longlong_t)bp->blk_birth); \
642 for (int d = 0; d < BP_GET_NDVAS(bp); d++) { \
643 const dva_t *dva = &bp->blk_dva[d]; \
653 if (BP_IS_ENCRYPTED(bp)) { \
656 (u_longlong_t)bp->blk_dva[2].dva_word[0], \
657 (u_longlong_t)bp->blk_dva[2].dva_word[1], \
658 (u_longlong_t)BP_GET_IV2(bp), \
661 if (BP_IS_GANG(bp) && \
662 DVA_GET_ASIZE(&bp->blk_dva[2]) <= \
663 DVA_GET_ASIZE(&bp->blk_dva[1]) / 2) \
669 (u_longlong_t)BP_GET_LEVEL(bp), \
674 BP_GET_BYTEORDER(bp) == 0 ? "BE" : "LE", \
675 BP_IS_GANG(bp) ? "gang" : "contiguous", \
676 BP_GET_DEDUP(bp) ? "dedup" : "unique", \
679 (u_longlong_t)BP_GET_LSIZE(bp), \
680 (u_longlong_t)BP_GET_PSIZE(bp), \
681 (u_longlong_t)bp->blk_birth, \
682 (u_longlong_t)BP_PHYSICAL_BIRTH(bp), \
683 (u_longlong_t)BP_GET_FILL(bp), \
685 (u_longlong_t)bp->blk_cksum.zc_word[0], \
686 (u_longlong_t)bp->blk_cksum.zc_word[1], \
687 (u_longlong_t)bp->blk_cksum.zc_word[2], \
688 (u_longlong_t)bp->blk_cksum.zc_word[3]); \
693 #define BP_GET_BUFC_TYPE(bp) \ argument
694 (BP_IS_METADATA(bp) ? ARC_BUFC_METADATA : ARC_BUFC_DATA)
915 extern void spa_set_rootblkptr(spa_t *spa, const blkptr_t *bp);
971 extern void snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp);
980 extern uint64_t bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp);
981 extern uint64_t bp_get_dsize(spa_t *spa, const blkptr_t *bp);
994 extern void zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp);
996 const blkptr_t *bp);
999 extern boolean_t spa_remap_blkptr(spa_t *spa, blkptr_t *bp,
1074 #define dprintf_bp(bp, fmt, ...) do { \ argument
1077 snprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, (bp)); \
1083 #define dprintf_bp(bp, fmt, ...) argument