]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
FUSE: The FUSE design expects writethrough caching
authorConrad Meyer <cem@FreeBSD.org>
Fri, 15 Feb 2019 22:52:49 +0000 (22:52 +0000)
committerConrad Meyer <cem@FreeBSD.org>
Fri, 15 Feb 2019 22:52:49 +0000 (22:52 +0000)
commitc4af8b173ae69e60ca698b754e71d4bb89687dfc
treeac5037191059f05ede81909b2833cfa4db7f5a6d
parent194e691aaf96c98d44ff04ea634fc4acf9d86a19
FUSE: The FUSE design expects writethrough caching

At least prior to 7.23 (which adds FUSE_WRITEBACK_CACHE), the FUSE protocol
specifies only clean data to be cached.

Prior to this change, we implement and default to writeback caching.  This
is ok enough for local only filesystems without hardlinks, but violates the
general design contract with FUSE and breaks distributed filesystems or
concurrent access to hardlinks of the same inode.

In this change, add cache mode as an extension of cache enable/disable.  The
new modes are UC (was: cache disabled), WT (default), and WB (was: cache
enabled).

For now, WT caching is implemented as write-around, which meets the goal of
only caching clean data.  WT can be better than WA for workloads that
frequently read data that was recently written, but WA is trivial to
implement.  Note that this has no effect on O_WRONLY-opened files, which
were already coerced to write-around.

Refs:
  * https://sourceforge.net/p/fuse/mailman/message/8902254/
  * https://github.com/vgough/encfs/issues/315

PR: 230258 (inspired by)
sys/fs/fuse/fuse_io.c
sys/fs/fuse/fuse_ipc.h
sys/fs/fuse/fuse_node.c