]> git.proxmox.com Git - mirror_zfs.git/blobdiff - module/zfs/vdev_label.c
Add device rebuild feature
[mirror_zfs.git] / module / zfs / vdev_label.c
index 81cfd5ccef06c914949f41f46b43ed683b6e7a68..8c7468255565adc63905eca9895d7d95d2b3eb35 100644 (file)
@@ -404,6 +404,19 @@ root_vdev_actions_getprogress(vdev_t *vd, nvlist_t *nvl)
        }
 }
 
+static void
+top_vdev_actions_getprogress(vdev_t *vd, nvlist_t *nvl)
+{
+       if (vd == vd->vdev_top) {
+               vdev_rebuild_stat_t vrs;
+               if (vdev_rebuild_get_stats(vd, &vrs) == 0) {
+                       fnvlist_add_uint64_array(nvl,
+                           ZPOOL_CONFIG_REBUILD_STATS, (uint64_t *)&vrs,
+                           sizeof (vrs) / sizeof (uint64_t));
+               }
+       }
+}
+
 /*
  * Generate the nvlist representing this vdev's config.
  */
@@ -559,6 +572,7 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
                vdev_config_generate_stats(vd, nv);
 
                root_vdev_actions_getprogress(vd, nv);
+               top_vdev_actions_getprogress(vd, nv);
 
                /*
                 * Note: this can be called from open context
@@ -663,6 +677,9 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
                if (vd->vdev_resilver_txg != 0)
                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_RESILVER_TXG,
                            vd->vdev_resilver_txg);
+               if (vd->vdev_rebuild_txg != 0)
+                       fnvlist_add_uint64(nv, ZPOOL_CONFIG_REBUILD_TXG,
+                           vd->vdev_rebuild_txg);
                if (vd->vdev_faulted)
                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_FAULTED, B_TRUE);
                if (vd->vdev_degraded)