On Thu, Jul 13, 2023 at 03:42:18PM +0100, Matthew Wilcox wrote: > On Thu, Jul 13, 2023 at 01:04:39AM -0400, Kent Overstreet wrote: > > On Mon, Jul 10, 2023 at 02:02:51PM +0100, Matthew Wilcox (Oracle) wrote: > > > Allow callers of __filemap_get_folio() to specify a preferred folio > > > order in the FGP flags. This is only honoured in the FGP_CREATE path; > > > if there is already a folio in the page cache that covers the index, > > > we will return it, no matter what its order is. No create-around is > > > attempted; we will only create folios which start at the specified index. > > > Unmodified callers will continue to allocate order 0 folios. > > > > Why not just add an end_index parameter to filemap_get_folio()? > > I'm reluctant to add more parameters. Aside from the churn, every extra > parameter makes the function that little bit harder to use. I like this > encoding; users who don't know/care about it get the current default > behaviour, and it's a simple addition to the users who do want to care. > end_index is particularly tricky ... what if it's lower than index? But we're refactoring all this code (and chaning our thinking) to extents/ranges, not blocks - I'd say end_index is more natural in the long run. Plus, it lets us put the logic for "how big of a folio do we want to allocate" in one place. (end_index < index is just a BUG_ON()).