aboutsummaryrefslogtreecommitdiff
path: root/include/fuse_common.h
diff options
context:
space:
mode:
authorAlessio Balsini <balsini@google.com>2020-07-01 14:14:28 +0100
committerAlessio Balsini <balsini@google.com>2020-11-12 19:31:48 +0000
commit74ea28e46b6860a7663341a4268d6685699e302f (patch)
tree055ee0ab46564340653c868355e99db244210fcc /include/fuse_common.h
parent5d3920545beef6b010e555fbd19a94b3d3e056d9 (diff)
downloadlibfuse-74ea28e46b6860a7663341a4268d6685699e302f.tar.gz
Enable passthrough mode for read/write operations
Add support for filesystem passthrough read/write of files. When the FUSE_PASSTHROUGH capability is enabled, the FUSE daemon may decide while handling the "open" or "create" operation, 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 lower filesystem rather than to the FUSE daemon. All requests that aren't read or write are still handled by the userspace code. 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. Bug: 168023149 Test: atest ScopedStorageTest Signed-off-by: Alessio Balsini <balsini@android.com> Change-Id: I38aff0cf7198b7cd92eccc97547d47f4e1132b00
Diffstat (limited to 'include/fuse_common.h')
-rw-r--r--include/fuse_common.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 2d686b2..7ac28d7 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -92,6 +92,11 @@ struct fuse_file_info {
* same file handle. */
uint64_t fh;
+ /** Passthrough file handle id. May be filled in by filesystem in
+ * create and open. It is used to create a passthrough connection
+ * between FUSE file and lower file system file. */
+ uint32_t passthrough_fh;
+
/** Lock owner id. Available in locking operations and flush */
uint64_t lock_owner;
@@ -359,6 +364,18 @@ struct fuse_loop_config {
#define FUSE_CAP_NO_OPENDIR_SUPPORT (1 << 24)
/**
+ * Indicates support for passthrough mode access for read/write operations.
+ *
+ * If this flag is set in the `capable` field of the `fuse_conn_info`
+ * structure, then the FUSE kernel module supports redirecting read/write
+ * operations to the lower file system instead of letting them to be handled
+ * by the FUSE daemon.
+ *
+ * This feature is disabled by default.
+ */
+#define FUSE_CAP_PASSTHROUGH (1 << 31)
+
+/**
* Ioctl flags
*
* FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine