mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Improve performance of "zpool offline" for log devices
When offlining a log device, if it's part of a mirror that would still be available after the offline operation, skip replaying the ZIL for every dataset. This drastically improves the performance of "zpool offline" for one log device of a mirrored pair. Sponsored by: ConnectWise Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alek Pinchuk <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #18664
This commit is contained in:
1 parent
1fbd5e34a4
commit
520eeeaa64
1 file changed
+8
-5
+8
-5
@@ -4623,6 +4623,7 @@ vdev_offline_locked(spa_t *spa, uint64_t guid, uint64_t flags)
|
||||
int error = 0;
|
||||
uint64_t generation;
|
||||
metaslab_group_t *mg;
|
||||
boolean_t dtl_required;
|
||||
|
||||
top:
|
||||
spa_vdev_state_enter(spa, SCL_ALLOC);
|
||||
@@ -4644,13 +4645,14 @@ top:
|
||||
* If the device isn't already offline, try to offline it.
|
||||
*/
|
||||
if (!vd->vdev_offline) {
|
||||
dtl_required = vdev_dtl_required(vd);
|
||||
|
||||
/*
|
||||
* If this device has the only valid copy of some data,
|
||||
* don't allow it to be offlined. Log devices are always
|
||||
* expendable.
|
||||
*/
|
||||
if (!tvd->vdev_islog && vd->vdev_aux == NULL &&
|
||||
vdev_dtl_required(vd))
|
||||
if (!tvd->vdev_islog && vd->vdev_aux == NULL && dtl_required)
|
||||
return (spa_vdev_state_exit(spa, NULL,
|
||||
SET_ERROR(EBUSY)));
|
||||
|
||||
@@ -4660,9 +4662,10 @@ top:
|
||||
* is not NULL since it's possible that we may have just
|
||||
* added this vdev but not yet initialized its metaslabs.
|
||||
*/
|
||||
if (tvd->vdev_islog && mg != NULL) {
|
||||
if (tvd->vdev_islog && mg != NULL && dtl_required) {
|
||||
/*
|
||||
* Prevent any future allocations.
|
||||
* Prevent future allocations unless the log device is
|
||||
* redundant.
|
||||
*/
|
||||
ASSERT0P(tvd->vdev_log_mg);
|
||||
metaslab_group_passivate(mg);
|
||||
@@ -4718,7 +4721,7 @@ top:
|
||||
* Add the device back into the metaslab rotor so that
|
||||
* once we online the device it's open for business.
|
||||
*/
|
||||
if (tvd->vdev_islog && mg != NULL)
|
||||
if (tvd->vdev_islog && mg != NULL && dtl_required)
|
||||
metaslab_group_activate(mg);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user