]> git.proxmox.com Git - mirror_zfs.git/commit
Avoid memory copies during mirror scrub
authorAlexander Motin <mav@FreeBSD.org>
Tue, 5 Jul 2022 23:26:20 +0000 (19:26 -0400)
committerGitHub <noreply@github.com>
Tue, 5 Jul 2022 23:26:20 +0000 (16:26 -0700)
commit1ac7d194e5ca31d5284e410a87ad9f9669a7f5b5
tree8bca1a44f281c418ab2ef0c5f1432a9ca7a0aa4b
parent6fca6195cdf3079a6e11444e42d7ce4aca10c6a1
Avoid memory copies during mirror scrub

Issuing several scrub reads for a block we may use the parent ZIO
buffer for one of child ZIOs.  If that read complete successfully,
then we won't need to copy the data explicitly.  If block has only
one copy (typical for root vdev, which is also a mirror inside),
then we never need to copy -- succeed or fail as-is.  Previous
code also copied data from buffer of every successfully completed
child ZIO, but that just does not make any sense.

On healthy N-wide mirror this saves all N+1 (or even more in case
of ditto blocks) memory copies for each scrubbed block, allowing
CPU to focus mostly on check-summing.  For other vdev types it
should save one memory copy per block copy at root vdev.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13606
module/zfs/vdev_mirror.c