From: Benny Halevy <bhalevy@panasas.com>
To: pnfs@linux-nfs.org
Cc: "J. Bruce Fields" <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Subject: Re: [pnfs] [RFC 51/51] nfsd41: print DRC statistics
Date: Mon, 17 Nov 2008 16:17:09 +0200 [thread overview]
Message-ID: <49217CE5.2080704@panasas.com> (raw)
In-Reply-To: <1226350694-12043-1-git-send-email-bhalevy@panasas.com>
On Nov. 10, 2008, 22:58 +0200, Benny Halevy <bhalevy@panasas.com> wrote:
> From: Andy Adamson <andros@netapp.com>
>
> Add page-use counters to the cache entry. Add a proc file to trigger printing
> the session, slot, and DRC statistics for a client ipv4 address.
>
> To print the DRC stats for an IP address:
> echo "192.168.1.106" > /proc/fs/nfsd/nfsv41_DRC_printstats
>
> To reset all slot counters on all clients:
> echo "0.0.0.0" > /proc/fs/nfsd/nfsv41_DRC_printstats
>
> Signed-off-by: Andy Adamson<andros@netapp.com>
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
review 11-13: Bruce says leave it out for now.
> ---
> fs/nfsd/nfs4state.c | 95 ++++++++++++++++++++++++++++++++++++++++++++
> fs/nfsd/nfsctl.c | 52 ++++++++++++++++++++++++
> include/linux/nfsd/nfsd.h | 8 ++++
> include/linux/nfsd/state.h | 4 ++
> 4 files changed, 159 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 0d8fde7..3a8d5c7 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1018,6 +1018,100 @@ nfsd41_set_statp(struct svc_rqst *rqstp, __be32 *statp)
> resp->statp = statp;
> }
>
> +static void
> +nfsd4_print_slotstats(struct nfs41_slot *slot)
> +{
> + struct nfs41_cache_entry *e = &slot->sl_cache_entry;
> +
> + printk(KERN_INFO " sequence number %d\n", slot->sl_seqid);
> + printk(KERN_INFO " pages cached %d\n", e->ce_resused);
> + printk(KERN_INFO " total pages cached %lu\n",
> + e->ce_total_pages);
> + printk(KERN_INFO " lowest # pages per request %lu\n",
> + e->ce_lowest_pages);
> + printk(KERN_INFO " higest # pages per request %lu\n",
> + e->ce_highest_pages);
> +}
> +
> +static void
> +nfsd4_reset_slotstats(struct nfs41_slot *slot)
> +{
> + struct nfs41_cache_entry *e = &slot->sl_cache_entry;
> +
> + e->ce_total_pages = e->ce_lowest_pages = e->ce_highest_pages = 0;
> +}
> +
> +static void
> +nfsd4_drc_printstats(struct nfs4_client *clp, int reset)
> +{
> + struct nfs41_session *ses;
> + struct nfsd_sessionid *id;
> + int i;
> +
> + printk(KERN_INFO "\n----- DRC Stats for %u.%u.%u.%u -----\n",
> + NIPQUAD(clp->cl_addr));
> + if (reset)
> + printk(KERN_INFO " ------ RESET ------\n");
> + list_for_each_entry(ses, &clp->cl_sessions, se_perclnt) {
> + id = (struct nfsd_sessionid *)ses;
> + printk(KERN_INFO " -- Sessionid:[clientid] %x%x [boot]"
> + "%x [seq] %x -- \n",
> + id->clientid.cl_boot, id->clientid.cl_id,
> + id->boot_time, id->sequence);
> + printk(KERN_INFO " Forward Channel\n\n");
> + printk(KERN_INFO " headerpad %d\n",
> + ses->se_fheaderpad_sz);
> + printk(KERN_INFO " maxreq size %d\n",
> + ses->se_fmaxreq_sz);
> + printk(KERN_INFO " maxresp size %d\n",
> + ses->se_fmaxresp_sz);
> + printk(KERN_INFO " maxresp (numslots) %d\n",
> + ses->se_fmaxresp_cached);
> + printk(KERN_INFO " maxops %d\n",
> + ses->se_fmaxops);
> + for (i = 0; i < ses->se_forward.ch_maxreqs; i++) {
> + printk(KERN_INFO "\n----- Slot # %d -------\n", i);
> + if (reset)
> + nfsd4_reset_slotstats(&ses->se_slots[i]);
> + else
> + nfsd4_print_slotstats(&ses->se_slots[i]);
> + }
> + }
> + printk(KERN_INFO "\n\n Create Session Slot\n\n");
> + nfsd4_print_slotstats(&clp->cl_slot);
> + printk(KERN_INFO "\n--------- DRC Slot Stats End ---------\n\n");
> +}
> +
> +void
> +nfsd4_do_drcstats(__be32 ip4addr)
> +{
> + struct nfs4_client *clp = NULL;
> + int i;
> +
> + for (i = 0; i < CLIENT_HASH_SIZE; i++) {
> + list_for_each_entry(clp, &conf_id_hashtbl[i], cl_idhash) {
> + if (ip4addr == 0)
> + nfsd4_drc_printstats(clp, 1);
> + else if (!memcmp(&clp->cl_addr, &ip4addr,
> + sizeof(__be32))) {
> + nfsd4_drc_printstats(clp, 0);
> + break;
> + }
> + }
> + }
> +}
> +
> +static void
> +nfs4_set_drc_stats(struct svc_rqst *rqstp, struct nfs41_cache_entry *entry)
> +{
> + if (entry->ce_lowest_pages == 0 ||
> + rqstp->rq_resused < entry->ce_lowest_pages)
> + entry->ce_lowest_pages = rqstp->rq_resused;
> + if (rqstp->rq_resused > entry->ce_highest_pages)
> + entry->ce_highest_pages = rqstp->rq_resused;
> + entry->ce_total_pages += rqstp->rq_resused;
> +}
> +
> /*
> * Cache the reply pages, clearing the previous pages.
> * Store the base and length of the rq_req.head[0] page
> @@ -1038,6 +1132,7 @@ nfsd41_set_cache_entry(struct nfsd4_compoundres *resp)
> if (resp->opcnt == 1 && resp->status && slot->sl_session)
> return;
> spin_lock(&entry->ce_lock);
> + nfs4_set_drc_stats(rqstp, entry);
> nfsd4_clear_respages(entry->ce_respages, entry->ce_resused);
> nfsd4_cache_rqst_pages(rqstp, entry->ce_respages, &entry->ce_resused);
> entry->ce_status = resp->status;
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index e3f9783..e7f850a 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -71,6 +71,9 @@ enum {
> NFSD_Leasetime,
> NFSD_RecoveryDir,
> #endif
> +#ifdef CONFIG_NFSD_V4_1
> + NFSD_DRC_print_stats,
> +#endif /* CONFIG_NFSD_V4_1 */
> };
>
> /*
> @@ -93,6 +96,9 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size);
> 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);
> #endif
> +#ifdef CONFIG_NFSD_V4_1
> +static ssize_t write_drcstats(struct file *file, char *buf, size_t size);
> +#endif /* CONFIG_NFSD_V4_1 */
>
> static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size);
> static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size);
> @@ -117,6 +123,9 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = {
> [NFSD_Leasetime] = write_leasetime,
> [NFSD_RecoveryDir] = write_recoverydir,
> #endif
> +#ifdef CONFIG_NFSD_V4_1
> + [NFSD_DRC_print_stats] = write_drcstats,
> +#endif /* CONFIG_NFSD_V4_1 */
> };
>
> static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
> @@ -727,6 +736,45 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
> return sprintf(buf, "%d\n", nfsd_max_blksize);
> }
>
> +#ifdef CONFIG_NFSD_V4_1
> +static ssize_t __write_drcstats(struct file *file, char *buf, size_t size)
> +{
> + char *mesg = buf;
> + char *ip4addr = NULL;
> + int len;
> + __be32 cl_addr = 0;
> + u8 *addr = (u8 *)&cl_addr;
> +
> + if (size > 0) {
> + if (size > PATH_MAX || buf[size-1] != '\n')
> + return -EINVAL;
> + buf[size-1] = 0;
> +
> + ip4addr = mesg;
> + len = qword_get(&mesg, ip4addr, size);
> + if (len <= 0)
> + return -EINVAL;
> + if (!(in4_pton(ip4addr, len, addr, '\0', NULL)))
> + return -EINVAL;
> + nfsd4_do_drcstats(cl_addr);
> + }
> + if (!ip4addr)
> + return 0;
> + sprintf(buf, "%s\n", ip4addr);
> + return strlen(buf);
> +}
> +
> +static ssize_t write_drcstats(struct file *file, char *buf, size_t size)
> +{
> + ssize_t rv;
> +
> + mutex_lock(&nfsd_mutex);
> + rv = __write_drcstats(file, buf, size);
> + mutex_unlock(&nfsd_mutex);
> + return rv;
> +}
> +
> +#endif /* CONFIG_NFSD_V4_1 */
> #ifdef CONFIG_NFSD_V4
> extern time_t nfs4_leasetime(void);
>
> @@ -830,6 +878,10 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
> [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
> [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR},
> #endif
> +#ifdef CONFIG_NFSD_V4_1
> + [NFSD_DRC_print_stats] =
> + {"nfsv41_DRC_printstats", &transaction_ops, S_IWUSR|S_IRUSR},
> +#endif /* CONFIG_NFSD_V4_1 */
> /* last one */ {""}
> };
> return simple_fill_super(sb, 0x6e667364, nfsd_files);
> diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
> index c8bbe94..e31a4f6 100644
> --- a/include/linux/nfsd/nfsd.h
> +++ b/include/linux/nfsd/nfsd.h
> @@ -181,6 +181,14 @@ static inline void nfs4_reset_lease(time_t leasetime) { }
> static inline int nfs4_reset_recoverydir(char *recdir) { return 0; }
> #endif
>
> +#ifdef CONFIG_NFSD_V4_1
> +void nfsd4_do_drcstats(__be32 ip4addr);
> +#else
> +static inline void nfsd4_do_drcstats(__be32 client_ip4addr) {}
> +#endif /* CONFIG_NFSD_V4_1 */
> +
> +
> +
> /*
> * lockd binding
> */
> diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
> index a336687..03aaba4 100644
> --- a/include/linux/nfsd/state.h
> +++ b/include/linux/nfsd/state.h
> @@ -131,6 +131,10 @@ struct nfs41_cache_entry {
> struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */
> struct page *ce_respages[RPCSVC_MAXPAGES];
> short ce_resused;
> + /* slot page stats */
> + unsigned long ce_total_pages;
> + unsigned long ce_lowest_pages;
> + unsigned long ce_highest_pages;
> };
>
> /*
prev parent reply other threads:[~2008-11-17 14:17 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-10 20:12 [RFC 0/51] nfs41 server patches for review Benny Halevy
2008-11-10 20:16 ` [RFC 01/51] nfsd: add etoosmall to nfserrno Benny Halevy
2008-11-10 20:39 ` [pnfs] [RFC 0/51] nfs41 server patches for review Benny Halevy
2008-11-10 20:40 ` [RFC 01/51] nfsd: add etoosmall to nfserrno Benny Halevy
2008-11-10 20:41 ` [RFC 02/51] nfsd: dprint each op status in nfsd4_proc_compound Benny Halevy
2008-11-17 13:56 ` [pnfs] " Benny Halevy
2008-11-10 20:41 ` [RFC 03/51] nfsd: git rid of nfs4_cb_null_ops declaration Benny Halevy
2008-11-10 20:41 ` [RFC 04/51] nfsd: fix file comment in fs/nfsd/nfs4xdr.c Benny Halevy
2008-11-17 13:56 ` [pnfs] " Benny Halevy
2008-11-10 20:42 ` [RFC 05/51] nfsd41: Add Kconfig symbols for NFSv4.1 Benny Halevy
2008-11-10 20:42 ` [RFC 06/51] nfsd41: define nfs41 error codes Benny Halevy
2008-11-10 20:43 ` [RFC 07/51] nfsd41: sessions basic data types Benny Halevy
2008-11-17 13:57 ` [pnfs] " Benny Halevy
2008-11-10 20:43 ` [RFC 08/51] nfsd41: introduce nfs4_client cl_sessions list Benny Halevy
2008-11-17 13:58 ` [pnfs] " Benny Halevy
2008-11-10 20:43 ` [RFC 09/51] nfsd41: destroy_session when client is expired Benny Halevy
2008-11-10 20:44 ` [RFC 10/51] nfsd41: sessionid hashing Benny Halevy
2008-11-17 13:58 ` [pnfs] " Benny Halevy
2008-11-10 20:44 ` [RFC 11/51] FIXME: nfsd41: reduce server lease time for nfs41 Benny Halevy
2008-11-17 13:59 ` [pnfs] " Benny Halevy
2008-11-10 20:44 ` [RFC 12/51] nfsd41: provide support for minor version 1 at rpc level Benny Halevy
2008-11-17 14:00 ` [pnfs] " Benny Halevy
2008-11-10 20:45 ` [RFC 13/51] FIXME: nfsd41: introduce current_session Benny Halevy
2008-11-17 14:00 ` [pnfs] " Benny Halevy
2008-11-10 20:45 ` [RFC 14/51] nfsd41: introduce nfs41_{get,set}_slot_state Benny Halevy
2008-11-17 14:01 ` [pnfs] " Benny Halevy
2008-11-10 20:45 ` [RFC 15/51] FIXME: nfsd41: free up slot unless operation is dropped Benny Halevy
2008-11-17 14:01 ` [pnfs] " Benny Halevy
2008-11-10 20:46 ` [RFC 16/51] nfsd41: stateid handling Benny Halevy
2008-11-17 14:02 ` [pnfs] " Benny Halevy
2008-11-10 20:46 ` [RFC 17/51] nfsd41: clientid handling Benny Halevy
2008-11-17 14:03 ` [pnfs] " Benny Halevy
2008-11-10 20:46 ` [RFC 18/51] nfsd41: access_valid Benny Halevy
2008-11-17 14:04 ` [pnfs] " Benny Halevy
2008-11-10 20:47 ` [RFC 19/51] nfsd41: add OPEN4_SHARE_ACCESS_WANT nfs4_stateid bmap Benny Halevy
2008-11-17 14:05 ` [pnfs] " Benny Halevy
2008-11-10 20:47 ` [RFC 20/51] nfsd: last_byte_offset Benny Halevy
2008-11-17 14:06 ` [pnfs] " Benny Halevy
2008-11-10 20:47 ` [RFC 21/51] nfsd41: xdr stubs Benny Halevy
2008-11-17 14:06 ` [pnfs] " Benny Halevy
2008-11-10 20:48 ` [RFC 22/51] nfsd41: proc stubs Benny Halevy
2008-11-17 14:07 ` [pnfs] " Benny Halevy
2008-11-10 20:48 ` [RFC 23/51] nfsd41: exchange_id operation Benny Halevy
2008-11-17 14:07 ` [pnfs] " Benny Halevy
2008-11-10 20:48 ` [RFC 24/51] nfsd41: print exchange flags when purging client Benny Halevy
2008-11-17 14:08 ` [pnfs] " Benny Halevy
2008-11-10 20:49 ` [RFC 25/51] nfsd41: create_session operation Benny Halevy
2008-11-17 14:09 ` [pnfs] " Benny Halevy
2008-11-10 20:49 ` [RFC 26/51] nfsd41: destroy_session operation Benny Halevy
2008-11-17 14:10 ` [pnfs] " Benny Halevy
2008-11-10 20:49 ` [RFC 27/51] nfsd41: sequence operation Benny Halevy
2008-11-17 14:10 ` [pnfs] " Benny Halevy
2008-11-10 20:50 ` [RFC 28/51] FIXME: nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
2008-11-17 14:11 ` [pnfs] " Benny Halevy
2008-11-10 20:50 ` [RFC 29/51] nfsd: BUG_ON_UNLOCKED_STATE Benny Halevy
2008-11-10 20:50 ` [RFC 30/51] nfsd: lock state around nfs4_put_delegation in nfsd_break_deleg_cb err path Benny Halevy
2008-11-10 20:51 ` [RFC 31/51] FIXME: nfsd: kref_get cb_client while doing the callback Benny Halevy
2008-11-10 20:51 ` [RFC 32/51] nfsd41: callback infrastructure Benny Halevy
2008-11-17 14:12 ` [pnfs] " Benny Halevy
2008-11-10 20:52 ` [RFC 33/51] nfsd41: introduce cl_cb_mutex Benny Halevy
2008-11-10 20:52 ` [RFC 34/51] nfsd41: cb_sequence callback Benny Halevy
2008-11-10 20:52 ` [RFC 35/51] nfsd41: introduce nfs4_cb_call_sync for nfs4 and nfs41 Benny Halevy
2008-11-10 20:53 ` [RFC 36/51] nfsd41: cb_recall callback Benny Halevy
2008-11-10 20:53 ` [RFC 37/51] nfsd41: pass writable attrs mask to nfsd4_decode_fattr Benny Halevy
2008-11-10 20:53 ` [RFC 38/51] nfsd41: support for 3-word long attribute bitmask Benny Halevy
2008-11-17 14:13 ` [pnfs] " Benny Halevy
2008-11-10 20:54 ` [RFC 39/51] nfsd41: SUPPATTR_EXCLCREAT attribute Benny Halevy
2008-11-10 20:54 ` [RFC 40/51] nfsd41: CREATE_EXCLUSIVE4_1 Benny Halevy
2008-11-17 14:13 ` [pnfs] " Benny Halevy
2008-11-10 20:54 ` [RFC 41/51] sunrpc: Add deferral save and restore state callback Benny Halevy
2008-11-10 20:55 ` [RFC 42/51] nfsd: save and restore defer result pages Benny Halevy
2008-11-10 20:55 ` [RFC 43/51] nfsd: deferral processing Benny Halevy
2008-11-10 20:55 ` [RFC 44/51] nfsd41: slab cache for current session Benny Halevy
2008-11-17 14:14 ` [pnfs] " Benny Halevy
2008-11-10 20:56 ` [RFC 45/51] nfsd41: DRC save, restore, and clear functions Benny Halevy
2008-11-17 14:14 ` [pnfs] " Benny Halevy
2008-11-10 20:56 ` [RFC 46/51] nfsd41: nfsd nfsd4_sequence DRC logic Benny Halevy
2008-11-10 20:56 ` [RFC 47/51] nfsd41: enforce NFS4ERR_SEQUENCE_POS operation order rules Benny Halevy
2008-11-17 14:15 ` [pnfs] " Benny Halevy
2008-11-10 20:57 ` [RFC 48/51] nfsd41: nfsd DRC logic Benny Halevy
2008-11-10 20:57 ` [RFC 49/51] nfsd41: clear DRC cache on free_session Benny Halevy
2008-11-10 20:57 ` [RFC 50/51] nfsd41: Add a create session replay cache Benny Halevy
2008-11-17 14:16 ` [pnfs] " Benny Halevy
2008-11-10 20:58 ` [RFC 51/51] nfsd41: print DRC statistics Benny Halevy
2008-11-17 14:17 ` Benny Halevy [this message]
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=49217CE5.2080704@panasas.com \
--to=bhalevy@panasas.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=pnfs@linux-nfs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.