Blame SOURCES/0010-Collect-filesystems-stats-only-when-sadc-option-S-XD.patch

9a8d55
From 3cba36331dd2ebd2fd6e34b63a1ed5036823c256 Mon Sep 17 00:00:00 2001
9a8d55
From: Sebastien GODARD <sysstat@orange.fr.fake>
9a8d55
Date: Wed, 12 Jun 2013 21:39:19 +0200
9a8d55
Subject: [PATCH] Collect filesystems stats only when sadc option "-S XDISK" is
9a8d55
 used
9a8d55
9a8d55
Make sadc collect filesystems statistics (those displayed by sar option
9a8d55
-F) only when option "-S XDISK" is used.
9a8d55
Filesystems are actually closer to partitions than to disks. So it makes
9a8d55
more sense for sadc to collect them when option "-S XDISK" is used
9a8d55
rather than option "-S DISK".
9a8d55
Update sadc and sar manual pages to reflect the change.
9a8d55
9a8d55
(cherry picked from commit 7557dfebffc9e6de26ff7a6b715792dfa5a715c1)
9a8d55
---
9a8d55
 activity.c  |  2 +-
9a8d55
 man/sadc.in |  4 ++--
9a8d55
 man/sar.in  |  5 +++--
9a8d55
 sa.h        |  1 +
9a8d55
 sadc.c      | 14 +++++++++++---
9a8d55
 5 files changed, 18 insertions(+), 8 deletions(-)
9a8d55
9a8d55
diff --git a/activity.c b/activity.c
9a8d55
index 734df4a..5b0d4a0 100644
9a8d55
--- a/activity.c
9a8d55
+++ b/activity.c
9a8d55
@@ -1200,7 +1200,7 @@ struct activity filesystem_act = {
9a8d55
 	.id		= A_FILESYSTEM,
9a8d55
 	.options	= AO_NULL,
9a8d55
 	.magic		= ACTIVITY_MAGIC_BASE,
9a8d55
-	.group		= G_DISK,
9a8d55
+	.group		= G_XDISK,
9a8d55
 #ifdef SOURCE_SADC
9a8d55
 	.f_count	= wrap_get_filesystem_nr,
9a8d55
 	.f_count2	= NULL,
9a8d55
diff --git a/man/sadc.in b/man/sadc.in
9a8d55
index 9b75754..2e18999 100644
9a8d55
--- a/man/sadc.in
9a8d55
+++ b/man/sadc.in
9a8d55
@@ -1,4 +1,4 @@
9a8d55
-.TH SADC 8 "JULY 2012" Linux "Linux User's Manual" -*- nroff -*-
9a8d55
+.TH SADC 8 "JUNE 2013" Linux "Linux User's Manual" -*- nroff -*-
9a8d55
 .SH NAME
9a8d55
 sadc \- System activity data collector.
9a8d55
 .SH SYNOPSIS
9a8d55
@@ -138,7 +138,7 @@ The
9a8d55
 .B XDISK
9a8d55
 keyword is an extension to the
9a8d55
 .B DISK
9a8d55
-one and indicates that partition statistics should be collected by
9a8d55
+one and indicates that partitions and filesystems statistics should be collected by
9a8d55
 .B sadc
9a8d55
 in addition to disk statistics. This option works only with kernels 2.6.25
9a8d55
 and later.
9a8d55
diff --git a/man/sar.in b/man/sar.in
9a8d55
index 65c89cb..6f96093 100644
9a8d55
--- a/man/sar.in
9a8d55
+++ b/man/sar.in
9a8d55
@@ -324,8 +324,9 @@ or
9a8d55
 Display statistics for currently mounted filesystems. Pseudo-filesystems are
9a8d55
 ignored. At the end of the report,
9a8d55
 .B sar
9a8d55
-will display a summary of all those filesystems. The following values are
9a8d55
-displayed:
9a8d55
+will display a summary of all those filesystems.
9a8d55
+Note that filesystems statistics depend on sadc option "-S XDISK" to be collected.
9a8d55
+The following values are displayed:
9a8d55
 
9a8d55
 .B MBfsfree
9a8d55
 .RS
9a8d55
diff --git a/sa.h b/sa.h
9a8d55
index 50349c8..eb2a426 100644
9a8d55
--- a/sa.h
9a8d55
+++ b/sa.h
9a8d55
@@ -177,6 +177,7 @@
9a8d55
 #define G_SNMP		0x04
9a8d55
 #define G_IPV6		0x08
9a8d55
 #define G_POWER		0x10
9a8d55
+#define G_XDISK		0x20
9a8d55
 
9a8d55
 /* sadc program */
9a8d55
 #define SADC		"sadc"
9a8d55
diff --git a/sadc.c b/sadc.c
9a8d55
index 73c15fa..39c95ee 100644
9a8d55
--- a/sadc.c
9a8d55
+++ b/sadc.c
9a8d55
@@ -137,8 +137,8 @@ void parse_sadc_S_option(char *argv[], int opt)
9a8d55
 			collect_group_activities(G_DISK, AO_F_NULL);
9a8d55
 		}
9a8d55
 		else if (!strcmp(p, K_XDISK)) {
9a8d55
-			/* Select group of disk and partition activities */
9a8d55
-			collect_group_activities(G_DISK, AO_F_DISK_PART);
9a8d55
+			/* Select group of disk and partition/filesystem activities */
9a8d55
+			collect_group_activities(G_DISK + G_XDISK, AO_F_DISK_PART);
9a8d55
 		}
9a8d55
 		else if (!strcmp(p, K_SNMP)) {
9a8d55
 			/* Select group of SNMP activities */
9a8d55
@@ -155,11 +155,19 @@ void parse_sadc_S_option(char *argv[], int opt)
9a8d55
 		else if (!strcmp(p, K_ALL) || !strcmp(p, K_XALL)) {
9a8d55
 			/* Select all activities */
9a8d55
 			for (i = 0; i < NR_ACT; i++) {
9a8d55
+
9a8d55
+				if (!strcmp(p, K_ALL) && (act[i]->group & G_XDISK))
9a8d55
+					/*
9a8d55
+					 * Don't select G_XDISK activities
9a8d55
+					 * when option -S ALL is used.
9a8d55
+					 */
9a8d55
+					continue;
9a8d55
+
9a8d55
 				act[i]->options |= AO_COLLECTED;
9a8d55
 			}
9a8d55
 			if (!strcmp(p, K_XALL)) {
9a8d55
 				/* Tell sadc to also collect partition statistics */
9a8d55
-				collect_group_activities(G_DISK, AO_F_DISK_PART);
9a8d55
+				collect_group_activities(G_DISK + G_XDISK, AO_F_DISK_PART);
9a8d55
 			}
9a8d55
 		}
9a8d55
 		else if (strspn(argv[opt], DIGITS) == strlen(argv[opt])) {
9a8d55
-- 
9a8d55
2.14.3
9a8d55