J. Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > On Mon, Mar 08, 2021 at 09:13:55AM +0000, David Howells wrote: > > Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > > With ->fiemap() you can at least make the distinction between a non existing > > > and an UNWRITTEN extent. > > > > I can't use that for XFS, Ext4 or btrfs, I suspect. Christoph and Dave's > > assertion is that the cache can't rely on the backing filesystem's metadata > > because these can arbitrarily insert or remove blocks of zeros to bridge or > > split extents. > > Could you instead make some sort of explicit contract with the > filesystem? Maybe you'd flag it at mkfs time and query for it before > allowing a filesystem to be used for fscache. You don't need every > filesystem to support fscache, right, just one acceptable one? I've asked about that, but the filesystem maintainers are reluctant to do that. Something might be possible in ext4 using direct access to jbd2, though I don't know exactly what facilities that offers. David