| 1811 | } |
| 1812 | |
| 1813 | void |
| 1814 | zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx) |
| 1815 | { |
| 1816 | struct super_block *sb; |
| 1817 | zfsvfs_t *zfsvfs; |
| 1818 | uint64_t moid, obj, sa_obj, version; |
| 1819 | uint64_t sense = ZFS_CASE_SENSITIVE; |
| 1820 | uint64_t norm = 0; |
| 1821 | nvpair_t *elem; |
| 1822 | int size; |
| 1823 | int error; |
| 1824 | int i; |
| 1825 | znode_t *rootzp = NULL; |
| 1826 | vattr_t vattr; |
| 1827 | znode_t *zp; |
| 1828 | zfs_acl_ids_t acl_ids; |
| 1829 | |
| 1830 | /* |
| 1831 | * First attempt to create master node. |
| 1832 | */ |
| 1833 | /* |
| 1834 | * In an empty objset, there are no blocks to read and thus |
| 1835 | * there can be no i/o errors (which we assert below). |
| 1836 | */ |
| 1837 | moid = MASTER_NODE_OBJ; |
| 1838 | error = zap_create_claim(os, moid, DMU_OT_MASTER_NODE, |
| 1839 | DMU_OT_NONE, 0, tx); |
| 1840 | ASSERT(error == 0); |
| 1841 | |
| 1842 | /* |
| 1843 | * Set starting attributes. |
| 1844 | */ |
| 1845 | version = zfs_zpl_version_map(spa_version(dmu_objset_spa(os))); |
| 1846 | elem = NULL; |
| 1847 | while ((elem = nvlist_next_nvpair(zplprops, elem)) != NULL) { |
| 1848 | /* For the moment we expect all zpl props to be uint64_ts */ |
| 1849 | uint64_t val; |
| 1850 | char *name; |
| 1851 | |
| 1852 | ASSERT(nvpair_type(elem) == DATA_TYPE_UINT64); |
| 1853 | VERIFY(nvpair_value_uint64(elem, &val) == 0); |
| 1854 | name = nvpair_name(elem); |
| 1855 | if (strcmp(name, zfs_prop_to_name(ZFS_PROP_VERSION)) == 0) { |
| 1856 | if (val < version) |
| 1857 | version = val; |
| 1858 | } else { |
| 1859 | error = zap_update(os, moid, name, 8, 1, &val, tx); |
| 1860 | } |
| 1861 | ASSERT(error == 0); |
| 1862 | if (strcmp(name, zfs_prop_to_name(ZFS_PROP_NORMALIZE)) == 0) |
| 1863 | norm = val; |
| 1864 | else if (strcmp(name, zfs_prop_to_name(ZFS_PROP_CASE)) == 0) |
| 1865 | sense = val; |
| 1866 | } |
| 1867 | ASSERT(version != 0); |
| 1868 | error = zap_update(os, moid, ZPL_VERSION_STR, 8, 1, &version, tx); |
| 1869 | |
| 1870 | /* |
no test coverage detected