mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Remove code for zfs remap
The "zfs remap" command was disabled by
6e91a72fe3, because it has little utility
and introduced some tricky bugs. This commit removes the code for it,
the associated ZFS_IOC_REMAP ioctl, and tests.
Note that the ioctl and property will remain, but have no functionality.
This allows older software to fail gracefully if it attempts to use
these, and avoids a backwards incompatibility that would be introduced if
we renumbered the later ioctls/props.
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #8944
This commit is contained in:
committed by
Brian Behlendorf
parent
53864800f6
commit
59ec30a329
@@ -1396,101 +1396,6 @@ dmu_objset_clone(const char *clone, const char *origin)
|
||||
6, ZFS_SPACE_CHECK_NORMAL));
|
||||
}
|
||||
|
||||
static int
|
||||
dmu_objset_remap_indirects_impl(objset_t *os, uint64_t last_removed_txg)
|
||||
{
|
||||
int error = 0;
|
||||
uint64_t object = 0;
|
||||
while ((error = dmu_object_next(os, &object, B_FALSE, 0)) == 0) {
|
||||
error = dmu_object_remap_indirects(os, object,
|
||||
last_removed_txg);
|
||||
/*
|
||||
* If the ZPL removed the object before we managed to dnode_hold
|
||||
* it, we would get an ENOENT. If the ZPL declares its intent
|
||||
* to remove the object (dnode_free) before we manage to
|
||||
* dnode_hold it, we would get an EEXIST. In either case, we
|
||||
* want to continue remapping the other objects in the objset;
|
||||
* in all other cases, we want to break early.
|
||||
*/
|
||||
if (error != 0 && error != ENOENT && error != EEXIST) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error == ESRCH) {
|
||||
error = 0;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
dmu_objset_remap_indirects(const char *fsname)
|
||||
{
|
||||
int error = 0;
|
||||
objset_t *os = NULL;
|
||||
uint64_t last_removed_txg;
|
||||
uint64_t remap_start_txg;
|
||||
dsl_dir_t *dd;
|
||||
|
||||
error = dmu_objset_hold(fsname, FTAG, &os);
|
||||
if (error != 0) {
|
||||
return (error);
|
||||
}
|
||||
dd = dmu_objset_ds(os)->ds_dir;
|
||||
|
||||
if (!spa_feature_is_enabled(dmu_objset_spa(os),
|
||||
SPA_FEATURE_OBSOLETE_COUNTS)) {
|
||||
dmu_objset_rele(os, FTAG);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
}
|
||||
|
||||
if (dsl_dataset_is_snapshot(dmu_objset_ds(os))) {
|
||||
dmu_objset_rele(os, FTAG);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
/*
|
||||
* If there has not been a removal, we're done.
|
||||
*/
|
||||
last_removed_txg = spa_get_last_removal_txg(dmu_objset_spa(os));
|
||||
if (last_removed_txg == -1ULL) {
|
||||
dmu_objset_rele(os, FTAG);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have remapped since the last removal, we're done.
|
||||
*/
|
||||
if (dsl_dir_is_zapified(dd)) {
|
||||
uint64_t last_remap_txg;
|
||||
if (zap_lookup(spa_meta_objset(dmu_objset_spa(os)),
|
||||
dd->dd_object, DD_FIELD_LAST_REMAP_TXG,
|
||||
sizeof (last_remap_txg), 1, &last_remap_txg) == 0 &&
|
||||
last_remap_txg > last_removed_txg) {
|
||||
dmu_objset_rele(os, FTAG);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
dsl_dataset_long_hold(dmu_objset_ds(os), FTAG);
|
||||
dsl_pool_rele(dmu_objset_pool(os), FTAG);
|
||||
|
||||
remap_start_txg = spa_last_synced_txg(dmu_objset_spa(os));
|
||||
error = dmu_objset_remap_indirects_impl(os, last_removed_txg);
|
||||
if (error == 0) {
|
||||
/*
|
||||
* We update the last_remap_txg to be the start txg so that
|
||||
* we can guarantee that every block older than last_remap_txg
|
||||
* that can be remapped has been remapped.
|
||||
*/
|
||||
error = dsl_dir_update_last_remap_txg(dd, remap_start_txg);
|
||||
}
|
||||
|
||||
dsl_dataset_long_rele(dmu_objset_ds(os), FTAG);
|
||||
dsl_dataset_rele(dmu_objset_ds(os), FTAG);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
dmu_objset_snapshot_one(const char *fsname, const char *snapname)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user