Print this page
3525 Persistent L2ARC

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/spa.c
          +++ new/usr/src/uts/common/fs/zfs/spa.c
↓ open down ↓ 1477 lines elided ↑ open up ↑
1478 1478                          vd->vdev_top = vd;
1479 1479                          vd->vdev_aux = sav;
1480 1480  
1481 1481                          spa_l2cache_activate(vd);
1482 1482  
1483 1483                          if (vdev_open(vd) != 0)
1484 1484                                  continue;
1485 1485  
1486 1486                          (void) vdev_validate_aux(vd);
1487 1487  
1488      -                        if (!vdev_is_dead(vd))
1489      -                                l2arc_add_vdev(spa, vd);
     1488 +                        if (!vdev_is_dead(vd)) {
     1489 +                                boolean_t do_rebuild = B_FALSE;
     1490 +
     1491 +                                (void) nvlist_lookup_boolean_value(l2cache[i],
     1492 +                                    ZPOOL_CONFIG_L2CACHE_PERSISTENT,
     1493 +                                    &do_rebuild);
     1494 +                                l2arc_add_vdev(spa, vd, do_rebuild);
     1495 +                        }
1490 1496                  }
1491 1497          }
1492 1498  
1493 1499          /*
1494 1500           * Purge vdevs that were dropped
1495 1501           */
1496 1502          for (i = 0; i < oldnvdevs; i++) {
1497 1503                  uint64_t pool;
1498 1504  
1499 1505                  vd = oldvdevs[i];
↓ open down ↓ 1189 lines elided ↑ open up ↑
2689 2695                   */
2690 2696                  (void) dmu_objset_find(spa_name(spa),
2691 2697                      dsl_destroy_inconsistent, NULL, DS_FIND_CHILDREN);
2692 2698  
2693 2699                  /*
2694 2700                   * Clean up any stale temporary dataset userrefs.
2695 2701                   */
2696 2702                  dsl_pool_clean_tmp_userrefs(spa->spa_dsl_pool);
2697 2703          }
2698 2704  
     2705 +        spa_async_request(spa, SPA_ASYNC_L2CACHE_REBUILD);
     2706 +
2699 2707          return (0);
2700 2708  }
2701 2709  
2702 2710  static int
2703 2711  spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig)
2704 2712  {
2705 2713          int mode = spa->spa_mode;
2706 2714  
2707 2715          spa_unload(spa);
2708 2716          spa_deactivate(spa);
↓ open down ↓ 2929 lines elided ↑ open up ↑
5638 5646          if (tasks & SPA_ASYNC_RESILVER_DONE)
5639 5647                  spa_vdev_resilver_done(spa);
5640 5648  
5641 5649          /*
5642 5650           * Kick off a resilver.
5643 5651           */
5644 5652          if (tasks & SPA_ASYNC_RESILVER)
5645 5653                  dsl_resilver_restart(spa->spa_dsl_pool, 0);
5646 5654  
5647 5655          /*
     5656 +         * Kick off L2 cache rebuilding.
     5657 +         */
     5658 +        if (tasks & SPA_ASYNC_L2CACHE_REBUILD)
     5659 +                l2arc_spa_rebuild_start(spa);
     5660 +
     5661 +        /*
5648 5662           * Let the world know that we're done.
5649 5663           */
5650 5664          mutex_enter(&spa->spa_async_lock);
5651 5665          spa->spa_async_thread = NULL;
5652 5666          cv_broadcast(&spa->spa_async_cv);
5653 5667          mutex_exit(&spa->spa_async_lock);
5654 5668          thread_exit();
5655 5669  }
5656 5670  
5657 5671  void
↓ open down ↓ 864 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX