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.
140 * The flag corresponding to the "verify" in dedup=[checksum,]verify
226 * Calls the template init function of a checksum which supports context
230 zio_checksum_template_init(enum zio_checksum checksum, spa_t *spa)
232 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
236 if (spa->spa_cksum_tmpls[checksum] != NULL)
241 if (spa->spa_cksum_tmpls[checksum] == NULL) {
242 spa->spa_cksum_tmpls[checksum] =
244 VERIFY(spa->spa_cksum_tmpls[checksum] != NULL);
250 * Generate the checksum.
253 zio_checksum_compute(zio_t *zio, enum zio_checksum checksum,
258 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
262 ASSERT((uint_t)checksum < ZIO_CHECKSUM_FUNCTIONS);
265 zio_checksum_template_init(checksum, spa);
270 if (checksum == ZIO_CHECKSUM_ZILOG2) {
279 if (checksum == ZIO_CHECKSUM_GANG_HEADER)
281 else if (checksum == ZIO_CHECKSUM_LABEL)
286 ci->ci_func[0](data, size, spa->spa_cksum_tmpls[checksum],
290 ci->ci_func[0](data, size, spa->spa_cksum_tmpls[checksum],
296 zio_checksum_error_impl(spa_t *spa, blkptr_t *bp, enum zio_checksum checksum,
299 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
303 if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL)
306 zio_checksum_template_init(checksum, spa);
312 if (checksum == ZIO_CHECKSUM_ZILOG2) {
332 if (checksum == ZIO_CHECKSUM_GANG_HEADER)
334 else if (checksum == ZIO_CHECKSUM_LABEL)
347 spa->spa_cksum_tmpls[checksum], &actual_cksum);
358 spa->spa_cksum_tmpls[checksum], &actual_cksum);
380 uint_t checksum = (bp == NULL ? zio->io_prop.zp_checksum :
389 error = zio_checksum_error_impl(spa, bp, checksum, data, size,
403 * all of the checksum context templates and deallocates any that were
409 for (enum zio_checksum checksum = 0;
410 checksum < ZIO_CHECKSUM_FUNCTIONS; checksum++) {
411 if (spa->spa_cksum_tmpls[checksum] != NULL) {
412 zio_checksum_info_t *ci = &zio_checksum_table[checksum];
415 ci->ci_tmpl_free(spa->spa_cksum_tmpls[checksum]);
416 spa->spa_cksum_tmpls[checksum] = NULL;