BRT: Fix ZAP entry endianness

During original block cloning implementation a mistake was made,
making BRT ZAP entries an array of 8 1-byte entries instead of 1
entry of 8 bytes. This makes the pools non-endian-safe.

This commit introduces a new read-compatible pool feature
"com.truenas:block_cloning_endian", fixing the endianness issue
for new pools while maintaining compatibility with existing ones.

The feature is automatically activated when creating the first BRT
ZAP (ensuring we don't activate it on pools that already have BRT
entries in the old format).  When active, BRT entries are stored
as single 8-byte values.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <alexander.motin@TrueNAS.com>
Closes #17572
This commit is contained in:
Alexander Motin
2025-07-30 12:42:47 -04:00
committed by GitHub
parent 10a78e2647
commit f70c85086b
6 changed files with 81 additions and 19 deletions
+11
View File
@@ -401,6 +401,17 @@ This feature becomes
.Sy active
when first block is cloned.
When the last cloned block is freed, it goes back to the enabled state.
.feature com.truenas block_cloning_endian yes
This feature corrects ZAP entry endianness issues in the Block Reference
Table (BRT) used by block cloning.
During the original block cloning implementation, BRT ZAP entries were
mistakenly stored as arrays of 8 single-byte entries instead of single
8-byte entries, making pools non-endian-safe.
.Pp
This feature is activated when the first BRT ZAP is created (that way
ensuring compatibility with existing pools).
When active, new BRT entries are stored in the correct endian-safe format.
The feature becomes inactive when all BRT ZAPs are destroyed.
.feature com.delphix bookmarks yes extensible_dataset
This feature enables use of the
.Nm zfs Cm bookmark