Re: Problems with determining data presence by examining extents?

David Howells
2020-01-15T14:20:31Z

Andreas Dilger <adilger@dilger.ca> wrote:

> > Would you like to explain why you want to know such fs internal info?
>
> I believe David wants it to store sparse files as an cache and use FIEMAP to
> determine if the blocks are cached locally, or if they need to be fetched from
> the server. If the filesystem doesn't store the written blocks accurately,
> there is no way for the local cache to know whether it is holding valid data
> or not.

More or less. I have no particular attachment to bmap or FIEMAP as the
interface to use. I'm just interested in finding out quickly if the data I
want is present.

If call_read_iter() will return a short read on hitting a hole, I can manage
if I can find out if just the first byte is present.

Finding out if the block is present allows me to avoid shaping read requests
from VM readahead into 256k blocks - which may require the allocation of extra
pages for bufferage.

David