[Bug 235774] [FUSE]: Need to evict invalidated cache contents on fuse_write_directbackend()

Conrad Meyer cem at freebsd.org
Wed Mar 6 21:49:02 UTC 2019


Hi Rick,

On Wed, Mar 6, 2019 at 1:32 PM Rick Macklem <rmacklem at uoguelph.ca> wrote:
>
> --- Comment #4 from Conrad Meyer <cem at freebsd.org> ---
> >I think fuse's IO_DIRECT path is a mess.  Really all IO should go through the
> >buffer cache, and B_DIRECT and ~B_CACHE are just flags that control the
> >buffer's lifetime once the operation is complete.  Removing the "direct"
> >backends entirely (except as implementation details of strategy()) would
> >simplify and correct the caching logic.
>
> Hmm, I'm not sure that I agree that all I/O should go through the buffer cache,
> in general. (I won't admit to knowing the fuse code well enough to comment
> specifically on it.)

The scope of the bug and comment you've replied to is just FUSE IO.

> … having the NFS (or FUSE) client do a
> large amount of writing to a file can flood the buffer cache and avoiding this
> for the case where the client won't be reading the file would be nice.
> What I am not sure is whether O_DIRECT is a good indicator of "doing a lot of
> writing that won't be read back".

This is the known failure mode of LRU cache policies plus finite cache
size plus naive clients.  It's not specific to any particular
filesystem.  You can either enlarge your LRU cache to incorporate the
entire working set size, incorporate frequency of access in eviction
policy, or have smart clients provide hints (e.g.,
POSIX_FADV_DONTNEED).  O_DIRECT -> IO_DIRECT -> B_DIRECT is already
used as a hint in the bufcache to release bufs/pages aggressively.

Best,
Conrad


More information about the freebsd-fs mailing list