On Feb 4, 2021, at 4:33 PM, Larry McVoy <lm(a)mcvoy.com> wrote:
Ignoring the page cache and make their own cache has big problems.
You can mmap() ZFS files and doing so means that when a page is referenced
it is copied from the ZFS cache to the page cache. That creates a
coherency problem, I can write via the mapping and I can write via
write(2) and now you have two copies of the data that don't match,
that's pretty much OS no-no #1.
Write(2)ing to a mapped page sounds pretty dodgy. Likely to get you
in trouble in any case. Similarly read(2)ing. And you can keep track of
mapped pages and read/write from them if necessary even if you have
a separate cache for any compressed pages. I haven’t read zfs code
but this doesn’t seem like a tricky problem.