On Sun, Mar 02, 2025 at 10:49:33PM +0100, Steinar H. Gunderson wrote: > On Mon, Mar 03, 2025 at 08:35:57AM +1100, Dave Chinner wrote: > > This does comparison one folio at a time and does no readahead. > > Hence if the data isn't already in cache, it is doing synchronous > > small reads and waiting for every single one of them. This really > > should use an internal interface that is capable of issuing > > readahead... > > Yes, I noticed that if I do dummy read() of each extent first, > it becomes _massively_ faster. I'm not sure if I trust posix_fadvise() > to just to MADV_WILLNEED given the manpage; would it work (and give > roughly the same readahead that read() seems to be doing)? The right thing to do it to just issue readahead in vfs_dedupe_file_range_compare. The ractl structure is a bit odd so it'll need slightky more careful thoughts than just a hacked up one-liner, but it should still be realtively simple. I can look into it once I find a little time if no one beats me to it.