Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdev_mirror: when resilvering, try reading first #12327

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions module/zfs/vdev_mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <sys/vdev_impl.h>
#include <sys/vdev_draid.h>
#include <sys/zio.h>
#include <sys/zio_checksum.h>
#include <sys/abd.h>
#include <sys/fs/zfs.h>

Expand Down Expand Up @@ -637,8 +638,15 @@ vdev_mirror_io_start(zio_t *zio)
}

if (zio->io_type == ZIO_TYPE_READ) {
if (zio->io_bp != NULL &&
(zio->io_flags & ZIO_FLAG_SCRUB) && !mm->mm_resilvering) {
boolean_t have_checksum = zio->io_bp != NULL;
boolean_t is_scrub = have_checksum &&
(zio->io_flags & ZIO_FLAG_SCRUB) &&
!mm->mm_resilvering;
boolean_t resilver_read = have_checksum &&
(zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) &&
(zio_checksum_table[BP_GET_CHECKSUM(zio->io_bp)].ci_flags &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good place to add a comment explaining the reasoning behind this.

ZCHECKSUM_FLAG_NOPWRITE);
if (is_scrub || resilver_read) {
/*
* For scrubbing reads (if we can verify the
* checksum here, as indicated by io_bp being
Expand Down