android_kernel_oneplus_msm8998/fs/fuse/fuse_passthrough.h
Nikhilesh Reddy 5a9fde57cf fuse: Add support for passthrough read/write
Add support for filesystem passthrough read/write of files
when enabled in userspace through the option FUSE_PASSTHROUGH.

There are many FUSE based filesystems that perform checks or
enforce policy or perform some kind of decision making in certain
functions like the "open" call but simply act as a "passthrough"
when performing operations such as read or write.

When FUSE_PASSTHROUGH is enabled all the reads and writes
to the fuse mount point go directly to the passthrough filesystem
i.e a native filesystem that actually hosts the files rather than
through the fuse daemon. All requests that aren't read/write still
go thought the userspace code.

This allows for significantly better performance on read and writes.
The difference in performance between fuse and the native lower
filesystem is negligible.

There is also a significant cpu/power savings that is achieved which
is really important on embedded systems that use fuse for I/O.

Changelog:

v5:
Fix the check when setting the passthrough file
[Found when testing by Mike Shal]

v3 and v4:
Use the fs_stack_depth to prevent further stacking and a minor fix
[Fix suggested by Jann Horn]

v2:
Changed the feature name to passthrough from stacked_io
[Proposed by Linus Torvalds]

Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>
2016-03-22 11:15:47 -07:00

31 lines
996 B
C

/*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _FS_FUSE_PASSTHROUGH_H
#define _FS_FUSE_PASSTHROUGH_H
#include "fuse_i.h"
#include <linux/fuse.h>
#include <linux/file.h>
void fuse_setup_passthrough(struct fuse_conn *fc, struct fuse_req *req);
ssize_t fuse_passthrough_read_iter(struct kiocb *iocb, struct iov_iter *to);
ssize_t fuse_passthrough_write_iter(struct kiocb *iocb, struct iov_iter *from);
void fuse_passthrough_release(struct fuse_file *ff);
#endif /* _FS_FUSE_PASSTHROUGH_H */