mirror_zfs/module/zfs
Alexander Motin 4ae8bf406b Allow physical rewrite without logical
During regular block writes ZFS sets both logical and physical
birth times equal to the current TXG.  During dedup and block
cloning logical birth time is still set to the current TXG, but
physical may be copied from the original block that was used.
This represents the fact that logically user data has changed,
but the physically it is the same old block.

But block rewrite introduces a new situation, when block is not
changed logically, but stored in a different place of the pool.
From ARC, scrub and some other perspectives this is a new block,
but for example for user applications or incremental replication
it is not.  Somewhat similar thing happen during remap phase of
device removal, but in that case space blocks are still acounted
as allocated at their logical birth times.

This patch introduces a new "rewrite" flag in the block pointer
structure, allowing to differentiate physical rewrite (when the
block is actually reallocated at the physical birth time) from
the device reval case (when the logical birth time is used).

The new functionality is not used at this point, and the only
expected change is that error log is now kept in terms of physical
physical birth times, rather than logical, since if a block with
logged error was somehow rewritten, then the previous error does
not matter any more.

This change also introduces a new TRAVERSE_LOGICAL flag to the
traverse code, allowing zfs send, redact and diff to work in
context of logical birth times, ignoring physical-only rewrites.
It also changes nothing at this point due to lack of those writes,
but they will come in a following patch.

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
2025-08-06 10:36:07 -07:00
..
abd.c Export correct symbols for Lustre Direct I/O 2025-04-24 13:55:21 -04:00
aggsum.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
arc.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
blake3_zfs.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
blkptr.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
bplist.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
bpobj.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
bptree.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
bqueue.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
brt.c BRT: Fix ZAP entry endianness 2025-07-30 09:42:47 -07:00
btree.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dataset_kstats.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dbuf_stats.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dbuf.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
ddt_log.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
ddt_stats.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
ddt_zap.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
ddt.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dmu_diff.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dmu_direct.c zio: rename io_reexecute as io_post; use it for the direct IO checksum error flag 2025-07-04 23:16:14 -04:00
dmu_object.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dmu_objset.c ZVOL: Unify zvol minors operations and improve error handling 2025-08-06 10:10:52 -04:00
dmu_recv.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dmu_redact.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dmu_send.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dmu_traverse.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dmu_tx.c Clarify and restrict dmu_tx_assign() errors 2025-06-23 15:48:30 -04:00
dmu_zfetch.c Wire O_DIRECT also to Uncached I/O (#17218) 2025-05-13 14:26:55 -07:00
dmu.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dnode_sync.c Wire O_DIRECT also to Uncached I/O (#17218) 2025-05-13 14:26:55 -07:00
dnode.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
dsl_bookmark.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dsl_crypt.c ZVOL: Unify zvol minors operations and improve error handling 2025-08-06 10:10:52 -04:00
dsl_dataset.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dsl_deadlist.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dsl_deleg.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dsl_destroy.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dsl_dir.c Clarify and restrict dmu_tx_assign() errors 2025-06-23 15:48:30 -04:00
dsl_pool.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dsl_prop.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dsl_scan.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
dsl_synctask.c dmu_tx_assign: make all VERIFY0 calls use DMU_TX_SUSPEND 2025-05-28 10:28:59 -07:00
dsl_userhold.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
edonr_zfs.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
fm.c tunables: ensure tunable and variable have same define gate 2025-05-28 16:50:22 -07:00
gzip.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
hkdf.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
lz4_zfs.c SPDX: license tags: BSD-2-Clause 2025-03-13 17:56:46 -07:00
lz4.c SPDX: license tags: BSD-2-Clause 2025-03-13 17:56:46 -07:00
lzjb.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
metaslab.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
mmp.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
multilist.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
objlist.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
pathname.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
range_tree.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
refcount.c Implement allocation size ranges and use for gang leaves (#17111) 2025-05-02 15:32:18 -07:00
rrwlock.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
sa.c Wire O_DIRECT also to Uncached I/O (#17218) 2025-05-13 14:26:55 -07:00
sha2_zfs.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
skein_zfs.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
spa_checkpoint.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
spa_config.c tunables: ensure tunable and variable have same define gate 2025-05-28 16:50:22 -07:00
spa_errlog.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
spa_history.c dmu_tx: rename dmu_tx_assign() flags from TXG_* to DMU_TX_* (#17143) 2025-03-18 16:04:22 -07:00
spa_log_spacemap.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
spa_misc.c Add TXG timestamp database 2025-08-06 10:31:21 -07:00
spa_stats.c Wire O_DIRECT also to Uncached I/O (#17218) 2025-05-13 14:26:55 -07:00
spa.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
space_map.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
space_reftree.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
THIRDPARTYLICENSE.cityhash OpenZFS 8484 - Implement aggregate sum and use for arc counters 2018-06-06 09:35:59 -07:00
THIRDPARTYLICENSE.cityhash.descrip OpenZFS 8484 - Implement aggregate sum and use for arc counters 2018-06-06 09:35:59 -07:00
txg.c txg_wait_synced_flags: add TXG_WAIT_SUSPEND flag to not wait if pool suspended 2025-05-28 10:27:46 -07:00
uberblock.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
unique.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_draid_rand.c SPDX: license tags: LicenseRef-OpenZFS-ThirdParty-PublicDomain 2025-03-13 17:57:31 -07:00
vdev_draid.c Fix other nonrot bugs 2025-06-19 09:25:58 -04:00
vdev_file.c Implement allocation size ranges and use for gang leaves (#17111) 2025-05-02 15:32:18 -07:00
vdev_indirect_births.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_indirect_mapping.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_indirect.c zio: rename io_reexecute as io_post; use it for the direct IO checksum error flag 2025-07-04 23:16:14 -04:00
vdev_initialize.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
vdev_label.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_mirror.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
vdev_missing.c Implement allocation size ranges and use for gang leaves (#17111) 2025-05-02 15:32:18 -07:00
vdev_queue.c Unified allocation throttling (#17020) 2025-03-24 09:25:01 -07:00
vdev_raidz_math_aarch64_neon_common.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_aarch64_neon.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_aarch64_neonx2.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_avx2.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_avx512bw.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_avx512f.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_impl.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_powerpc_altivec_common.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_powerpc_altivec.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_scalar.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_sse2.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math_ssse3.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
vdev_raidz_math.c tunables: don't assert initialisation in impl getters 2025-05-28 16:50:22 -07:00
vdev_raidz.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
vdev_rebuild.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
vdev_removal.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
vdev_root.c Implement allocation size ranges and use for gang leaves (#17111) 2025-05-02 15:32:18 -07:00
vdev_trim.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
vdev.c range_tree: Provide more debug details upon unexpected add/remove 2025-07-31 10:44:42 -04:00
zap_leaf.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zap_micro.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zap.c everywhere: misc unnecessary var init/update 2025-07-22 15:23:58 -07:00
zcp_get.c zcp: get_prop: fix encryptionroot and encryption 2025-05-27 20:04:37 -04:00
zcp_global.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zcp_iter.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zcp_set.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zcp_synctask.c zcp_synctask: add zfs.sync.clone() 2025-06-10 14:53:10 -07:00
zcp.c ZVOL: Unify zvol minors operations and improve error handling 2025-08-06 10:10:52 -04:00
zfeature.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_byteswap.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_chksum.c Faster checksum benchmark on system boot 2025-07-29 17:09:48 -07:00
zfs_crrd.c Add TXG timestamp database 2025-08-06 10:31:21 -07:00
zfs_debug_common.c nvlist: Add nvlist_snprintf() and zfs_dbgmsg_nvlist() 2025-04-18 09:22:16 -04:00
zfs_fm.c events: include zio type in IO error reports 2025-05-30 10:29:29 -04:00
zfs_fuid.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_impl.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_ioctl.c Add TXG timestamp database 2025-08-06 10:31:21 -07:00
zfs_log.c Allow and prefer special vdevs as ZIL 2025-07-18 18:44:14 -07:00
zfs_onexit.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_quota.c Show default quotas in zfs userspace tools 2025-04-03 10:36:45 -07:00
zfs_ratelimit.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_replay.c dmu_tx: rename dmu_tx_assign() flags from TXG_* to DMU_TX_* (#17143) 2025-03-18 16:04:22 -07:00
zfs_rlock.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zfs_sa.c dmu_tx: rename dmu_tx_assign() flags from TXG_* to DMU_TX_* (#17143) 2025-03-18 16:04:22 -07:00
zfs_vnops.c Linux: sync: remove async/sync accounting 2025-08-06 09:54:30 -07:00
zfs_znode.c Add default user/group/project quota properties 2025-04-03 10:35:22 -07:00
zil.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
zio_checksum.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
zio_compress.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zio_inject.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zio.c Allow physical rewrite without logical 2025-08-06 10:36:07 -07:00
zle.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zrlock.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zthr.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zvol.c ZVOL: Unify zvol minors operations and improve error handling 2025-08-06 10:10:52 -04:00