On Wed, Jan 24, 2024 at 02:33:22PM +1030, Qu Wenruo wrote: > I'm pretty sure we would have some filesystems go utilizing larger folios to > implement their multi-page block size support. > > Thus in that case, can we have an interface change to make all folio > versions of filemap_*() to accept a file offset instead of page index? You're confused. There's no change needed to the filemap API to support large folios used by large block sizes. Quite possibly more of btrfs is confused, but it's really very simple. index == pos / PAGE_SIZE. That's all. Even if you have a 64kB block size device on a 4kB PAGE_SIZE machine. That implies that folios must be at least order-4, but you can still look up a folio at index 23 and get back the folio which was stored at index 16 (range 16-31). hugetlbfs made the mistake of 'hstate->order' and it's still not fixed. It's a little better than it was (thanks to Sid), but more work is needed. Just use the same approach as THPs or you're going to end up hurt.