On Tue, Jan 5, 2021 at 5:34 PM J . Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > > On Tue, Jan 05, 2021 at 08:42:21AM +0200, Amir Goldstein wrote: > > On Tue, Jan 5, 2021 at 12:49 AM J . Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > > > > > > On Mon, Dec 28, 2020 at 07:03:44PM +0200, Amir Goldstein wrote: > > > > Collect some nfsd stats per export in addition to the global stats. > > > > > > Seems like a reasonable thing to do. > > > > > > > A new nfsdfs export_stats file is created. It uses the same ops as the > > > > exports file to iterate the export entries and we use the file's name to > > > > determine the reported info per export. For example: > > > > > > > > $ cat /proc/fs/nfsd/export_stats > > > > # Version 1.1 > > > > # Path Client Start-time > > > > # Stats > > > > /test localhost 92 > > > > fh_stale: 0 > > > > io_read: 9 > > > > io_write: 1 > > > > > > > > Every export entry reports the start time when stats collection > > > > started, so stats collecting scripts can know if stats where reset > > > > between samples. > > > > > > Yes, you expect svc_export to be created (or destroyed) when a > > > filesystem is exported (or unexported), or when nfsd starts (or stops). > > > > > > But actually it's just a cache entry and can be removed and recreated at > > > any time. Not much we can do about losing statistics when that happens, > > > but the start time at least gives us some hope of interpreting the > > > statistics. > > > > > > Why weren't there existing file system statistics that would do the job > > > in your case? > > > > > > > I am not sure what you mean. > > We want to know the amount of read/write io for a specific export on > > the server, including io to/from page cache, which isn't counted by stats > > of most local filesystems. > > I was just curious what exactly your use case was. (And incidentally > if it explained the interest in STALE errors as well?) Ah no I don't. I just added it as a public service. Do you prefer that I drop fh_stale from per-export stats? > > > Unrelated, in our search for those statistics, we were surprised (good > > surprises) > > to learn about s_op->show_stats(), but also surprised (bad surprise) > > to learn how few filesystems implement this method. > > Yes, Chuck added it for NFS (checks history...) in 2006. NFS is unique > in some ways, but I can imagine it'd be useful elsewhere too. > Well, we are exporting fuse, so I considered adding ->show_stats() for fuse, but per export stats is MUCH easier ;-) Thanks, Amir.