Re: [RFC PATCH 17/17] netfs: Combine prepare and issue ops and grab the buffers on request
From: Christoph Hellwig
Date: Wed Mar 04 2026 - 10:10:17 EST
On Wed, Mar 04, 2026 at 02:51:01PM +0000, David Howells wrote:
> > > +static int cachefiles_query_occupancy(struct netfs_cache_resources *cres,
> > > + struct fscache_occupancy *occ)
> > > +{
> >
> > Independent of fiemap or not, how is this supposed to work? File
> > systems can create speculative preallocations any time they want,
> > so simply querying for holes vs data will corrupt your cache trivially.
>
> SEEK_DATA and SEEK_HOLE avoid preallocations, I presume?
No, they can't. The file system doesn't even know what range is
a persistent preallocation or not. You need to track your cached
ranges yourself.