HomeFreeBSD

Refactor arc_hdr_realloc_crypt()

Description

Refactor arc_hdr_realloc_crypt()

The arc_hdr_realloc_crypt() function is responsible for converting
a "full" arc header to an extended "crypt" header and visa versa.
This code was originally written with a bcopy() so that any new
members added to arc headers would automatically be included
without requiring a code change. However, in practice this (along
with small differences in kmem_cache implementations between
various platforms) has caused a number of hard-to-find problems in
ports to other operating systems. This patch solves this problem
by making all member copies explicit and adding ASSERTs for fields
that cannot be set during the transfer. It also manually resets the
old header after the reallocation is finished so it can be properly
reallocated and reused.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #7711

Details

Provenance
Tom Caputi <tcaputi@datto.com>Authored on Jul 24 2018, 7:20 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jul 24 2018, 7:20 PM
Parents
rG863522b1f923: dsl_scan_scrub_cb: don't double-account non-embedded blocks
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGb7ddeaef3dee: Refactor arc_hdr_realloc_crypt() (authored by Tom Caputi <tcaputi@datto.com>).Jul 24 2018, 7:20 PM