From: Greg Banks <gnb@sgi.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Linux NFS ML <linux-nfs@vger.kernel.org>
Subject: [patch 23/29] knfsd: introduce SVC_INC_STAT
Date: Wed, 01 Apr 2009 07:28:23 +1100 [thread overview]
Message-ID: <20090331202946.527917000@sgi.com> (raw)
In-Reply-To: 20090331202800.739621000@sgi.com
Replace direct increments of counters in the svc_stat structure
attached to each svc_serv, with the macro SVC_INC_STAT(). This doesn't
change any functionality but prepares for a subsequent patch which
changes the definitions of those macros to make the sv_stat counters
per-cpu for performance.
Signed-off-by: Greg Banks <gnb@sgi.com>
Reviewed-by: David Chinner <dgc@sgi.com>
Reviewed-by: Peter Leckie <pleckie-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
---
include/linux/sunrpc/svc.h | 3 +++
net/sunrpc/svc.c | 18 +++++++++---------
net/sunrpc/svcsock.c | 12 ++++--------
3 files changed, 16 insertions(+), 17 deletions(-)
Index: bfields/include/linux/sunrpc/svc.h
===================================================================
--- bfields.orig/include/linux/sunrpc/svc.h
+++ bfields/include/linux/sunrpc/svc.h
@@ -109,6 +109,9 @@ struct svc_serv {
unsigned int sv_drc_pages_used;/* DRC pages used */
#endif /* CONFIG_NFSD_V4_1 */
};
+#define SVC_INC_STAT(serv, field) \
+ ((serv)->sv_stats ? \
+ ++((serv)->sv_stats->field) : 0)
/*
* We use sv_nrthreads as a reference count. svc_destroy() drops
Index: bfields/net/sunrpc/svc.c
===================================================================
--- bfields.orig/net/sunrpc/svc.c
+++ bfields/net/sunrpc/svc.c
@@ -1084,7 +1084,7 @@ svc_process(struct svc_rqst *rqstp)
rqstp->rq_procinfo = procp;
/* Syntactic check complete */
- serv->sv_stats->rpccnt++;
+ SVC_INC_STAT(serv, rpccnt);
/* Build the reply header. */
statp = resv->iov_base +resv->iov_len;
@@ -1121,7 +1121,7 @@ svc_process(struct svc_rqst *rqstp)
if (*statp == rpc_success && (xdr = procp->pc_encode)
&& !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
dprintk("svc: failed to encode reply\n");
- /* serv->sv_stats->rpcsystemerr++; */
+ /* SVC_INC_STAT(serv, rpcsystemerr); */
*statp = rpc_system_err;
}
} else {
@@ -1165,11 +1165,11 @@ err_short_len:
err_bad_dir:
svc_printk(rqstp, "bad direction %d, dropping request\n", dir);
- serv->sv_stats->rpcbadfmt++;
+ SVC_INC_STAT(serv, rpcbadfmt);
goto dropit; /* drop request */
err_bad_rpc:
- serv->sv_stats->rpcbadfmt++;
+ SVC_INC_STAT(serv, rpcbadfmt);
svc_putnl(resv, 1); /* REJECT */
svc_putnl(resv, 0); /* RPC_MISMATCH */
svc_putnl(resv, 2); /* Only RPCv2 supported */
@@ -1178,7 +1178,7 @@ err_bad_rpc:
err_bad_auth:
dprintk("svc: authentication failed (%d)\n", ntohl(auth_stat));
- serv->sv_stats->rpcbadauth++;
+ SVC_INC_STAT(serv, rpcbadauth);
/* Restore write pointer to location of accept status: */
xdr_ressize_check(rqstp, reply_statp);
svc_putnl(resv, 1); /* REJECT */
@@ -1188,7 +1188,7 @@ err_bad_auth:
err_bad_prog:
dprintk("svc: unknown program %d\n", prog);
- serv->sv_stats->rpcbadfmt++;
+ SVC_INC_STAT(serv, rpcbadfmt);
svc_putnl(resv, RPC_PROG_UNAVAIL);
goto sendit;
@@ -1196,7 +1196,7 @@ err_bad_vers:
svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n",
vers, prog, progp->pg_name);
- serv->sv_stats->rpcbadfmt++;
+ SVC_INC_STAT(serv, rpcbadfmt);
svc_putnl(resv, RPC_PROG_MISMATCH);
svc_putnl(resv, progp->pg_lovers);
svc_putnl(resv, progp->pg_hivers);
@@ -1205,7 +1205,7 @@ err_bad_vers:
err_bad_proc:
svc_printk(rqstp, "unknown procedure (%d)\n", proc);
- serv->sv_stats->rpcbadfmt++;
+ SVC_INC_STAT(serv, rpcbadfmt);
svc_putnl(resv, RPC_PROC_UNAVAIL);
goto sendit;
@@ -1214,7 +1214,7 @@ err_garbage:
rpc_stat = rpc_garbage_args;
err_bad:
- serv->sv_stats->rpcbadfmt++;
+ SVC_INC_STAT(serv, rpcbadfmt);
svc_putnl(resv, ntohl(rpc_stat));
goto sendit;
}
Index: bfields/net/sunrpc/svcsock.c
===================================================================
--- bfields.orig/net/sunrpc/svcsock.c
+++ bfields/net/sunrpc/svcsock.c
@@ -531,8 +531,7 @@ static int svc_udp_recvfrom(struct svc_r
DIV_ROUND_UP(rqstp->rq_arg.page_len, PAGE_SIZE);
}
- if (serv->sv_stats)
- serv->sv_stats->netudpcnt++;
+ SVC_INC_STAT(serv, netudpcnt);
return len;
}
@@ -770,8 +769,7 @@ static struct svc_xprt *svc_tcp_accept(s
}
svc_xprt_set_local(&newsvsk->sk_xprt, sin, slen);
- if (serv->sv_stats)
- serv->sv_stats->nettcpconn++;
+ SVC_INC_STAT(serv, nettcpconn);
return &newsvsk->sk_xprt;
@@ -973,8 +971,7 @@ out:
svc_xprt_copy_addrs(rqstp, &svsk->sk_xprt);
svc_xprt_received(&svsk->sk_xprt);
- if (serv->sv_stats)
- serv->sv_stats->nettcpcnt++;
+ SVC_INC_STAT(serv, nettcpcnt);
return len;
Index: bfields/net/sunrpc/svc_xprt.c
===================================================================
--- bfields.orig/net/sunrpc/svc_xprt.c
+++ bfields/net/sunrpc/svc_xprt.c
@@ -765,8 +765,7 @@ int svc_recv(struct svc_rqst *rqstp, lon
rqstp->rq_secure = svc_port_is_privileged(svc_addr(rqstp));
rqstp->rq_chandle.defer = svc_defer;
- if (serv->sv_stats)
- serv->sv_stats->netcnt++;
+ SVC_INC_STAT(serv, netcnt);
return len;
}
EXPORT_SYMBOL_GPL(svc_recv);
--
Greg
next prev parent reply other threads:[~2009-03-31 21:02 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
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 ` Greg Banks [this message]
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=20090331202946.527917000@sgi.com \
--to=gnb@sgi.com \
--cc=bfields@fieldses.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 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.