Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zvol.c
          +++ new/usr/src/uts/common/fs/zfs/zvol.c
↓ open down ↓ 1826 lines elided ↑ open up ↑
1827 1827          mutex_destroy(&zfsdev_state_lock);
1828 1828          ddi_soft_state_fini(&zfsdev_state);
1829 1829  }
1830 1830  
1831 1831  /*ARGSUSED*/
1832 1832  static int
1833 1833  zfs_mvdev_dump_feature_check(void *arg, dmu_tx_t *tx)
1834 1834  {
1835 1835          spa_t *spa = dmu_tx_pool(tx)->dp_spa;
1836 1836  
1837      -        if (spa_feature_is_active(spa,
1838      -            &spa_feature_table[SPA_FEATURE_MULTI_VDEV_CRASH_DUMP]))
     1837 +        if (spa_feature_is_active(spa, SPA_FEATURE_MULTI_VDEV_CRASH_DUMP))
1839 1838                  return (1);
1840 1839          return (0);
1841 1840  }
1842 1841  
1843 1842  /*ARGSUSED*/
1844 1843  static void
1845 1844  zfs_mvdev_dump_activate_feature_sync(void *arg, dmu_tx_t *tx)
1846 1845  {
1847 1846          spa_t *spa = dmu_tx_pool(tx)->dp_spa;
1848 1847  
1849      -        spa_feature_incr(spa,
1850      -            &spa_feature_table[SPA_FEATURE_MULTI_VDEV_CRASH_DUMP], tx);
     1848 +        spa_feature_incr(spa, SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, tx);
1851 1849  }
1852 1850  
1853 1851  static int
1854 1852  zvol_dump_init(zvol_state_t *zv, boolean_t resize)
1855 1853  {
1856 1854          dmu_tx_t *tx;
1857 1855          int error;
1858 1856          objset_t *os = zv->zv_objset;
1859 1857          spa_t *spa = dmu_objset_spa(os);
1860 1858          vdev_t *vd = spa->spa_root_vdev;
↓ open down ↓ 14 lines elided ↑ open up ↑
1875 1873           * than one child vdev, check that the MULTI_VDEV_CRASH_DUMP feature is
1876 1874           * enabled.  If so, bump that feature's counter to indicate that the
1877 1875           * feature is active. We also check the vdev type to handle the
1878 1876           * following case:
1879 1877           *   # zpool create test raidz disk1 disk2 disk3
1880 1878           *   Now have spa_root_vdev->vdev_children == 1 (the raidz vdev),
1881 1879           *   the raidz vdev itself has 3 children.
1882 1880           */
1883 1881          if (vd->vdev_children > 1 || vd->vdev_ops == &vdev_raidz_ops) {
1884 1882                  if (!spa_feature_is_enabled(spa,
1885      -                    &spa_feature_table[SPA_FEATURE_MULTI_VDEV_CRASH_DUMP]))
     1883 +                    SPA_FEATURE_MULTI_VDEV_CRASH_DUMP))
1886 1884                          return (SET_ERROR(ENOTSUP));
1887 1885                  (void) dsl_sync_task(spa_name(spa),
1888 1886                      zfs_mvdev_dump_feature_check,
1889 1887                      zfs_mvdev_dump_activate_feature_sync, NULL, 2);
1890 1888          }
1891 1889  
1892 1890          tx = dmu_tx_create(os);
1893 1891          dmu_tx_hold_zap(tx, ZVOL_ZAP_OBJ, TRUE, NULL);
1894 1892          dmu_tx_hold_bonus(tx, ZVOL_OBJ);
1895 1893          error = dmu_tx_assign(tx, TXG_WAIT);
1896 1894          if (error) {
1897 1895                  dmu_tx_abort(tx);
1898 1896                  return (error);
1899 1897          }
1900 1898  
1901 1899          /*
1902 1900           * If MULTI_VDEV_CRASH_DUMP is active, use the NOPARITY checksum
1903 1901           * function.  Otherwise, use the old default -- OFF.
1904 1902           */
1905 1903          checksum = spa_feature_is_active(spa,
1906      -            &spa_feature_table[SPA_FEATURE_MULTI_VDEV_CRASH_DUMP]) ?
1907      -            ZIO_CHECKSUM_NOPARITY : ZIO_CHECKSUM_OFF;
     1904 +            SPA_FEATURE_MULTI_VDEV_CRASH_DUMP) ? ZIO_CHECKSUM_NOPARITY :
     1905 +            ZIO_CHECKSUM_OFF;
1908 1906  
1909 1907          /*
1910 1908           * If we are resizing the dump device then we only need to
1911 1909           * update the refreservation to match the newly updated
1912 1910           * zvolsize. Otherwise, we save off the original state of the
1913 1911           * zvol so that we can restore them if the zvol is ever undumpified.
1914 1912           */
1915 1913          if (resize) {
1916 1914                  error = zap_update(os, ZVOL_ZAP_OBJ,
1917 1915                      zfs_prop_to_name(ZFS_PROP_REFRESERVATION), 8, 1,
↓ open down ↓ 198 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX