mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Allow rewrite skip cloned and snapshotted blocks
Rewrite of cloned and snapshotted blocks can allocate additional space, that may be undesired. In some cases it may have sense to still rewrite snapshotted blocks, expecting the snapshots to rotate with time, freeing space. In other cases rewrite of cloned blocks may be acceptable, despite persistent space usage increase. For this reason add them as separate flags to `zfs rewrite`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #18179
This commit is contained in:
+9
-3
@@ -439,8 +439,8 @@ get_usage(zfs_help_t idx)
|
||||
return (gettext("\tredact <snapshot> <bookmark> "
|
||||
"<redaction_snapshot> ...\n"));
|
||||
case HELP_REWRITE:
|
||||
return (gettext("\trewrite [-Prvx] [-o <offset>] [-l <length>] "
|
||||
"<directory|file ...>\n"));
|
||||
return (gettext("\trewrite [-CPSrvx] [-o <offset>] "
|
||||
"[-l <length>] <directory|file ...>\n"));
|
||||
case HELP_JAIL:
|
||||
return (gettext("\tjail <jailid|jailname> <filesystem>\n"));
|
||||
case HELP_UNJAIL:
|
||||
@@ -9080,11 +9080,17 @@ zfs_do_rewrite(int argc, char **argv)
|
||||
zfs_rewrite_args_t args;
|
||||
memset(&args, 0, sizeof (args));
|
||||
|
||||
while ((c = getopt(argc, argv, "Pl:o:rvx")) != -1) {
|
||||
while ((c = getopt(argc, argv, "CPSl:o:rvx")) != -1) {
|
||||
switch (c) {
|
||||
case 'C':
|
||||
args.flags |= ZFS_REWRITE_SKIP_BRT;
|
||||
break;
|
||||
case 'P':
|
||||
args.flags |= ZFS_REWRITE_PHYSICAL;
|
||||
break;
|
||||
case 'S':
|
||||
args.flags |= ZFS_REWRITE_SKIP_SNAPSHOT;
|
||||
break;
|
||||
case 'l':
|
||||
args.len = strtoll(optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user