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 ↓ 1471 lines elided ↑ open up ↑
1472 1472                          vd->vdev_top = vd;
1473 1473                          vd->vdev_aux = sav;
1474 1474  
1475 1475                          spa_l2cache_activate(vd);
1476 1476  
1477 1477                          if (vdev_open(vd) != 0)
1478 1478                                  continue;
1479 1479  
1480 1480                          (void) vdev_validate_aux(vd);
1481 1481  
1482      -                        if (!vdev_is_dead(vd))
1483      -                                l2arc_add_vdev(spa, vd);
     1482 +                        if (!vdev_is_dead(vd)) {
     1483 +                                boolean_t persist = B_FALSE;
     1484 +
     1485 +                                if (spa->spa_load_state != SPA_LOAD_TRYIMPORT) {
     1486 +                                        /*
     1487 +                                         * Only allow to do the L2ARC rebuild
     1488 +                                         * when not doing a spa try-load.
     1489 +                                         */
     1490 +                                        (void) nvlist_lookup_boolean_value(
     1491 +                                            l2cache[i],
     1492 +                                            ZPOOL_CONFIG_L2CACHE_PERSISTENT,
     1493 +                                            &persist);
     1494 +                                }
     1495 +                                l2arc_add_vdev(spa, vd, persist);
     1496 +                        }
1484 1497                  }
1485 1498          }
1486 1499  
1487 1500          /*
1488 1501           * Purge vdevs that were dropped
1489 1502           */
1490 1503          for (i = 0; i < oldnvdevs; i++) {
1491 1504                  uint64_t pool;
1492 1505  
1493 1506                  vd = oldvdevs[i];
↓ open down ↓ 2379 lines elided ↑ open up ↑
3873 3886          spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
3874 3887          /*
3875 3888           * Toss any existing sparelist, as it doesn't have any validity
3876 3889           * anymore, and conflicts with spa_has_spare().
3877 3890           */
3878 3891          if (spa->spa_spares.sav_config) {
3879 3892                  nvlist_free(spa->spa_spares.sav_config);
3880 3893                  spa->spa_spares.sav_config = NULL;
3881 3894                  spa_load_spares(spa);
3882 3895          }
3883      -        if (spa->spa_l2cache.sav_config) {
3884      -                nvlist_free(spa->spa_l2cache.sav_config);
3885      -                spa->spa_l2cache.sav_config = NULL;
3886      -                spa_load_l2cache(spa);
3887      -        }
3888 3896  
3889 3897          VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
3890 3898              &nvroot) == 0);
3891 3899          if (error == 0)
3892 3900                  error = spa_validate_aux(spa, nvroot, -1ULL,
3893 3901                      VDEV_ALLOC_SPARE);
3894 3902          if (error == 0)
3895 3903                  error = spa_validate_aux(spa, nvroot, -1ULL,
3896 3904                      VDEV_ALLOC_L2CACHE);
3897 3905          spa_config_exit(spa, SCL_ALL, FTAG);
↓ open down ↓ 2600 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX