Lines Matching defs:checksum

39  * In the SPA, everything is checksummed.  We support checksum vectors
43 * For SPA metadata, we always want a very strong checksum.
45 * and checksum strength.
56 * Of course, we don't want a checksum upgrade to invalidate existing
57 * data, so we store the checksum *function* in eight bits of the bp.
58 * This gives us room for up to 256 different checksum functions.
60 * When writing a block, we always checksum it with the latest-and-greatest
61 * checksum function of the appropriate strength. When reading a block,
62 * we compare the expected checksum against the actual checksum, which we
63 * compute via the checksum function specified by BP_GET_CHECKSUM(bp).
69 * checksum is fed both a random 256-bit value (the salt) and the data
85 * a checksum algorithm to do the work once (the first time it's used)
89 * construct and destruct the pre-initialized checksum context. The
90 * pre-initialized context is then reused during each checksum
91 * invocation and passed to the checksum function.
211 * The flag corresponding to the "verify" in dedup=[checksum,]verify
300 * Calls the template init function of a checksum which supports context
304 zio_checksum_template_init(enum zio_checksum checksum, spa_t *spa)
306 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
310 if (spa->spa_cksum_tmpls[checksum] != NULL)
315 if (spa->spa_cksum_tmpls[checksum] == NULL) {
316 spa->spa_cksum_tmpls[checksum] =
318 VERIFY(spa->spa_cksum_tmpls[checksum] != NULL);
323 /* convenience function to update a checksum to accommodate an encryption MAC */
329 * across the bits of the checksum. Therefore, when truncating
330 * a weak checksum we XOR the first 2 words with the last 2 so
343 * Generate the checksum.
346 zio_checksum_compute(zio_t *zio, enum zio_checksum checksum,
352 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
357 ASSERT((uint_t)checksum < ZIO_CHECKSUM_FUNCTIONS);
360 zio_checksum_template_init(checksum, spa);
368 if (checksum == ZIO_CHECKSUM_ZILOG2) {
385 if (checksum == ZIO_CHECKSUM_GANG_HEADER) {
387 } else if (checksum == ZIO_CHECKSUM_LABEL) {
401 ci->ci_func[0](abd, size, spa->spa_cksum_tmpls[checksum],
412 ci->ci_func[0](abd, size, spa->spa_cksum_tmpls[checksum],
422 enum zio_checksum checksum, abd_t *abd, uint64_t size, uint64_t offset,
425 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
430 if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL)
433 zio_checksum_template_init(checksum, spa);
436 IMPLY(bp == NULL, checksum == ZIO_CHECKSUM_LABEL);
442 if (checksum == ZIO_CHECKSUM_ZILOG2) {
473 if (checksum == ZIO_CHECKSUM_GANG_HEADER)
475 else if (checksum == ZIO_CHECKSUM_LABEL)
491 spa->spa_cksum_tmpls[checksum], &actual_cksum);
504 spa->spa_cksum_tmpls[checksum], &actual_cksum);
508 * MAC checksums are a special case since half of this checksum will
510 * decryption process, so we just check the truncated checksum now.
511 * Objset blocks use embedded MACs so we don't truncate the checksum
544 uint_t checksum = (bp == NULL ? zio->io_prop.zp_checksum :
553 error = zio_checksum_error_impl(spa, bp, checksum, data, size,
567 * all of the checksum context templates and deallocates any that were
573 for (enum zio_checksum checksum = 0;
574 checksum < ZIO_CHECKSUM_FUNCTIONS; checksum++) {
575 if (spa->spa_cksum_tmpls[checksum] != NULL) {
576 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
579 ci->ci_tmpl_free(spa->spa_cksum_tmpls[checksum]);
580 spa->spa_cksum_tmpls[checksum] = NULL;