Skip to content

Conversation

@aaron-ang
Copy link
Contributor

@aaron-ang aaron-ang commented Jan 5, 2026

Close #3906.

Dedupe reflink bytes only when --apparent-size or --bytes flag is set, based on GNU du page.

Implementation

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@aaron-ang aaron-ang force-pushed the du-reflink-count branch 2 times, most recently from afa86ce to 44ae977 Compare January 6, 2026 00:23
@aaron-ang aaron-ang marked this pull request as ready for review January 6, 2026 00:37
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

GNU testsuite comparison:

GNU test failed: tests/shuf/shuf-reservoir. tests/shuf/shuf-reservoir is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/sort/sort-stale-thread-mem. tests/sort/sort-stale-thread-mem is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@aaron-ang aaron-ang force-pushed the du-reflink-count branch 2 times, most recently from 1ef975e to 5bc43b7 Compare January 7, 2026 23:54
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 8, 2026

Merging this PR will degrade performance by 7.84%

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 247 untouched benchmarks
⏩ 70 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory sort_numeric[500000] 48.7 MB 47.3 MB +3.06%
Memory sort_key_field[500000] 32.8 MB 31.4 MB +4.63%
Memory cp_large_file[16] 110.3 KB 119.7 KB -7.84%

Comparing aaron-ang:du-reflink-count (26a4b12) with main (98d3dba)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@aaron-ang aaron-ang marked this pull request as draft January 8, 2026 18:32
@aaron-ang aaron-ang marked this pull request as ready for review January 9, 2026 00:00
@aaron-ang aaron-ang marked this pull request as draft January 9, 2026 00:12
@aaron-ang aaron-ang force-pushed the du-reflink-count branch 3 times, most recently from d28fb14 to e27dc67 Compare January 9, 2026 00:29
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

GNU testsuite comparison:

GNU test failed: tests/tail/retry. tests/tail/retry is passing on 'main'. Maybe you have to rebase?

@aaron-ang aaron-ang marked this pull request as ready for review January 9, 2026 00:47

#[cfg(not(windows))]
use regex::Regex;
#[cfg(target_os = "linux")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow this is the first time I've seen this notation, this is really nice and would be nice to cleanup our other cfg code

@ChrisDryden
Copy link
Collaborator

Just to clarify that my understanding matches yours. This would be extending past GNU's capabilities instead of matching GNU's capabilities right? Given that its a big change I imagine it would be something that would be reviewed after the issues with GNU compatibility are sorted out


// Check existence of path provided in argument
let mut seen_inodes: HashSet<FileInfo> = HashSet::new();
let mut seen_shared_extents: HashSet<SharedExtentKey> = HashSet::new();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a pre-existing bug, theres another open PR about moving that seen_inodes out of this loop so that when you pass multiple file names it can deduplicate. Ideally this would be moved outside of the loop too

Copy link
Contributor Author

@aaron-ang aaron-ang Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated it.

@aaron-ang aaron-ang changed the title du: count reflink disk usage only once du: resolve hard links Jan 18, 2026
@aaron-ang aaron-ang changed the title du: resolve hard links du: dedupe reflink bytes Jan 18, 2026
@aaron-ang
Copy link
Contributor Author

Just to clarify that my understanding matches yours. This would be extending past GNU's capabilities instead of matching GNU's capabilities right? Given that its a big change I imagine it would be something that would be reviewed after the issues with GNU compatibility are sorted out

yea that's right.

@aaron-ang aaron-ang force-pushed the du-reflink-count branch 6 times, most recently from 1513fa4 to 9442287 Compare January 20, 2026 03:56
@aaron-ang aaron-ang force-pushed the du-reflink-count branch 3 times, most recently from b0de817 to 1beaff8 Compare January 20, 2026 04:25
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/follow-name (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/dd/stderr is no longer failing!
Congrats! The gnu test tests/tac/tac-2-nonseekable is no longer failing!
Congrats! The gnu test tests/tail/follow-stdin is no longer failing!

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.

count reflink disk usage only once in du

2 participants