* [PATCH] Fix IPVS to set the statistics of dest zero
@ 2003-10-13 15:59 Wensong Zhang
2003-10-13 19:32 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wensong Zhang @ 2003-10-13 15:59 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Julian Anastasov
[-- Attachment #1: Type: TEXT/PLAIN, Size: 316 bytes --]
Hi,
Here is the slight patch for IPVS to fix to zero the statistics of dest
when it is bound to a new service. It can make the statistics information
more correct after removing/adding new servers.
Please check the attached two patches and apply them to the kernel 2.4 and
2.6 respectively.
Thanks,
Wensong
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1673 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1183 -> 1.1184
# net/ipv4/ipvs/ip_vs_ctl.c 1.1 -> 1.2
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/10/13 wensong@linux-vs.org 1.1184
# [IPVS] Fix to set the statistics of dest zero when bound to a new service
# --------------------------------------------
#
diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
--- a/net/ipv4/ipvs/ip_vs_ctl.c Mon Oct 13 23:45:27 2003
+++ b/net/ipv4/ipvs/ip_vs_ctl.c Mon Oct 13 23:45:27 2003
@@ -653,6 +653,15 @@
}
+static inline void
+__ip_vs_zero_stats(struct ip_vs_stats *stats)
+{
+ spin_lock_bh(&stats->lock);
+ memset(stats, 0, (char *)&stats->lock - (char *)stats);
+ spin_unlock_bh(&stats->lock);
+ ip_vs_zero_estimator(stats);
+}
+
/*
* Update a destination in the given service
*/
@@ -699,6 +708,7 @@
} else {
if (dest->svc != svc) {
__ip_vs_unbind_svc(dest);
+ __ip_vs_zero_stats(&dest->stats);
__ip_vs_bind_svc(dest, svc);
}
}
@@ -1282,15 +1292,6 @@
/*
* Zero counters in a service or all services
*/
-static inline void
-__ip_vs_zero_stats(struct ip_vs_stats *stats)
-{
- spin_lock_bh(&stats->lock);
- memset(stats, 0, (char *)&stats->lock - (char *)stats);
- spin_unlock_bh(&stats->lock);
- ip_vs_zero_estimator(stats);
-}
-
static int ip_vs_zero_service(struct ip_vs_service *svc)
{
struct list_head *l;
[-- Attachment #3: Type: TEXT/PLAIN, Size: 3467 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1347 -> 1.1348
# net/ipv4/ipvs/ip_vs_ctl.c 1.10 -> 1.11
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/10/13 wensong@linux-vs.org 1.1348
# [IPVS] Fix to set the statistics of dest zero when bound to a new service
# --------------------------------------------
#
diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
--- a/net/ipv4/ipvs/ip_vs_ctl.c Mon Oct 13 23:53:53 2003
+++ b/net/ipv4/ipvs/ip_vs_ctl.c Mon Oct 13 23:53:53 2003
@@ -650,6 +650,15 @@
}
+static void
+ip_vs_zero_stats(struct ip_vs_stats *stats)
+{
+ spin_lock_bh(&stats->lock);
+ memset(stats, 0, (char *)&stats->lock - (char *)stats);
+ spin_unlock_bh(&stats->lock);
+ ip_vs_zero_estimator(stats);
+}
+
/*
* Update a destination in the given service
*/
@@ -689,6 +698,7 @@
} else {
if (dest->svc != svc) {
__ip_vs_unbind_svc(dest);
+ ip_vs_zero_stats(&dest->stats);
__ip_vs_bind_svc(dest, svc);
}
}
@@ -1276,7 +1286,7 @@
* Flush the service table hashed by fwmark
*/
for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
- list_for_each_entry_safe(svc, nxt,
+ list_for_each_entry_safe(svc, nxt,
&ip_vs_svc_fwm_table[idx], f_list) {
write_lock_bh(&__ip_vs_svc_lock);
ip_vs_svc_unhash(svc);
@@ -1296,15 +1306,6 @@
/*
* Zero counters in a service or all services
*/
-static void
-ip_vs_zero_stats(struct ip_vs_stats *stats)
-{
- spin_lock_bh(&stats->lock);
- memset(stats, 0, (char *)&stats->lock - (char *)stats);
- spin_unlock_bh(&stats->lock);
- ip_vs_zero_estimator(stats);
-}
-
static int ip_vs_zero_service(struct ip_vs_service *svc)
{
struct ip_vs_dest *dest;
@@ -1550,10 +1551,10 @@
++*pos;
if (v == SEQ_START_TOKEN)
return ip_vs_info_array(seq,0);
-
+
svc = v;
iter = seq->private;
-
+
if (iter->table == ip_vs_svc_table) {
/* next service in table hashed by protocol */
if ((e = svc->s_list.next) != &ip_vs_svc_table[iter->bucket])
@@ -1579,7 +1580,7 @@
scan_fwmark:
while (++iter->bucket < IP_VS_SVC_TAB_SIZE) {
list_for_each_entry(svc, &ip_vs_svc_fwm_table[iter->bucket],
- f_list)
+ f_list)
return svc;
}
@@ -1607,7 +1608,7 @@
const struct ip_vs_iter *iter = seq->private;
const struct ip_vs_dest *dest;
- if (iter->table == ip_vs_svc_table)
+ if (iter->table == ip_vs_svc_table)
seq_printf(seq, "%s %08X:%04X %s ",
ip_vs_proto_name(svc->protocol),
ntohl(svc->addr),
@@ -1625,7 +1626,7 @@
seq_putc(seq, '\n');
list_for_each_entry(dest, &svc->destinations, n_list) {
- seq_printf(seq,
+ seq_printf(seq,
" -> %08X:%04X %-7s %-6d %-10d %-10d\n",
ntohl(dest->addr), ntohs(dest->port),
ip_vs_fwd_name(atomic_read(&dest->conn_flags)),
@@ -1686,7 +1687,7 @@
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
seq_puts(seq,
" Total Incoming Outgoing Incoming Outgoing\n");
- seq_printf(seq,
+ seq_printf(seq,
" Conns Packets Packets Bytes Bytes\n");
spin_lock_bh(&ip_vs_stats.lock);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Fix IPVS to set the statistics of dest zero
2003-10-13 15:59 [PATCH] Fix IPVS to set the statistics of dest zero Wensong Zhang
@ 2003-10-13 19:32 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-10-13 19:32 UTC (permalink / raw)
To: Wensong Zhang; +Cc: netdev, ja
On Mon, 13 Oct 2003 23:59:34 +0800 (CST)
Wensong Zhang <wensong@linux-vs.org> wrote:
> Here is the slight patch for IPVS to fix to zero the statistics of dest
> when it is bound to a new service. It can make the statistics information
> more correct after removing/adding new servers.
>
> Please check the attached two patches and apply them to the kernel 2.4 and
> 2.6 respectively.
Applied, thanks Wensong.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-13 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-13 15:59 [PATCH] Fix IPVS to set the statistics of dest zero Wensong Zhang
2003-10-13 19:32 ` David S. Miller
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).