Implement physical rewrites

Based on previous commit this implements `zfs rewrite -P` flag,
making ZFS to keep blocks logical birth times while rewriting
files.  It should exclude the rewritten blocks from incremental
sends, snapshot diffs, etc.  Snapshots space usage same time will
reflect the additional space usage from newly allocated blocks.

Since this begins to use new "rewrite" flag in the block pointers,
this commit introduces a new read-compatible per-dataset feature
physical_rewrite.  It must be enabled for the command to not fail,
it is activated on first use and deactivated on deletion of the
last affected dataset.

Reviewed-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:  Alexander Motin <alexander.motin@TrueNAS.com>
Closes #17565
This commit is contained in:
Alexander Motin
2025-07-23 15:51:00 -04:00
committed by Brian Behlendorf
parent 4ae8bf406b
commit 60f714e6e2
19 changed files with 270 additions and 18 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ tests = ['zfs_reservation_001_pos', 'zfs_reservation_002_pos']
tags = ['functional', 'cli_root', 'zfs_reservation']
[tests/functional/cli_root/zfs_rewrite]
tests = ['zfs_rewrite']
tests = ['zfs_rewrite', 'zfs_rewrite_physical']
tags = ['functional', 'cli_root', 'zfs_rewrite']
[tests/functional/cli_root/zfs_rollback]
+1 -1
View File
@@ -195,7 +195,7 @@ tests = ['zfs_reservation_001_pos', 'zfs_reservation_002_pos']
tags = ['functional', 'cli_root', 'zfs_reservation']
[tests/functional/cli_root/zfs_rewrite]
tests = ['zfs_rewrite']
tests = ['zfs_rewrite', 'zfs_rewrite_physical']
tags = ['functional', 'cli_root', 'zfs_rewrite']
[tests/functional/cli_root/zfs_rollback]