diff options
author | pjd <pjd@FreeBSD.org> | 2011-10-20 15:42:38 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-10-20 15:42:38 +0000 |
commit | 57635fa52e9f95b6a653902df3016f529eecafed (patch) | |
tree | 34bb2766b10bb39c5ddb972e29c822c9b1a3e318 /sys/cddl/boot/zfs/zfssubr.c | |
parent | 7277eaaa56b5b705b2fa4c0c088241743754e1e8 (diff) | |
download | FreeBSD-src-57635fa52e9f95b6a653902df3016f529eecafed.zip FreeBSD-src-57635fa52e9f95b6a653902df3016f529eecafed.tar.gz |
- Correctly read gang header from raidz.
- Decompress assembled gang block data if compressed.
- Verify checksum of a gang header.
- Verify checksum of assembled gang block data.
- Verify checksum of uber block.
Submitted by: avg
MFC after: 3 days
Diffstat (limited to 'sys/cddl/boot/zfs/zfssubr.c')
-rw-r--r-- | sys/cddl/boot/zfs/zfssubr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/cddl/boot/zfs/zfssubr.c b/sys/cddl/boot/zfs/zfssubr.c index 49cb025..b2d2e13 100644 --- a/sys/cddl/boot/zfs/zfssubr.c +++ b/sys/cddl/boot/zfs/zfssubr.c @@ -181,14 +181,17 @@ zio_checksum_label_verifier(zio_cksum_t *zcp, uint64_t offset) } static int -zio_checksum_verify(const blkptr_t *bp, void *data, uint64_t offset, - uint64_t size) +zio_checksum_verify(const blkptr_t *bp, void *data) { - unsigned int checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : BP_GET_CHECKSUM(bp); + uint64_t size; + unsigned int checksum; zio_checksum_info_t *ci; zio_cksum_t actual_cksum, expected_cksum, verifier; int byteswap; + checksum = BP_GET_CHECKSUM(bp); + size = BP_GET_PSIZE(bp); + if (checksum >= ZIO_CHECKSUM_FUNCTIONS) return (EINVAL); ci = &zio_checksum_table[checksum]; @@ -206,7 +209,8 @@ zio_checksum_verify(const blkptr_t *bp, void *data, uint64_t offset, if (checksum == ZIO_CHECKSUM_GANG_HEADER) zio_checksum_gang_verifier(&verifier, bp); else if (checksum == ZIO_CHECKSUM_LABEL) - zio_checksum_label_verifier(&verifier, offset); + zio_checksum_label_verifier(&verifier, + DVA_GET_OFFSET(BP_IDENTITY(bp))); else verifier = bp->blk_cksum; @@ -224,7 +228,6 @@ zio_checksum_verify(const blkptr_t *bp, void *data, uint64_t offset, byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t)); } else { - ASSERT(!BP_IS_GANG(bp)); expected_cksum = bp->blk_cksum; ci->ci_func[0](data, size, &actual_cksum); } @@ -1243,7 +1246,7 @@ static int raidz_checksum_verify(const blkptr_t *bp, void *data, uint64_t size) { - return (zio_checksum_verify(bp, data, 0, size)); + return (zio_checksum_verify(bp, data)); } /* |