From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Greg Banks <gnb-xTcybq6BZ68@public.gmane.org>,
Linux NFS ML <linux-nfs@vger.kernel.org>
Subject: Re: [patch 03/29] knfsd: add userspace controls for stats tables
Date: Tue, 28 Apr 2009 11:57:36 -0400 [thread overview]
Message-ID: <20090428155736.GH17891@fieldses.org> (raw)
In-Reply-To: <4993A7C8-342E-47BE-997A-AF18E5DF41BE@oracle.com>
On Tue, Apr 28, 2009 at 11:37:09AM -0400, Chuck Lever wrote:
>
> On Apr 27, 2009, at 7:22 PM, J. Bruce Fields wrote:
>
>> On Mon, Apr 27, 2009 at 12:06:18PM -0400, Chuck Lever wrote:
>>> On Apr 25, 2009, at 6:03 PM, J. Bruce Fields wrote:
>>>> Pfft, did it again.
>>>>
>>>> --b.
>>>>
>>>> On Sat, Apr 25, 2009 at 05:57:45PM -0400, bfields wrote:
>>>>> On Wed, Apr 01, 2009 at 07:28:03AM +1100, Greg Banks wrote:
>>>>>> Add two control files to /proc/fs/nfsd:
>>>>>>
>>>>>> * "stats_enabled" can be used to disable or enable the gathering
>>>>>> of per-client and per-export statistics in the server.
>>>>>>
>>>>>> * "stats_prune_period" can be used to set the period at
>>>>>> which the pruning timer runs, in seconds. Unused stats
>>>>>> entries will survive at most twice that time.
>>>>>>
>>>>>> Signed-off-by: Greg Banks <gnb@sgi.com>
>>>>>> ---
>>>>>>
>>>>>> fs/nfsd/nfsctl.c | 99
>>>>>> ++++++++++++++++++++++++++++++++++++++++++++
>>>>>> 1 file changed, 99 insertions(+)
>>>>>>
>>>>>> Index: bfields/fs/nfsd/nfsctl.c
>>>>>> =
>>>>>> ==================================================================
>>>>>> --- bfields.orig/fs/nfsd/nfsctl.c
>>>>>> +++ bfields/fs/nfsd/nfsctl.c
>>>>>> @@ -64,6 +64,8 @@ enum {
>>>>>> NFSD_Versions,
>>>>>> NFSD_Ports,
>>>>>> NFSD_MaxBlkSize,
>>>>>> + NFSD_Stats_Enabled,
>>>>>> + NFSD_Stats_Prune_Period,
>>>>>> /*
>>>>>> * The below MUST come last. Otherwise we leave a hole in
>>>>>> nfsd_files[]
>>>>>> * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops
>>>>>> @@ -92,6 +94,8 @@ static ssize_t write_pool_threads(struct
>>>>>> static ssize_t write_versions(struct file *file, char *buf, size_t
>>>>>> size);
>>>>>> static ssize_t write_ports(struct file *file, char *buf, size_t
>>>>>> size);
>>>>>> static ssize_t write_maxblksize(struct file *file, char *buf,
>>>>>> size_t size);
>>>>>> +static ssize_t write_stats_enabled(struct file *file, char *buf,
>>>>>> size_t size);
>>>>>> +static ssize_t write_stats_prune_period(struct file *file, char
>>>>>> *buf, size_t size);
>>>>>> #ifdef CONFIG_NFSD_V4
>>>>>> static ssize_t write_leasetime(struct file *file, char *buf,
>>>>>> size_t size);
>>>>>> static ssize_t write_recoverydir(struct file *file, char *buf,
>>>>>> size_t size);
>>>>>> @@ -113,6 +117,8 @@ static ssize_t (*write_op[])(struct file
>>>>>> [NFSD_Versions] = write_versions,
>>>>>> [NFSD_Ports] = write_ports,
>>>>>> [NFSD_MaxBlkSize] = write_maxblksize,
>>>>>> + [NFSD_Stats_Enabled] = write_stats_enabled,
>>>>>> + [NFSD_Stats_Prune_Period] = write_stats_prune_period,
>>>>>> #ifdef CONFIG_NFSD_V4
>>>>>> [NFSD_Leasetime] = write_leasetime,
>>>>>> [NFSD_RecoveryDir] = write_recoverydir,
>>>>>> @@ -1121,6 +1127,97 @@ static ssize_t write_maxblksize(struct f
>>>>>> return sprintf(buf, "%d\n", nfsd_max_blksize);
>>>>>> }
>>>>>>
>>>>>> +extern int nfsd_stats_enabled;
>>>>>> +
>>>>>> +/**
>>>>>> + * write_stats_enabled - Set or report whether per-client/
>>>>>> + * per-export stats are enabled.
>>>>>> + *
>>>>>> + * Input:
>>>>>> + * buf: ignored
>>>>>> + * size: zero
>>>>>> + *
>>>>>> + * OR
>>>>>> + *
>>>>>> + * Input:
>>>>>> + * buf: C string containing an unsigned
>>>>>> + * integer value representing the new value
>>>>>> + * size: non-zero length of C string in @buf
>>>>>> + * Output:
>>>>>> + * On success: passed-in buffer filled with '\n'-terminated C
>>>>>> string
>>>>>> + * containing numeric value of the current setting
>>>>>> + * return code is the size in bytes of the string
>>>>>> + * On error: return code is zero or a negative errno value
>>>>>> + */
>>>>>> +static ssize_t write_stats_enabled(struct file *file, char *buf,
>>>>>> size_t size)
>>>>>> +{
>>>>>> + char *mesg = buf;
>>>>>> + if (size > 0) {
>>>>>> + int enabled;
>>>>>> + int rv = get_int(&mesg, &enabled);
>>>>>> + if (rv)
>>>>>> + return rv;
>>>>>> + /* check `enabled' against allowed range */
>>>>>> + if (enabled < 0 || enabled > 1)
>>>>>> + return -EINVAL;
>>>>>> + /*
>>>>>> + * We can change the enabled flag at any time without
>>>>>> + * locking. All it controls is whether stats are
>>>>>> + * gathered for new incoming NFS calls. Old gathered
>>>>>> + * stats still sit around in the hash tables until
>>>>>> + * naturally pruned.
>>>>>> + */
>>>>>> + nfsd_stats_enabled = enabled;
>>>>>> + }
>>>>>> + return sprintf(buf, "%d\n", nfsd_stats_enabled);
>>>>>> +}
>>>>>> +
>>>>>> +extern int nfsd_stats_prune_period;
>>>>>> +
>>>>>> +/**
>>>>>> + * write_stats_prune_period - Set or report the period for
>>>>>> pruning
>>>>>> + * old per-client/per-export stats entries,
>>>>>> + * in seconds.
>>>>>> + *
>>>>>> + * Input:
>>>>>> + * buf: ignored
>>>>>> + * size: zero
>>>>>> + *
>>>>>> + * OR
>>>>>> + *
>>>>>> + * Input:
>>>>>> + * buf: C string containing an unsigned
>>>>>> + * integer value representing the new value
>>>>>> + * size: non-zero length of C string in @buf
>>>>>> + * Output:
>>>>>> + * On success: passed-in buffer filled with '\n'-terminated C
>>>>>> string
>>>>>> + * containing numeric value of the current setting
>>>>>> + * return code is the size in bytes of the string
>>>>>> + * On error: return code is zero or a negative errno value
>>>>>> + */
>>>>>
>>>>> Just an idle remark, don't worry about this for now, but: we might
>>>>> want
>>>>> to rein in this write_*() comment format a little some day. A
>>>>> lot of
>>>>> the content seems duplicated.
>>>
>>> I disagree.
>>
>> How? The below seems to be an arguing against *removing* the
>> comments,
>> or removing information from them, neither of which I'd be in favor
>> of.
>
> Then I misunderstood what you meant by "rein in".
>
> The apparent content duplication is because these functions are all
> slightly different. What we had before was a single description of the
> return values at the top of the files that more or less fit each proc
> file, but didn't precisely fit any but the oldest.
>
> (Responding a bit to Greg) IMO highlighting the differences instead
> means a person trying to understand this interface has to read the whole
> damn nfsctl.c file instead of looking at the one piece s/he is
> interested in. This is documentation, not code, so I think a little
> text duplication is OK or even actually preferred.
Agreed, and I agree that nobody should have to read the whole file. But
appropriate cross-references ("foo() behaves like bar() except...")
could prevent that. As long as we don't require following too many such
references, I think the burden of tracking following references would be
outweighed by the benefits of more concise descriptions.
--b.
next prev parent reply other threads:[~2009-04-28 15:57 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-31 20:28 [patch 00/29] SGI enhancedNFS patches Greg Banks
2009-03-31 20:28 ` [patch 01/29] knfsd: Add infrastructure for measuring RPC service times Greg Banks
2009-04-25 2:13 ` J. Bruce Fields
2009-04-25 2:14 ` J. Bruce Fields
2009-04-25 2:52 ` Greg Banks
2009-03-31 20:28 ` [patch 02/29] knfsd: Add stats table infrastructure Greg Banks
2009-04-25 3:56 ` J. Bruce Fields
2009-04-26 4:12 ` Greg Banks
2009-03-31 20:28 ` [patch 03/29] knfsd: add userspace controls for stats tables Greg Banks
2009-04-25 21:57 ` J. Bruce Fields
2009-04-25 22:03 ` J. Bruce Fields
2009-04-27 16:06 ` Chuck Lever
2009-04-27 23:22 ` J. Bruce Fields
2009-04-28 15:37 ` Chuck Lever
2009-04-28 15:57 ` J. Bruce Fields [this message]
2009-04-28 16:03 ` Chuck Lever
2009-04-28 16:26 ` J. Bruce Fields
2009-04-29 1:45 ` Greg Banks
[not found] ` <ac442c870904271827w6041a67ew82fe36a843beeac3@mail.gmail.com>
[not found] ` <ac442c870904271827w6041a67ew82fe36a843beeac3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-28 1:31 ` Greg Banks
2009-04-26 4:14 ` Greg Banks
2009-03-31 20:28 ` [patch 04/29] knfsd: Add stats updating API Greg Banks
2009-03-31 20:28 ` [patch 05/29] knfsd: Infrastructure for providing stats to userspace Greg Banks
2009-04-01 0:28 ` J. Bruce Fields
2009-04-01 3:43 ` Greg Banks
2009-03-31 20:28 ` [patch 06/29] knfsd: Gather per-export stats Greg Banks
2009-03-31 20:28 ` [patch 07/29] knfsd: Prefetch the per-export stats entry Greg Banks
2009-03-31 20:28 ` [patch 08/29] knfsd: Gather per-client stats Greg Banks
2009-03-31 20:28 ` [patch 09/29] knfsd: Cache per-client stats entry on TCP transports Greg Banks
2009-03-31 20:28 ` [patch 10/29] knfsd: Update per-client & per-export stats from NFSv3 Greg Banks
2009-03-31 20:28 ` [patch 11/29] knfsd: Update per-client & per-export stats from NFSv2 Greg Banks
2009-03-31 20:28 ` [patch 12/29] knfsd: Update per-client & per-export stats from NFSv4 Greg Banks
2009-03-31 20:28 ` [patch 13/29] knfsd: reply cache cleanups Greg Banks
2009-05-12 19:54 ` J. Bruce Fields
2009-03-31 20:28 ` [patch 14/29] knfsd: better hashing in the reply cache Greg Banks
2009-05-08 22:01 ` J. Bruce Fields
2009-03-31 20:28 ` [patch 15/29] knfsd: fix reply cache memory corruption Greg Banks
2009-05-12 19:55 ` J. Bruce Fields
2009-03-31 20:28 ` [patch 16/29] knfsd: use client IPv4 address in reply cache hash Greg Banks
2009-05-11 21:48 ` J. Bruce Fields
2009-03-31 20:28 ` [patch 17/29] knfsd: make the reply cache SMP-friendly Greg Banks
2009-03-31 20:28 ` [patch 18/29] knfsd: dynamically expand the reply cache Greg Banks
2009-05-26 18:57 ` J. Bruce Fields
2009-05-26 19:04 ` J. Bruce Fields
2009-05-26 21:24 ` Rob Gardner
2009-05-26 21:52 ` J. Bruce Fields
2009-05-27 0:28 ` Greg Banks
2009-03-31 20:28 ` [patch 19/29] knfsd: faster probing in " Greg Banks
2009-03-31 20:28 ` [patch 20/29] knfsd: add extended reply cache stats Greg Banks
2009-03-31 20:28 ` [patch 21/29] knfsd: remove unreported filehandle stats counters Greg Banks
2009-05-12 20:00 ` J. Bruce Fields
2009-03-31 20:28 ` [patch 22/29] knfsd: make svc_authenticate() scale Greg Banks
2009-05-12 21:24 ` J. Bruce Fields
2009-03-31 20:28 ` [patch 23/29] knfsd: introduce SVC_INC_STAT Greg Banks
2009-03-31 20:28 ` [patch 24/29] knfsd: remove the program field from struct svc_stat Greg Banks
2009-03-31 20:28 ` [patch 25/29] knfsd: allocate svc_serv.sv_stats dynamically Greg Banks
2009-03-31 20:28 ` [patch 26/29] knfsd: make svc_serv.sv_stats per-CPU Greg Banks
2009-03-31 20:28 ` [patch 27/29] knfsd: move hot procedure count field out of svc_procedure Greg Banks
2009-03-31 20:28 ` [patch 28/29] knfsd: introduce NFSD_INC_STAT() Greg Banks
2009-03-31 20:28 ` [patch 29/29] knfsd: make nfsdstats per-CPU Greg Banks
2009-04-01 0:23 ` [patch 00/29] SGI enhancedNFS patches J. Bruce Fields
2009-04-01 3:32 ` Greg Banks
[not found] ` <ac442c870903312032t34630c6dvdbb644cb510f8079-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-01 6:34 ` Jeff Garzik
2009-04-01 6:41 ` Greg Banks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090428155736.GH17891@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=gnb-xTcybq6BZ68@public.gmane.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).