Hi,

I've been using erofs with the (deprecated) fscache integration in a project. I 
recently tried to switch it to use the new fanotify pre-content mechanism, but 
I'm running into differences in behavior.

Here's the basic architecture: It's very similar to a container image 
distribution use case, with chunk-based deduplication across images. I have 
erofs images which contain metadata and small inline data. Larger data uses 
chunk format inodes, and points to chunks in a different "device". The chunked 
data device is shared by all images.

With fscache, I use one fsid per image, and one fsid for all of the chunked 
data. In the read hook for the images, I write the whole erofs image. In the 
read hook for the data, I fetch just the requested chunk (plus some readahead) 
and write that to fscache. Once the data is present on disk, fscache just uses 
it and never sends another read hook.

With fanotify+pre-content, I'm noticing that my pre-content hook is called any 
time data is not in the page cache, even if the offset being read is already 
mapped on disk. This kind of defeats the purpose of on-demand fetching if it 
has to go to userspace for most reads. The goal would be to keep the read path 
in the kernel and only go to userspace to fetch data that isn't present on disk.

Could you advise on how to achieve this goal with the new fanotify mechanism?

If you're interested you can find all the code here: 
https://github.com/dnr/styx/

Thanks,
David

Reply via email to