<!DOCTYPE html><html><head><title></title></head><body><div>Hi,</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Could you advise on how to achieve this goal with the new fanotify mechanism?<br></div><div><br></div><div>If you're interested you can find all the code here: <a href="https://github.com/dnr/styx/">https://github.com/dnr/styx/</a></div><div><br></div><div>Thanks,</div><div>David</div></body></html>