FreeBSD/sys/cddl/boot/zfs/zfssubr.c
/*
 * Generate the parity from the data columns. If we tried and were able to
 * read the parity without error, verify that the generated parity matches the
 * data we read. If it doesn't, we fire off a checksum error. Return the
 * number such failures.
 */
Generate the parity from the data columns. If we tried and were able to
read the parity without error, verify that the generated parity matches the
data we read. If it doesn't, we fire off a checksum error. Return the
number such failures.
Generate the parity from the data columns . If we tried and were able to read the parity without error verify that the generated parity matches the data we read . If it doesn ' t we fire off a checksum error . Return the number such failures .
static int
raidz_parity_verify(raidz_map_t *rm)
{
	void *orig[VDEV_RAIDZ_MAXPARITY];
	int c, ret = 0;
	raidz_col_t *rc;
	for (c = 0; c < rm->rm_firstdatacol; c++) {
		rc = &rm->rm_col[c];
		if (!rc->rc_tried || rc->rc_error != 0)
			continue;
		orig[c] = zfs_alloc(rc->rc_size);
		bcopy(rc->rc_data, orig[c], rc->rc_size);
	}
	vdev_raidz_generate_parity(rm);
	for (c = rm->rm_firstdatacol - 1; c >= 0; c--) {
		rc = &rm->rm_col[c];
		if (!rc->rc_tried || rc->rc_error != 0)
			continue;
		if (bcmp(orig[c], rc->rc_data, rc->rc_size) != 0) {
			rc->rc_error = ECKSUM;
			ret++;
		}
		zfs_free(orig[c], rc->rc_size);
	}
	return (ret);
}
static int raidz_parity_verify ( raidz_map_t * rm ) { void * orig [ VDEV_RAIDZ_MAXPARITY ] ; int c , ret = 0 ; raidz_col_t * rc ; for ( c = 0 ; c < rm -> rm_firstdatacol ; c ++ ) { rc = & rm -> rm_col [ c ] ; if ( ! rc -> rc_tried || rc -> rc_error != 0 ) continue ; orig [ c ] = zfs_alloc ( rc -> rc_size ) ; bcopy ( rc -> rc_data , orig [ c ] , rc -> rc_size ) ; } vdev_raidz_generate_parity ( rm ) ; for ( c = rm -> rm_firstdatacol - 1 ; c >= 0 ; c -- ) { rc = & rm -> rm_col [ c ] ; if ( ! rc -> rc_tried || rc -> rc_error != 0 ) continue ; if ( bcmp ( orig [ c ] , rc -> rc_data , rc -> rc_size ) != 0 ) { rc -> rc_error = ECKSUM ; ret ++ ; } zfs_free ( orig [ c ] , rc -> rc_size ) ; } return ( ret ) ; }
Generate the parity from the data columns.
Generate the parity from the data columns .