Add ability to scrub from last scrubbed txg
commit4b4e346b9f24c8a315af5a44d540080a449167ea
authorMariusz Zaborski <mariusz.zaborski@klarasystems.com>
Wed, 4 Dec 2024 19:21:45 +0000 (4 20:21 +0100)
committerGitHub <noreply@github.com>
Wed, 4 Dec 2024 19:21:45 +0000 (4 14:21 -0500)
tree056d2ef14ce19722476ce9b6b27569621dd8c3c3
parent1cd2419ece5c0639c724141e5ff22d86c542f675
Add ability to scrub from last scrubbed txg

Some users might want to scrub only new data because they would like
to know if the new write wasn't corrupted.  This PR adds possibility
scrub only newly written data.

This introduces new `last_scrubbed_txg` property, indicating the
transaction group (TXG) up to which the most recent scrub operation
has checked and repaired the dataset, so users can run scrub only
from the last saved point. We use a scn_max_txg and scn_min_txg
which are already built into scrub, to accomplish that.

Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com>
Sponsored-By: Wasabi Technology, Inc.
Sponsored-By: Klara Inc.
Closes #16301
19 files changed:
cmd/zpool/zpool_main.c
include/sys/dmu.h
include/sys/dsl_scan.h
include/sys/fs/zfs.h
include/sys/spa.h
include/sys/spa_impl.h
lib/libzfs/libzfs.abi
man/man7/zpoolprops.7
man/man8/zpool-scrub.8
module/zcommon/zpool_prop.c
module/zfs/dsl_scan.c
module/zfs/spa.c
module/zfs/spa_misc.c
module/zfs/vdev_raidz.c
module/zfs/vdev_rebuild.c
module/zfs/zfs_ioctl.c
tests/zfs-tests/tests/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_txg_continue_from_last.ksh [new file with mode: 0755]