From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40903 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934880AbdIYT3o (ORCPT ); Mon, 25 Sep 2017 15:29:44 -0400 From: Nikolaus Rath To: Miklos Szeredi Cc: Miklos Szeredi , fuse-devel , Maxim Patlasov , linux-fsdevel Subject: Re: [fuse-devel] [fuse] getattr() results ignored when writeback cache is active References: <87zi9pk2ra.fsf@vostro.rath.org> <87vakdjsjj.fsf@vostro.rath.org> <87r2v1jphd.fsf@vostro.rath.org> <87tvzw9bma.fsf@vostro.rath.org> <20170925091218.GE19278@veci.piliscsaba.szeredi.hu> Date: Mon, 25 Sep 2017 10:25:48 +0100 In-Reply-To: <20170925091218.GE19278@veci.piliscsaba.szeredi.hu> (Miklos Szeredi's message of "Mon, 25 Sep 2017 11:12:18 +0200") Message-ID: <87lgl35dur.fsf@vostro.rath.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sep 25 2017, Miklos Szeredi wrote: > Fuse supports the following I/O modes: > > - direct-io > - cached > + write-through > + writeback-cache > > The direct-io mode can be selected with the FOPEN_DIRECT_IO flag in the > FUSE_OPEN reply. > > In direct-io mode the page cache is completely bypassed for reads and wri= tes. > No read-ahead takes place. Shared mmap is disabled. > > In cached mode reads may be satisfied from the page cache, and data may be > read-ahead by the kernel to fill the cache. The cache is always kept con= sistent > after any writes to the file. All mmap modes are supported. > > The cached mode has two sub modes controlling how writes are handled. The > write-through mode is the default and is supported on all kernels. The > writeback-cache mode may be selected by the FUSE_WRITEBACK_CACHE flag in = the > FUSE_INIT reply. > > In write-through mode each write is immediately sent to userspace as one = or more > WRITE requests, as well as updating any cached pages (and caching previou= sly > uncached, but fully written pages). No READ requests are ever sent for w= rites, > so when an uncached page is partially written, the page is discarded. > > In writeback-cache mode (enabled by the FUSE_WRITEBACK_CACHE flag) writes= go to > the cache only, which means that the write(2) syscall can often complete = very > fast. Dirty pages are written back implicitly (background writeback or p= age > reclaim on memory pressure) or explicitly (invoked by close(2), fsync(2) = and > when the last ref to the file is being released on munmap(2)). This mode > assumes that all changes to the filesystem go through the FUSE kernel mod= ule > (size and atime/ctime/mtime attributes are kept up-to-date by the kernel)= , so > it's generally not suitable for network filesystems. If a partial page is > written, then the page needs to be first read from userspace. This means= , that > even for files opened for O_WRONLY it is possible that READ requests will= be > generated by the kernel. Looks great to me. Best, -Nikolaus --=20 GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F =C2=BBTime flies like an arrow, fruit flies like a Banana.=C2= =AB