Add support for store notify
I'm writing a networked filesystem which reads data in 2MB blocks from remote database. However read requests from the kernel come in much smaller sizes - for example 4K-128K. Since it would be very slow to refetch the 2MB block for e.g. every consecutive 4K reads, a cache for fetched data is needed. A custom cache would do, however since the kernel already implements pagecache to cache file data, it is logical to use it directly. FUSE protocol provides primitives for pagecache control. We already have support for e.g. invalidating a data region for inode (InodeNotify), but there is more there. In particular it is possible to store and retrieve data into/from the kernel cache with "store notify" and "retrieve notify" messages: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fuse.h?id=v4.19-rc6-177-gcec4de302c5f#n68 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fuse.h?id=v4.19-rc6-177-gcec4de302c5f#n756 https://git.kernel.org/linus/a1d75f2582 https://git.kernel.org/linus/2d45ba381a This patch adds support for "store notify". Adding support for "retrieve notify" might be added later since a) it is not needed right now, and b) supporting it is a bit more work since the kernel sends a separate reply with data and infrastructure has to be added to glue it back to original "retrieve notify" server-originated request. For user-visible API I decided not to duplicate FUSE-protocol naming 1-1 and to be more explicit in names - emphasizing it is about cache control - it is e.g. InodeNotifyStoreCache instead of InodeNotifyStore, and for retrieving it (hopefully) should be just InodeRetrieveCache instead of InodeNotifyRetrieveCache and a separate callback. Thanks beforehand, Kirill
Showing
Please register or sign in to comment