Print this page
3525 Persistent L2ARC


 274         if (vd->vdev_isspare)
 275                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1) == 0);
 276 
 277         if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
 278             vd == vd->vdev_top) {
 279                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
 280                     vd->vdev_ms_array) == 0);
 281                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
 282                     vd->vdev_ms_shift) == 0);
 283                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
 284                     vd->vdev_ashift) == 0);
 285                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
 286                     vd->vdev_asize) == 0);
 287                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,
 288                     vd->vdev_islog) == 0);
 289                 if (vd->vdev_removing)
 290                         VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
 291                             vd->vdev_removing) == 0);
 292         }
 293 





 294         if (vd->vdev_dtl_smo.smo_object != 0)
 295                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
 296                     vd->vdev_dtl_smo.smo_object) == 0);
 297 
 298         if (vd->vdev_crtxg)
 299                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG,
 300                     vd->vdev_crtxg) == 0);
 301 
 302         if (getstats) {
 303                 vdev_stat_t vs;
 304                 pool_scan_stat_t ps;
 305 
 306                 vdev_get_stats(vd, &vs);
 307                 VERIFY(nvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
 308                     (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t)) == 0);
 309 
 310                 /* provide either current or previous scan information */
 311                 if (spa_scan_get_stats(spa, &ps) == 0) {
 312                         VERIFY(nvlist_add_uint64_array(nv,
 313                             ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,




 274         if (vd->vdev_isspare)
 275                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1) == 0);
 276 
 277         if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
 278             vd == vd->vdev_top) {
 279                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
 280                     vd->vdev_ms_array) == 0);
 281                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
 282                     vd->vdev_ms_shift) == 0);
 283                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
 284                     vd->vdev_ashift) == 0);
 285                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
 286                     vd->vdev_asize) == 0);
 287                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,
 288                     vd->vdev_islog) == 0);
 289                 if (vd->vdev_removing)
 290                         VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
 291                             vd->vdev_removing) == 0);
 292         }
 293 
 294         if (flags & VDEV_CONFIG_L2CACHE)
 295                 /* indicate that we support L2ARC persistency */
 296                 VERIFY(nvlist_add_boolean_value(nv,
 297                     ZPOOL_CONFIG_L2CACHE_PERSISTENT, B_TRUE) == 0);
 298 
 299         if (vd->vdev_dtl_smo.smo_object != 0)
 300                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
 301                     vd->vdev_dtl_smo.smo_object) == 0);
 302 
 303         if (vd->vdev_crtxg)
 304                 VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG,
 305                     vd->vdev_crtxg) == 0);
 306 
 307         if (getstats) {
 308                 vdev_stat_t vs;
 309                 pool_scan_stat_t ps;
 310 
 311                 vdev_get_stats(vd, &vs);
 312                 VERIFY(nvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
 313                     (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t)) == 0);
 314 
 315                 /* provide either current or previous scan information */
 316                 if (spa_scan_get_stats(spa, &ps) == 0) {
 317                         VERIFY(nvlist_add_uint64_array(nv,
 318                             ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,