]> granicus.if.org Git - zfs/commit
Refactor arc_hdr_realloc_crypt()
authorTom Caputi <tcaputi@datto.com>
Tue, 24 Jul 2018 19:20:04 +0000 (15:20 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 24 Jul 2018 19:20:04 +0000 (12:20 -0700)
commitb7ddeaef3dee6b12f22f67cef184590b5a3f10ed
tree0dd947202f627714636e53963ddc069d00ffa7f0
parent863522b1f9235398f6c28ee3ab96f7d1c9088450
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
module/zfs/arc.c