Re: Discontiguous folios/pagesets

From: Christoph Hellwig
Date: Wed Sep 01 2021 - 05:41:14 EST


On Sat, Aug 28, 2021 at 08:04:15PM +0100, Matthew Wilcox wrote:
> Non-power-of-two folios are more awkward. Any calls to folio_order()
> and folio_shift() have to be guarded by folio_test_contig() (which will
> be fine). The bigger problem is the radix tree. It really only works
> for power-of-two sized objects (and honestly, it's not even all that
> great for things which aren't a power of 64 in size). See appendix
> for more details.

Honestly I think this framing the wrong problem. Folios are a way
to manage memory which should be about how to manage memory, not about
offloading awkward file systems tasks to performance sensitive core
code.

Right now the proper answer to supporting reflinks on RT devices with
non-power of two extent sizes is don't do it, which is pretty easy
given that XFS doesn't even support reflink on the RT device at all
yet. And if someone has a strong enough use case for eflinks on a weird
extent size RT device they'll find way to support it, preferably
without making a mess out of the core Linux memory management. Because
even if we did support non-power of two folios sizes we'd still need
to gurantee XFS would always be able to allocate one for that case,
which just sounds like a trainwreck waiting to happen.