On Wed, Jul 24, 2024 at 07:22:25PM +0000, Wengang Wang wrote: > > On Jul 16, 2024, at 9:11 PM, Dave Chinner <david@xxxxxxxxxxxxx> wrote: > >>> Indeed, if you used FIEMAP, you can pass a minimum > >>> segment length to filter out all the small extents. Iterating that > >>> extent list means all the ranges you need to defrag are in the holes > >>> of the returned mapping information. This would be much faster > >>> than an entire linear mapping to find all the regions with small > >>> extents that need defrag. The second step could then be doing a > >>> fine grained mapping of each region that we now know either contains > >>> fragmented data or holes.... > > > Where can we pass a minimum segment length to filter out things? > I don’t see that in the fiemap structure: Oh, sorry, too many similar APIs - it's FITRIM that has a minimum length filter build into it. It's something we could add if we really need it. -Dave. -- Dave Chinner david@xxxxxxxxxxxxx