mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
Add device rebuild feature
The device_rebuild feature enables sequential reconstruction when
resilvering. Mirror vdevs can be rebuilt in LBA order which may
more quickly restore redundancy depending on the pools average block
size, overall fragmentation and the performance characteristics
of the devices. However, block checksums cannot be verified
as part of the rebuild thus a scrub is automatically started after
the sequential resilver completes.
The new '-s' option has been added to the `zpool attach` and
`zpool replace` command to request sequential reconstruction
instead of healing reconstruction when resilvering.
zpool attach -s <pool> <existing vdev> <new vdev>
zpool replace -s <pool> <old vdev> <new vdev>
The `zpool status` output has been updated to report the progress
of sequential resilvering in the same way as healing resilvering.
The one notable difference is that multiple sequential resilvers
may be in progress as long as they're operating on different
top-level vdevs.
The `zpool wait -t resilver` command was extended to wait on
sequential resilvers. From this perspective they are no different
than healing resilvers.
Sequential resilvers cannot be supported for RAIDZ, but are
compatible with the dRAID feature being developed.
As part of this change the resilver_restart_* tests were moved
in to the functional/replacement directory. Additionally, the
replacement tests were renamed and extended to verify both
resilvering and rebuilding.
Original-patch-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: John Poduska <jpoduska@datto.com>
Co-authored-by: Mark Maybee <mmaybee@cray.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10349
This commit is contained in:
+27
-2
@@ -1165,6 +1165,30 @@ spa_vdev_enter(spa_t *spa)
|
||||
return (spa_vdev_config_enter(spa));
|
||||
}
|
||||
|
||||
/*
|
||||
* The same as spa_vdev_enter() above but additionally takes the guid of
|
||||
* the vdev being detached. When there is a rebuild in process it will be
|
||||
* suspended while the vdev tree is modified then resumed by spa_vdev_exit().
|
||||
* The rebuild is canceled if only a single child remains after the detach.
|
||||
*/
|
||||
uint64_t
|
||||
spa_vdev_detach_enter(spa_t *spa, uint64_t guid)
|
||||
{
|
||||
mutex_enter(&spa->spa_vdev_top_lock);
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
|
||||
vdev_autotrim_stop_all(spa);
|
||||
|
||||
if (guid != 0) {
|
||||
vdev_t *vd = spa_lookup_by_guid(spa, guid, B_FALSE);
|
||||
if (vd) {
|
||||
vdev_rebuild_stop_wait(vd->vdev_top);
|
||||
}
|
||||
}
|
||||
|
||||
return (spa_vdev_config_enter(spa));
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal implementation for spa_vdev_enter(). Used when a vdev
|
||||
* operation requires multiple syncs (i.e. removing a device) while
|
||||
@@ -1198,7 +1222,7 @@ spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error, char *tag)
|
||||
/*
|
||||
* Reassess the DTLs.
|
||||
*/
|
||||
vdev_dtl_reassess(spa->spa_root_vdev, 0, 0, B_FALSE);
|
||||
vdev_dtl_reassess(spa->spa_root_vdev, 0, 0, B_FALSE, B_FALSE);
|
||||
|
||||
if (error == 0 && !list_is_empty(&spa->spa_config_dirty_list)) {
|
||||
config_changed = B_TRUE;
|
||||
@@ -1271,6 +1295,7 @@ int
|
||||
spa_vdev_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error)
|
||||
{
|
||||
vdev_autotrim_restart(spa);
|
||||
vdev_rebuild_restart(spa);
|
||||
|
||||
spa_vdev_config_exit(spa, vd, txg, error, FTAG);
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
@@ -1322,7 +1347,7 @@ spa_vdev_state_exit(spa_t *spa, vdev_t *vd, int error)
|
||||
}
|
||||
|
||||
if (vd != NULL || error == 0)
|
||||
vdev_dtl_reassess(vdev_top, 0, 0, B_FALSE);
|
||||
vdev_dtl_reassess(vdev_top, 0, 0, B_FALSE, B_FALSE);
|
||||
|
||||
if (vd != NULL) {
|
||||
if (vd != spa->spa_root_vdev)
|
||||
|
||||
Reference in New Issue
Block a user