HomeFreeBSD

makefs: Implement the collision differentiator for micro ZAPs

Description

makefs: Implement the collision differentiator for micro ZAPs

In the unlikely event of a hash collision, the collision differentiator
is used to create a unique lookup key for ZAP entries. While the fat
ZAP implementation in makefs implemented this, the micro ZAP
implementation did not, so it's possible to end up with collisions in
directory entries. These are caught deterministically by OpenZFS, but
the result is a panic.

Implement a simple differentiator by simply assigning a unique value to
each ZAP entry. This scheme works since the 16-bit space of
differentiators is larger than the maximum number of entries in a micro
ZAP. (While the on-disk encoding provides 32 bits of space for the
differentiator, the in-memory representation of micro ZAP entries is
smaller.)

PR: 287482
MFC after: 1 week

(cherry picked from commit 64e0b2e8f75286f9f4d85a86fbb6815b435c7096)

Details

Provenance
markjAuthored on Jun 16 2025, 8:33 PM
Parents
rG1b09c94e950c: Obsoletefiles.inc: Correct paths for some man pages
Branches
Unknown
Tags
Unknown