Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
Show First 20 Lines • Show All 1,183 Lines • ▼ Show 20 Lines | for (uint_t c = 0; c < children; c++) { | ||||
return (B_TRUE); | return (B_TRUE); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return (B_FALSE); | return (B_FALSE); | ||||
} | } | ||||
/* | /* | ||||
* Check if vdev list contains a dRAID vdev | |||||
*/ | |||||
static boolean_t | |||||
zpool_has_draid_vdev(nvlist_t *nvroot) | |||||
{ | |||||
nvlist_t **child; | |||||
uint_t children; | |||||
if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, | |||||
&child, &children) == 0) { | |||||
for (uint_t c = 0; c < children; c++) { | |||||
char *type; | |||||
if (nvlist_lookup_string(child[c], | |||||
ZPOOL_CONFIG_TYPE, &type) == 0 && | |||||
strcmp(type, VDEV_TYPE_DRAID) == 0) { | |||||
return (B_TRUE); | |||||
} | |||||
} | |||||
} | |||||
return (B_FALSE); | |||||
} | |||||
/* | |||||
* Output a dRAID top-level vdev name in to the provided buffer. | * Output a dRAID top-level vdev name in to the provided buffer. | ||||
*/ | */ | ||||
static char * | static char * | ||||
zpool_draid_name(char *name, int len, uint64_t data, uint64_t parity, | zpool_draid_name(char *name, int len, uint64_t data, uint64_t parity, | ||||
uint64_t spares, uint64_t children) | uint64_t spares, uint64_t children) | ||||
{ | { | ||||
snprintf(name, len, "%s%llu:%llud:%lluc:%llus", | snprintf(name, len, "%s%llu:%llud:%lluc:%llus", | ||||
VDEV_TYPE_DRAID, (u_longlong_t)parity, (u_longlong_t)data, | VDEV_TYPE_DRAID, (u_longlong_t)parity, (u_longlong_t)data, | ||||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | case EOVERFLOW: | ||||
} | } | ||||
return (zfs_error(hdl, EZFS_BADDEV, msg)); | return (zfs_error(hdl, EZFS_BADDEV, msg)); | ||||
case ENOSPC: | case ENOSPC: | ||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | ||||
"one or more devices is out of space")); | "one or more devices is out of space")); | ||||
return (zfs_error(hdl, EZFS_BADDEV, msg)); | return (zfs_error(hdl, EZFS_BADDEV, msg)); | ||||
case EINVAL: | |||||
if (zpool_has_draid_vdev(nvroot) && | |||||
zfeature_lookup_name("draid", NULL) != 0) { | |||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | |||||
"dRAID vdevs are unsupported by the " | |||||
"kernel")); | |||||
return (zfs_error(hdl, EZFS_BADDEV, msg)); | |||||
} else { | |||||
return (zpool_standard_error(hdl, errno, msg)); | |||||
} | |||||
default: | default: | ||||
return (zpool_standard_error(hdl, errno, msg)); | return (zpool_standard_error(hdl, errno, msg)); | ||||
} | } | ||||
} | } | ||||
create_failed: | create_failed: | ||||
zcmd_free_nvlists(&zc); | zcmd_free_nvlists(&zc); | ||||
nvlist_free(zc_props); | nvlist_free(zc_props); | ||||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | case EBUSY: | ||||
* label. | * label. | ||||
*/ | */ | ||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | ||||
"one or more vdevs refer to the same device")); | "one or more vdevs refer to the same device")); | ||||
(void) zfs_error(hdl, EZFS_BADDEV, msg); | (void) zfs_error(hdl, EZFS_BADDEV, msg); | ||||
break; | break; | ||||
case EINVAL: | case EINVAL: | ||||
if (zpool_has_draid_vdev(nvroot) && | |||||
zfeature_lookup_name("draid", NULL) != 0) { | |||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | ||||
"invalid config; a pool with removing/removed " | "dRAID vdevs are unsupported by the " | ||||
"vdevs does not support adding raidz vdevs")); | "kernel")); | ||||
} else { | |||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | |||||
"invalid config; a pool with removing/" | |||||
"removed vdevs does not support adding " | |||||
"raidz or dRAID vdevs")); | |||||
} | |||||
(void) zfs_error(hdl, EZFS_BADDEV, msg); | (void) zfs_error(hdl, EZFS_BADDEV, msg); | ||||
break; | break; | ||||
case EOVERFLOW: | case EOVERFLOW: | ||||
/* | /* | ||||
* This occurs when one of the devices is below | * This occurs when one of the devices is below | ||||
* SPA_MINDEVSIZE. Unfortunately, we can't detect which | * SPA_MINDEVSIZE. Unfortunately, we can't detect which | ||||
* device was the problem device since there's no | * device was the problem device since there's no | ||||
▲ Show 20 Lines • Show All 3,079 Lines • Show Last 20 Lines |