mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Enable splitting mirrors with indirect vdevs
When a top-level vdev is removed from a pool it is converted to an indirect vdev. Until now splitting such mirrored pools was not possible with zpool split. This patch enables handling of indirect vdevs and splitting of those pools with zpool split. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #10283
This commit is contained in:
+9
-3
@@ -7297,7 +7297,8 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
||||
vdev_t *vd = rvd->vdev_child[c];
|
||||
|
||||
/* don't count the holes & logs as children */
|
||||
if (vd->vdev_islog || !vdev_is_concrete(vd)) {
|
||||
if (vd->vdev_islog || (vd->vdev_ops != &vdev_indirect_ops &&
|
||||
!vdev_is_concrete(vd))) {
|
||||
if (lastlog == 0)
|
||||
lastlog = c;
|
||||
continue;
|
||||
@@ -7333,6 +7334,11 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
||||
}
|
||||
}
|
||||
|
||||
/* deal with indirect vdevs */
|
||||
if (spa->spa_root_vdev->vdev_child[c]->vdev_ops ==
|
||||
&vdev_indirect_ops)
|
||||
continue;
|
||||
|
||||
/* which disk is going to be split? */
|
||||
if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_GUID,
|
||||
&glist[c]) != 0) {
|
||||
@@ -7460,7 +7466,7 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
||||
offsetof(vdev_t, vdev_trim_node));
|
||||
|
||||
for (c = 0; c < children; c++) {
|
||||
if (vml[c] != NULL) {
|
||||
if (vml[c] != NULL && vml[c]->vdev_ops != &vdev_indirect_ops) {
|
||||
mutex_enter(&vml[c]->vdev_initialize_lock);
|
||||
vdev_initialize_stop(vml[c],
|
||||
VDEV_INITIALIZE_ACTIVE, &vd_initialize_list);
|
||||
@@ -7521,7 +7527,7 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
||||
if (error != 0)
|
||||
dmu_tx_abort(tx);
|
||||
for (c = 0; c < children; c++) {
|
||||
if (vml[c] != NULL) {
|
||||
if (vml[c] != NULL && vml[c]->vdev_ops != &vdev_indirect_ops) {
|
||||
vdev_t *tvd = vml[c]->vdev_top;
|
||||
|
||||
/*
|
||||
|
||||
@@ -98,7 +98,8 @@ vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize,
|
||||
for (int c = 0; c < vd->vdev_children; c++) {
|
||||
vdev_t *cvd = vd->vdev_child[c];
|
||||
|
||||
if (cvd->vdev_open_error && !cvd->vdev_islog) {
|
||||
if (cvd->vdev_open_error && !cvd->vdev_islog &&
|
||||
cvd->vdev_ops != &vdev_indirect_ops) {
|
||||
lasterror = cvd->vdev_open_error;
|
||||
numerrors++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user