Skip to content

fiemap: single-ioctl rescan in fiemap_scan_extent - #14

Merged
martinus merged 1 commit into
masterfrom
perf/fiemap-scan-single-ioctl
Jul 15, 2026
Merged

fiemap: single-ioctl rescan in fiemap_scan_extent#14
martinus merged 1 commit into
masterfrom
perf/fiemap-scan-single-ioctl

Conversation

@martinus

Copy link
Copy Markdown
Owner

Follow-up to the markfasheh#402 port. fiemap_scan_extent() only reads the first extent's physical offset, but went through do_fiemap_range() — which does a count ioctl, a calloc, then a second ioctl to map the whole range.

Adds fiemap_first_extent_poff(): a single FS_IOC_FIEMAP ioctl into a one-extent stack buffer (no count pass, no allocation), and uses it in fiemap_scan_extent(). Keeps the ioctl in fiemap.c behind a documented helper.

Measured on an extent-dedupe run over a ~400-extent shared region: FIEMAP ioctls during dedupe 1336 → 660 (~2×) on that path. Data preserved (file digests unchanged before/after), sharing unaffected, 39 integration tests pass.

🤖 Generated with Claude Code

fiemap_scan_extent() only needs the first extent's physical offset, but
went through do_fiemap_range(), which issues a count ioctl, a calloc, and
a second ioctl to map the whole range. Add fiemap_first_extent_poff(): a
single fiemap ioctl into a one-extent stack buffer, no count pass, no
allocation. Follow-up to the ranged-fiemap change (port of markfasheh#402).

On an extent-dedupe run over a ~400-extent shared region, FIEMAP ioctls
during dedupe dropped from 1336 to 660 (~2x on that path). Data is
preserved (file digests unchanged) and sharing is unaffected; 39
integration tests pass.

Co-Authored-By: Claude Fable 5 <[email protected]>
@martinus
martinus merged commit 4f6d66a into master Jul 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant