Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 ==============
0004 Fuse I/O Modes
0005 ==============
0006 
0007 Fuse supports the following I/O modes:
0008 
0009 - direct-io
0010 - cached
0011   + write-through
0012   + writeback-cache
0013 
0014 The direct-io mode can be selected with the FOPEN_DIRECT_IO flag in the
0015 FUSE_OPEN reply.
0016 
0017 In direct-io mode the page cache is completely bypassed for reads and writes.
0018 No read-ahead takes place. Shared mmap is disabled.
0019 
0020 In cached mode reads may be satisfied from the page cache, and data may be
0021 read-ahead by the kernel to fill the cache.  The cache is always kept consistent
0022 after any writes to the file.  All mmap modes are supported.
0023 
0024 The cached mode has two sub modes controlling how writes are handled.  The
0025 write-through mode is the default and is supported on all kernels.  The
0026 writeback-cache mode may be selected by the FUSE_WRITEBACK_CACHE flag in the
0027 FUSE_INIT reply.
0028 
0029 In write-through mode each write is immediately sent to userspace as one or more
0030 WRITE requests, as well as updating any cached pages (and caching previously
0031 uncached, but fully written pages).  No READ requests are ever sent for writes,
0032 so when an uncached page is partially written, the page is discarded.
0033 
0034 In writeback-cache mode (enabled by the FUSE_WRITEBACK_CACHE flag) writes go to
0035 the cache only, which means that the write(2) syscall can often complete very
0036 fast.  Dirty pages are written back implicitly (background writeback or page
0037 reclaim on memory pressure) or explicitly (invoked by close(2), fsync(2) and
0038 when the last ref to the file is being released on munmap(2)).  This mode
0039 assumes that all changes to the filesystem go through the FUSE kernel module
0040 (size and atime/ctime/mtime attributes are kept up-to-date by the kernel), so
0041 it's generally not suitable for network filesystems.  If a partial page is
0042 written, then the page needs to be first read from userspace.  This means, that
0043 even for files opened for O_WRONLY it is possible that READ requests will be
0044 generated by the kernel.