mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
5988de77b0
commit
3b0c1131ef
@@ -381,6 +381,7 @@ typedef struct dmu_buf {
|
||||
#define DMU_POOL_CREATION_VERSION "creation_version"
|
||||
#define DMU_POOL_SCAN "scan"
|
||||
#define DMU_POOL_ERRORSCRUB "error_scrub"
|
||||
#define DMU_POOL_LAST_SCRUBBED_TXG "last_scrubbed_txg"
|
||||
#define DMU_POOL_FREE_BPOBJ "free_bpobj"
|
||||
#define DMU_POOL_BPTREE_OBJ "bptree_obj"
|
||||
#define DMU_POOL_EMPTY_BPOBJ "empty_bpobj"
|
||||
|
||||
@@ -179,6 +179,12 @@ typedef struct dsl_scan {
|
||||
dsl_errorscrub_phys_t errorscrub_phys;
|
||||
} dsl_scan_t;
|
||||
|
||||
typedef struct {
|
||||
pool_scan_func_t func;
|
||||
uint64_t txgstart;
|
||||
uint64_t txgend;
|
||||
} setup_sync_arg_t;
|
||||
|
||||
typedef struct dsl_scan_io_queue dsl_scan_io_queue_t;
|
||||
|
||||
void scan_init(void);
|
||||
@@ -189,7 +195,8 @@ void dsl_scan_setup_sync(void *, dmu_tx_t *);
|
||||
void dsl_scan_fini(struct dsl_pool *dp);
|
||||
void dsl_scan_sync(struct dsl_pool *, dmu_tx_t *);
|
||||
int dsl_scan_cancel(struct dsl_pool *);
|
||||
int dsl_scan(struct dsl_pool *, pool_scan_func_t);
|
||||
int dsl_scan(struct dsl_pool *, pool_scan_func_t, uint64_t starttxg,
|
||||
uint64_t txgend);
|
||||
void dsl_scan_assess_vdev(struct dsl_pool *dp, vdev_t *vd);
|
||||
boolean_t dsl_scan_scrubbing(const struct dsl_pool *dp);
|
||||
boolean_t dsl_errorscrubbing(const struct dsl_pool *dp);
|
||||
|
||||
@@ -265,6 +265,7 @@ typedef enum {
|
||||
ZPOOL_PROP_DEDUP_TABLE_SIZE,
|
||||
ZPOOL_PROP_DEDUP_TABLE_QUOTA,
|
||||
ZPOOL_PROP_DEDUPCACHED,
|
||||
ZPOOL_PROP_LAST_SCRUBBED_TXG,
|
||||
ZPOOL_NUM_PROPS
|
||||
} zpool_prop_t;
|
||||
|
||||
@@ -1088,6 +1089,7 @@ typedef enum pool_scan_func {
|
||||
typedef enum pool_scrub_cmd {
|
||||
POOL_SCRUB_NORMAL = 0,
|
||||
POOL_SCRUB_PAUSE,
|
||||
POOL_SCRUB_FROM_LAST_TXG,
|
||||
POOL_SCRUB_FLAGS_END
|
||||
} pool_scrub_cmd_t;
|
||||
|
||||
|
||||
@@ -822,6 +822,8 @@ extern void spa_l2cache_drop(spa_t *spa);
|
||||
|
||||
/* scanning */
|
||||
extern int spa_scan(spa_t *spa, pool_scan_func_t func);
|
||||
extern int spa_scan_range(spa_t *spa, pool_scan_func_t func, uint64_t txgstart,
|
||||
uint64_t txgend);
|
||||
extern int spa_scan_stop(spa_t *spa);
|
||||
extern int spa_scrub_pause_resume(spa_t *spa, pool_scrub_cmd_t flag);
|
||||
|
||||
@@ -1080,6 +1082,7 @@ extern uint64_t spa_get_deadman_failmode(spa_t *spa);
|
||||
extern void spa_set_deadman_failmode(spa_t *spa, const char *failmode);
|
||||
extern boolean_t spa_suspended(spa_t *spa);
|
||||
extern uint64_t spa_bootfs(spa_t *spa);
|
||||
extern uint64_t spa_get_last_scrubbed_txg(spa_t *spa);
|
||||
extern uint64_t spa_delegation(spa_t *spa);
|
||||
extern objset_t *spa_meta_objset(spa_t *spa);
|
||||
extern space_map_t *spa_syncing_log_sm(spa_t *spa);
|
||||
|
||||
@@ -318,6 +318,7 @@ struct spa {
|
||||
uint64_t spa_scan_pass_scrub_spent_paused; /* total paused */
|
||||
uint64_t spa_scan_pass_exam; /* examined bytes per pass */
|
||||
uint64_t spa_scan_pass_issued; /* issued bytes per pass */
|
||||
uint64_t spa_scrubbed_last_txg; /* last txg scrubbed */
|
||||
|
||||
/* error scrub pause time in milliseconds */
|
||||
uint64_t spa_scan_pass_errorscrub_pause;
|
||||
|
||||
Reference in New Issue
Block a user