mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Defer new resilvers until the current one ends
Currently, if a resilver is triggered for any reason while an existing one is running, zfs will immediately restart the existing resilver from the beginning to include the new drive. This causes problems for system administrators when a drive fails while another is already resilvering. In this case, the optimal thing to do to reduce risk of data loss is to wait for the current resilver to end before immediately replacing the second failed drive, which allows the system to operate with two incomplete drives for the minimum amount of time. This patch introduces the resilver_defer feature that essentially does this for the admin without forcing them to wait and monitor the resilver manually. The change requires an on-disk feature since we must mark drives that are part of a deferred resilver in the vdev config to ensure that we do not assume they are done resilvering when an existing resilver completes. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: @mmaybee Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #7732
This commit is contained in:
committed by
Brian Behlendorf
parent
9f438c5f94
commit
80a91e7469
@@ -710,6 +710,7 @@ typedef struct zpool_load_policy {
|
||||
#define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top"
|
||||
#define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf"
|
||||
#define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps"
|
||||
#define ZPOOL_CONFIG_RESILVER_DEFER "com.datto:resilver_defer"
|
||||
#define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */
|
||||
#define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */
|
||||
#define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */
|
||||
@@ -988,6 +989,7 @@ typedef struct vdev_stat {
|
||||
uint64_t vs_scan_processed; /* scan processed bytes */
|
||||
uint64_t vs_fragmentation; /* device fragmentation */
|
||||
uint64_t vs_checkpoint_space; /* checkpoint-consumed space */
|
||||
uint64_t vs_resilver_deferred; /* resilver deferred */
|
||||
} vdev_stat_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -281,6 +281,13 @@ 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 */
|
||||
|
||||
/*
|
||||
* We are in the middle of a resilver, and another resilver
|
||||
* is needed once this one completes. This is set iff any
|
||||
* vdev_resilver_deferred is set.
|
||||
*/
|
||||
boolean_t spa_resilver_deferred;
|
||||
kmutex_t spa_async_lock; /* protect async state */
|
||||
kthread_t *spa_async_thread; /* thread doing async task */
|
||||
int spa_async_suspended; /* async tasks suspended */
|
||||
|
||||
@@ -149,6 +149,8 @@ extern int vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg);
|
||||
extern void vdev_state_dirty(vdev_t *vd);
|
||||
extern void vdev_state_clean(vdev_t *vd);
|
||||
|
||||
extern void vdev_set_deferred_resilver(spa_t *spa, vdev_t *vd);
|
||||
|
||||
typedef enum vdev_config_flag {
|
||||
VDEV_CONFIG_SPARE = 1 << 0,
|
||||
VDEV_CONFIG_L2CACHE = 1 << 1,
|
||||
|
||||
@@ -335,6 +335,7 @@ struct vdev {
|
||||
boolean_t vdev_isspare; /* was a hot spare */
|
||||
boolean_t vdev_isl2cache; /* was a l2cache device */
|
||||
boolean_t vdev_copy_uberblocks; /* post expand copy uberblocks */
|
||||
boolean_t vdev_resilver_deferred; /* resilver deferred */
|
||||
vdev_queue_t vdev_queue; /* I/O deadline schedule queue */
|
||||
vdev_cache_t vdev_cache; /* physical block cache */
|
||||
spa_aux_vdev_t *vdev_aux; /* for l2cache and spares vdevs */
|
||||
|
||||
Reference in New Issue
Block a user