qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 068/104] virtiofsd: passthrough_ll: control readdirplus


From: Dr. David Alan Gilbert
Subject: Re: [PATCH 068/104] virtiofsd: passthrough_ll: control readdirplus
Date: Fri, 10 Jan 2020 15:04:47 +0000
User-agent: Mutt/1.13.0 (2019-11-30)

* Daniel P. Berrangé (address@hidden) wrote:
> On Thu, Dec 12, 2019 at 04:38:28PM +0000, Dr. David Alan Gilbert (git) wrote:
> > From: Miklos Szeredi <address@hidden>
> >
> 
> What is readdirplus and what do we need a command line option to
> control it ? What's the user benefit of changing the setting ?

cc'ing Miklos who understands this better than me.

My understanding is that readdirplus is a heuristic inherited from NFS
where when you iterate over the directory you also pick up stat() data
for each entry in the directory.  You then cache that stat data
somewhere.
The Plus-ness is that a lot of directory operations involve you stating
each entry (e.g. to figure out if you can access it etc) so rolling it
into one op avoids the separate stat.  The unplus-ness is that it's an
overhead and I think changes some of the caching behaviour.

Dave


> > Signed-off-by: Miklos Szeredi <address@hidden>
> > ---
> >  tools/virtiofsd/passthrough_ll.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/virtiofsd/passthrough_ll.c 
> > b/tools/virtiofsd/passthrough_ll.c
> > index 0d70a367bd..c3e8bde5cf 100644
> > --- a/tools/virtiofsd/passthrough_ll.c
> > +++ b/tools/virtiofsd/passthrough_ll.c
> > @@ -118,6 +118,8 @@ struct lo_data {
> >      double timeout;
> >      int cache;
> >      int timeout_set;
> > +    int readdirplus_set;
> > +    int readdirplus_clear;
> >      struct lo_inode root; /* protected by lo->mutex */
> >      struct lo_map ino_map; /* protected by lo->mutex */
> >      struct lo_map dirp_map; /* protected by lo->mutex */
> > @@ -141,6 +143,8 @@ static const struct fuse_opt lo_opts[] = {
> >      { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
> >      { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
> >      { "norace", offsetof(struct lo_data, norace), 1 },
> > +    { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
> > +    { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 },
> >      FUSE_OPT_END
> >  };
> >  static bool use_syslog = false;
> > @@ -479,7 +483,8 @@ static void lo_init(void *userdata, struct 
> > fuse_conn_info *conn)
> >          fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
> >          conn->want |= FUSE_CAP_FLOCK_LOCKS;
> >      }
> > -    if (lo->cache == CACHE_NEVER) {
> > +    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
> > +        lo->readdirplus_clear) {
> >          fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
> >          conn->want &= ~FUSE_CAP_READDIRPLUS;
> >      }
> > -- 
> > 2.23.0
> > 
> > 
> 
> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK




reply via email to

[Prev in Thread] Current Thread [Next in Thread]