Enable passthrough mode for read/write operations (#919)
authorAmir Goldstein <amir73il@gmail.com>
Mon, 13 May 2024 13:30:25 +0000 (16:30 +0300)
committerGitHub <noreply@github.com>
Mon, 13 May 2024 13:30:25 +0000 (15:30 +0200)
commiteca63dab456a10c3491c367711ab18cbcb34816e
treeef644bbcdb271db33525166e75c6b21b0bb04414
parent58f85bfa9b7dca9a216cd0bb4e38e9cdf4b661da
Enable passthrough mode for read/write operations (#919)

Add support for filesystem passthrough read/write of files.

When the FUSE_PASSTHROUGH capability is enabled, the FUSE server may
decide, while handling the "open" or "create" requests, if the given
file can be accessed by that process in "passthrough" mode, meaning that
all the further read and write operations would be forwarded by the
kernel directly to the backing file rather than to the FUSE server.
All requests other than read or write are still handled by the server.

This allows for an improved performance on reads and writes, especially
in the case of reads at random offsets, for which no (readahead)
caching mechanism would help, reducing the performance gap between FUSE
and native filesystem access.

Extend also the passthrough_hp example with the new passthrough feature.
This example opens a kernel backing file per FUSE inode on the first
FUSE file open of that inode and closes the backing file on the release
of the last FUSE file on that inode.

All opens of the same inode passthrough to the same backing file.
A combination of fi->direct_io and fi->passthrough is allowed.
It means that read/write operations go directly to the server, but mmap
is done on the backing file.

This allows to open some fds of the inode in passthrough mode and some
fd of the same inode in direct_io/passthrough_mmap mode.

Signed-off-by: Alessio Balsini <balsini@android.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
example/passthrough_hp.cc
include/fuse_common.h
include/fuse_kernel.h
include/fuse_lowlevel.h
lib/fuse_lowlevel.c
lib/fuse_versionscript