mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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:
committed by
Brian Behlendorf
parent
4ae8bf406b
commit
60f714e6e2
+21
-7
@@ -31,7 +31,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm zfs
|
||||
.Cm rewrite
|
||||
.Oo Fl rvx Ns Oc
|
||||
.Oo Fl Prvx Ns Oc
|
||||
.Op Fl l Ar length
|
||||
.Op Fl o Ar offset
|
||||
.Ar file Ns | Ns Ar directory Ns …
|
||||
@@ -43,6 +43,15 @@ as is without modification at a new location and possibly with new
|
||||
properties, such as checksum, compression, dedup, copies, etc,
|
||||
as if they were atomically read and written back.
|
||||
.Bl -tag -width "-r"
|
||||
.It Fl P
|
||||
Perform physical rewrite, preserving logical birth time of blocks.
|
||||
By default, rewrite updates logical birth times, making blocks appear
|
||||
as modified in snapshots and incremental send streams.
|
||||
Physical rewrite preserves logical birth times, avoiding unnecessary
|
||||
inclusion in incremental streams.
|
||||
Physical rewrite requires the
|
||||
.Sy physical_rewrite
|
||||
feature to be enabled on the pool.
|
||||
.It Fl l Ar length
|
||||
Rewrite at most this number of bytes.
|
||||
.It Fl o Ar offset
|
||||
@@ -60,17 +69,22 @@ same as some property changes may increase pool space usage.
|
||||
Holes that were never written or were previously zero-compressed are
|
||||
not rewritten and will remain holes even if compression is disabled.
|
||||
.Pp
|
||||
Rewritten blocks will be seen as modified in next snapshot and as such
|
||||
included into the incremental
|
||||
.Nm zfs Cm send
|
||||
stream.
|
||||
.Pp
|
||||
If a
|
||||
.Fl l
|
||||
or
|
||||
.Fl o
|
||||
value request a rewrite to regions past the end of the file, then those
|
||||
regions are silently ignored, and no error is reported.
|
||||
.Pp
|
||||
By default, rewritten blocks update their logical birth time,
|
||||
meaning they will be included in incremental
|
||||
.Nm zfs Cm send
|
||||
streams as modified data.
|
||||
When the
|
||||
.Fl P
|
||||
flag is used, rewritten blocks preserve their logical birth time, since
|
||||
there are no user data changes.
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfsprops 7
|
||||
.Xr zfsprops 7 ,
|
||||
.Xr zpool-features 7
|
||||
|
||||
Reference in New Issue
Block a user