return (unshare_unmount(OP_SHARE, argc, argv));
}
+static int
+disable_command_idx(char *command)
+{
+ for (int i = 0; i < NCOMMAND; i++) {
+ if (command_table[i].name == NULL)
+ continue;
+
+ if (strcmp(command, command_table[i].name) == 0) {
+ command_table[i].name = NULL;
+ return (0);
+ }
+ }
+ return (1);
+}
+
static int
find_command_idx(char *command, int *idx)
{
/*
* zfs remap <filesystem | volume>
*
- * Remap the indirect blocks in the given fileystem or volume.
+ * N.B. The remap command has been disabled and may be removed in the future.
+ *
+ * Remap the indirect blocks in the given filesystem or volume so that they no
+ * longer reference blocks on previously removed vdevs and we can eventually
+ * shrink the size of the indirect mapping objects for the previously removed
+ * vdevs. Note that remapping all blocks might not be possible and that
+ * references from snapshots will still exist and cannot be remapped.
+ *
+ * This functionality is no longer particularly useful now that the removal
+ * code can map large chunks. Furthermore, explaining what this command
+ * does and why it may be useful requires a detailed understanding of the
+ * internals of device removal. These are details users should not be
+ * bothered with. If required, the remap command can be re-enabled by
+ * setting the ZFS_REMAP_ENABLED environment variable.
+ *
+ * > ZFS_REMAP_ENABLED=yes zfs remap <filesystem | volume>
*/
static int
zfs_do_remap(int argc, char **argv)
if (strcmp(cmdname, "snap") == 0)
cmdname = "snapshot";
+ /*
+ * The 'remap' command has been disabled and may be removed in the
+ * future. See the comment above zfs_do_remap() for details.
+ */
+ if (!libzfs_envvar_is_set("ZFS_REMAP_ENABLED"))
+ disable_command_idx("remap");
+
/*
* Special case '-?'
*/
extern boolean_t zfs_force_some_double_word_sm_entries;
extern unsigned long zio_decompress_fail_fraction;
extern unsigned long zfs_reconstruct_indirect_damage_fraction;
-extern int zfs_object_remap_one_indirect_delay_ms;
static ztest_shared_opts_t *ztest_shared_opts;
ztest_func_t ztest_reguid;
ztest_func_t ztest_spa_upgrade;
ztest_func_t ztest_device_removal;
-ztest_func_t ztest_remap_blocks;
ztest_func_t ztest_spa_checkpoint_create_discard;
ztest_func_t ztest_initialize;
ztest_func_t ztest_fletcher;
ZTI_INIT(ztest_vdev_class_add, 1, &ztest_opts.zo_vdevtime),
ZTI_INIT(ztest_vdev_aux_add_remove, 1, &ztest_opts.zo_vdevtime),
ZTI_INIT(ztest_device_removal, 1, &zopt_sometimes),
- ZTI_INIT(ztest_remap_blocks, 1, &zopt_sometimes),
ZTI_INIT(ztest_spa_checkpoint_create_discard, 1, &zopt_rarely),
ZTI_INIT(ztest_initialize, 1, &zopt_sometimes),
ZTI_INIT(ztest_fletcher, 1, &zopt_rarely),
(void) pthread_rwlock_unlock(&ztest_name_lock);
}
-/* ARGSUSED */
-void
-ztest_remap_blocks(ztest_ds_t *zd, uint64_t id)
-{
- (void) pthread_rwlock_rdlock(&ztest_name_lock);
-
- int error = dmu_objset_remap_indirects(zd->zd_name);
- if (error == ENOSPC)
- error = 0;
- ASSERT0(error);
-
- (void) pthread_rwlock_unlock(&ztest_name_lock);
-}
-
/* ARGSUSED */
void
ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id)
*/
if (ztest_random(10) == 0)
zfs_abd_scatter_enabled = ztest_random(2);
-
- /*
- * Periodically inject remapping delays (10% of the time).
- */
- zfs_object_remap_one_indirect_delay_ms =
- ztest_random(10) == 0 ? ztest_random(1000) + 1 : 0;
}
thread_exit();
This feature is an enhancement of device_removal, which will over time
reduce the memory used to track removed devices. When indirect blocks
are freed or remapped, we note that their part of the indirect mapping
-is "obsolete", i.e. no longer needed. See also the \fBzfs remap\fR
-subcommand in \fBzfs\fR(1M).
+is "obsolete", i.e. no longer needed.
This feature becomes \fBactive\fR when the "zpool remove" command is
used on a top-level vdev, and will never return to being \fBenabled\fR.
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Oc Ns ...
.Nm
-.Cm remap
-.Ar filesystem Ns | Ns Ar volume
-.Nm
.Cm set
.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
.El
.It Xo
.Nm
-.Cm remap
-.Ar filesystem Ns | Ns Ar volume
-.Xc
-Remap the indirect blocks in the given fileystem or volume so that they no
-longer reference blocks on previously removed vdevs and we can eventually
-shrink the size of the indirect mapping objects for the previously removed
-vdevs. Note that remapping all blocks might not be possible and that
-references from snapshots will still exist and cannot be remapped.
-.It Xo
-.Nm
.Cm upgrade
.Xc
Displays a list of file systems that are not the most recent version.
#
# remove a special allocation vdev and force a remapping
+# N.B. The 'zfs remap' command has been disabled and may be removed.
#
+export ZFS_REMAP_ENABLED=YES
+
log_must zpool remove $TESTPOOL $CLASS_DISK0
log_must zfs remap $TESTPOOL/$TESTFS
# 3. Verify other unsupported parameters raise an error
#
+# The 'zfs remap' command has been disabled and may be removed.
+export ZFS_REMAP_ENABLED=YES
+
verify_runnable "both"
function cleanup
# feature@obsolete_counts is enabled
#
+# N.B. The 'zfs remap' command has been disabled and may be removed.
+export ZFS_REMAP_ENABLED=YES
+
verify_runnable "both"
function cleanup
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/removal/removal.kshlib
+# N.B. The 'zfs remap' command has been disabled and may be removed.
+export ZFS_REMAP_ENABLED=YES
+
default_setup_noexit "$DISKS"
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/removal/removal.kshlib
+# N.B. The 'zfs remap' command has been disabled and may be removed.
+export ZFS_REMAP_ENABLED=YES
+
default_setup_noexit "$DISKS"
log_onexit default_cleanup_noexit
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/removal/removal.kshlib
+# N.B. The 'zfs remap' command has been disabled and may be removed.
+export ZFS_REMAP_ENABLED=YES
+
default_setup_noexit "$DISKS"
log_onexit default_cleanup_noexit