mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Add the ability to uninitialize
zpool initialize functions well for touching every free byte...once. But if we want to do it again, we're currently out of luck. So let's add zpool initialize -u to clear it. Co-authored-by: Rich Ercolani <rincebrain@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #12451 Closes #14873
This commit is contained in:
@@ -5410,7 +5410,8 @@
|
||||
<enumerator name='POOL_INITIALIZE_START' value='0'/>
|
||||
<enumerator name='POOL_INITIALIZE_CANCEL' value='1'/>
|
||||
<enumerator name='POOL_INITIALIZE_SUSPEND' value='2'/>
|
||||
<enumerator name='POOL_INITIALIZE_FUNCS' value='3'/>
|
||||
<enumerator name='POOL_INITIALIZE_UNINIT' value='3'/>
|
||||
<enumerator name='POOL_INITIALIZE_FUNCS' value='4'/>
|
||||
</enum-decl>
|
||||
<typedef-decl name='pool_initialize_func_t' type-id='5c246ad4' id='7063e1ab'/>
|
||||
<enum-decl name='pool_trim_func' id='54ed608a'>
|
||||
|
||||
@@ -2224,8 +2224,8 @@ xlate_init_err(int err)
|
||||
}
|
||||
|
||||
/*
|
||||
* Begin, suspend, or cancel the initialization (initializing of all free
|
||||
* blocks) for the given vdevs in the given pool.
|
||||
* Begin, suspend, cancel, or uninit (clear) the initialization (initializing
|
||||
* of all free blocks) for the given vdevs in the given pool.
|
||||
*/
|
||||
static int
|
||||
zpool_initialize_impl(zpool_handle_t *zhp, pool_initialize_func_t cmd_type,
|
||||
@@ -2251,11 +2251,16 @@ zpool_initialize_impl(zpool_handle_t *zhp, pool_initialize_func_t cmd_type,
|
||||
vdev_guids, &errlist);
|
||||
|
||||
if (err != 0) {
|
||||
if (errlist != NULL) {
|
||||
vd_errlist = fnvlist_lookup_nvlist(errlist,
|
||||
ZPOOL_INITIALIZE_VDEVS);
|
||||
if (errlist != NULL && nvlist_lookup_nvlist(errlist,
|
||||
ZPOOL_INITIALIZE_VDEVS, &vd_errlist) == 0) {
|
||||
goto list_errors;
|
||||
}
|
||||
|
||||
if (err == EINVAL && cmd_type == POOL_INITIALIZE_UNINIT) {
|
||||
zfs_error_aux(zhp->zpool_hdl, dgettext(TEXT_DOMAIN,
|
||||
"uninitialize is not supported by kernel"));
|
||||
}
|
||||
|
||||
(void) zpool_standard_error(zhp->zpool_hdl, err,
|
||||
dgettext(TEXT_DOMAIN, "operation failed"));
|
||||
goto out;
|
||||
|
||||
@@ -1726,7 +1726,8 @@
|
||||
<enumerator name='POOL_INITIALIZE_START' value='0'/>
|
||||
<enumerator name='POOL_INITIALIZE_CANCEL' value='1'/>
|
||||
<enumerator name='POOL_INITIALIZE_SUSPEND' value='2'/>
|
||||
<enumerator name='POOL_INITIALIZE_FUNCS' value='3'/>
|
||||
<enumerator name='POOL_INITIALIZE_UNINIT' value='3'/>
|
||||
<enumerator name='POOL_INITIALIZE_FUNCS' value='4'/>
|
||||
</enum-decl>
|
||||
<typedef-decl name='pool_initialize_func_t' type-id='5c246ad4' id='7063e1ab'/>
|
||||
<enum-decl name='pool_trim_func' id='54ed608a'>
|
||||
|
||||
Reference in New Issue
Block a user