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

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