Print this page
3525 Persistent L2ARC


1488 vdev_reopen(vdev_t *vd)
1489 {
1490         spa_t *spa = vd->vdev_spa;
1491 
1492         ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
1493 
1494         /* set the reopening flag unless we're taking the vdev offline */
1495         vd->vdev_reopening = !vd->vdev_offline;
1496         vdev_close(vd);
1497         (void) vdev_open(vd);
1498 
1499         /*
1500          * Call vdev_validate() here to make sure we have the same device.
1501          * Otherwise, a device with an invalid label could be successfully
1502          * opened in response to vdev_reopen().
1503          */
1504         if (vd->vdev_aux) {
1505                 (void) vdev_validate_aux(vd);
1506                 if (vdev_readable(vd) && vdev_writeable(vd) &&
1507                     vd->vdev_aux == &spa->spa_l2cache &&
1508                     !l2arc_vdev_present(vd))
1509                         l2arc_add_vdev(spa, vd);






1510         } else {
1511                 (void) vdev_validate(vd, B_TRUE);
1512         }
1513 
1514         /*
1515          * Reassess parent vdev's health.
1516          */
1517         vdev_propagate_state(vd);
1518 }
1519 
1520 int
1521 vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)
1522 {
1523         int error;
1524 
1525         /*
1526          * Normally, partial opens (e.g. of a mirror) are allowed.
1527          * For a create, however, we want to fail the request if
1528          * there are any components we can't open.
1529          */




1488 vdev_reopen(vdev_t *vd)
1489 {
1490         spa_t *spa = vd->vdev_spa;
1491 
1492         ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
1493 
1494         /* set the reopening flag unless we're taking the vdev offline */
1495         vd->vdev_reopening = !vd->vdev_offline;
1496         vdev_close(vd);
1497         (void) vdev_open(vd);
1498 
1499         /*
1500          * Call vdev_validate() here to make sure we have the same device.
1501          * Otherwise, a device with an invalid label could be successfully
1502          * opened in response to vdev_reopen().
1503          */
1504         if (vd->vdev_aux) {
1505                 (void) vdev_validate_aux(vd);
1506                 if (vdev_readable(vd) && vdev_writeable(vd) &&
1507                     vd->vdev_aux == &spa->spa_l2cache &&
1508                     !l2arc_vdev_present(vd)) {
1509                         /*
1510                          * When reopening we can assume persistent L2ARC is
1511                          * supported, since we've already opened the device
1512                          * in the past and prepended an L2ARC uberblock.
1513                          */
1514                         l2arc_add_vdev(spa, vd, B_TRUE);
1515                 }
1516         } else {
1517                 (void) vdev_validate(vd, B_TRUE);
1518         }
1519 
1520         /*
1521          * Reassess parent vdev's health.
1522          */
1523         vdev_propagate_state(vd);
1524 }
1525 
1526 int
1527 vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)
1528 {
1529         int error;
1530 
1531         /*
1532          * Normally, partial opens (e.g. of a mirror) are allowed.
1533          * For a create, however, we want to fail the request if
1534          * there are any components we can't open.
1535          */