fuse: Add support for shortcircuited read/write for files

Add support for shortcircuited read/write for files
when enabled through a userspace init option of
FUSE_SHORTCIRCUIT.

When FUSE_SHORTCIRCUIT is enabled all the reads and writes
to the fuse mount point go directly to the native filesystem
rather than through the fuse daemon. All requsts that aren't
read/write still go thought the userspace code.

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

Change-Id: I8258f356963505a2f8499f38879e9e36aba43ad4
Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>

fs:fuse: Ensure update of fuse inode attributes in shortcircuit

Ensure that in shortcircuit mode the fuse inode attributes always
reflect those of the native filesystem by forcing an attribute copy.

Change-Id: Ie4d322c9b8e0d3b49d195801dab4cc86d8df11e2
Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>

fuse: Use iocb->ki_pos instead of pos for shortcircuit writes

Use iocb->ki_pos instead of pos to handle the cases of files that are
opened with O_APPEND. For example if multiple processes open the same
file with O_APPEND then the iocb->ki_pos will not be equal to the new
pos value that is updated with the file size(to guarantee appends even
when the file has grown due to the writes by another process).

We should use iocb->pos here since the lower filesystem is expected to
adjust for O_APPEND anyway and may need to adjust the size for the file
changes that occur due to some processes writing directly to the lower
filesystem.

Change-Id: I279e3ea96cdfd020c45f4cd348f6e1b4bd48a3fb
Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>

fuse: Use BUG_ON to check pos validity in fuse_aio_write

Change the check that iocb->ki_pos should be equal to pos
to a BUG_ON from a WARN_ON to ensure we actually catch
the bug before it propagates down and causes other errors.

Change-Id: Ie6d537f3182f638a50166b456226e9c10bb1e3d4
Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>
9 files changed