Replace bits-and-blooms/bitset with roaring bitmaps#2386
Conversation
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit 071137e. Bugbot is set up for automated code reviews on this repo. Configure here. |
fc7f1b4 to
0205899
Compare
6ec4c90 to
b81ec2a
Compare
b6fa8a5 to
b0717ba
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa35957fa3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7424c06 to
60f17c9
Compare
60f17c9 to
a55db6c
Compare
jakubno
left a comment
There was a problem hiding this comment.
Nice! 🚀 1 suggestion left in comments
2057d3d to
d975833
Compare
9e25080 to
4b07195
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4b07195. Configure here.
a7e1dfb to
23076a3
Compare
Use roaring v2.17.0 with the new Ranges() iterator throughout. Remove bitset as a direct dependency.
23076a3 to
071137e
Compare
…ch short-circuit Move the IsZero fast-path from the NBD dispatcher into block.Cache so it can split sub-block runs: - Cache.WriteAtWithoutLock now scans aligned full blocks per-block. All- zero blocks are punched (FALLOC_FL_PUNCH_HOLE) and marked Empty; non-zero blocks copy + mark Dirty. Contiguous zero runs coalesce into one fallocate call. A non-zero buffer with zero padding inside (the common shape for qcow2 preallocation, scratch wipes, format-then-write patterns) now contributes only the non-zero sub-blocks to the diff. - WriteZeroesAt and WriteAt share a single punchHole helper and use header.BlockCeilIdx/BlockIdx for alignment instead of local helpers. - nbd/dispatch cmdWrite drops the buffer-wide IsZero check (and its header import); zero-detection is now the cache's responsibility for every writer (NBD, copyProcessMemory if it ever wants it, etc.). - Tests updated: the three "zero block written as Dirty" tests added in #2386 documented the OLD behaviour and now flip — a zero block written through WriteAt routes to Empty and maps to uuid.Nil. New mixed-buffer test covers the sub-block split case explicitly.

Replace all direct usage of
bits-and-blooms/bitsetwithroaring/v2(v2.17.0). Uses the newRanges()iterator (#522) for range iteration inCreateMappingandBitmapRanges.