266 fnvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1);
267
268 if (vd->vdev_isspare)
269 fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1);
270
271 if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
272 vd == vd->vdev_top) {
273 fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
274 vd->vdev_ms_array);
275 fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
276 vd->vdev_ms_shift);
277 fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT, vd->vdev_ashift);
278 fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
279 vd->vdev_asize);
280 fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG, vd->vdev_islog);
281 if (vd->vdev_removing)
282 fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
283 vd->vdev_removing);
284 }
285
286 if (vd->vdev_dtl_sm != NULL) {
287 fnvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
288 space_map_object(vd->vdev_dtl_sm));
289 }
290
291 if (vd->vdev_crtxg)
292 fnvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG, vd->vdev_crtxg);
293
294 if (getstats) {
295 vdev_stat_t vs;
296 pool_scan_stat_t ps;
297
298 vdev_get_stats(vd, &vs);
299 fnvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
300 (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t));
301
302 /* provide either current or previous scan information */
303 if (spa_scan_get_stats(spa, &ps) == 0) {
304 fnvlist_add_uint64_array(nv,
305 ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,
|
266 fnvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1);
267
268 if (vd->vdev_isspare)
269 fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1);
270
271 if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
272 vd == vd->vdev_top) {
273 fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
274 vd->vdev_ms_array);
275 fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
276 vd->vdev_ms_shift);
277 fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT, vd->vdev_ashift);
278 fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
279 vd->vdev_asize);
280 fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG, vd->vdev_islog);
281 if (vd->vdev_removing)
282 fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
283 vd->vdev_removing);
284 }
285
286 if (flags & VDEV_CONFIG_L2CACHE)
287 /* indicate that we support L2ARC persistency */
288 VERIFY(nvlist_add_boolean_value(nv,
289 ZPOOL_CONFIG_L2CACHE_PERSISTENT, B_TRUE) == 0);
290
291 if (vd->vdev_dtl_sm != NULL) {
292 fnvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
293 space_map_object(vd->vdev_dtl_sm));
294 }
295
296 if (vd->vdev_crtxg)
297 fnvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG, vd->vdev_crtxg);
298
299 if (getstats) {
300 vdev_stat_t vs;
301 pool_scan_stat_t ps;
302
303 vdev_get_stats(vd, &vs);
304 fnvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
305 (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t));
306
307 /* provide either current or previous scan information */
308 if (spa_scan_get_stats(spa, &ps) == 0) {
309 fnvlist_add_uint64_array(nv,
310 ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,
|