Blame SOURCES/0012-Add-option-to-display-mountpoint-names-instead-of-fi.patch

72abff
From b8eaf0cce7cbed0eb56e9fc509961269d718d096 Mon Sep 17 00:00:00 2001
72abff
From: Steve Kay <stevekay@gmail.com>
72abff
Date: Fri, 13 Mar 2015 15:24:10 -0700
72abff
Subject: [PATCH] Add option to display mountpoint names instead of filesystem
72abff
 names.
72abff
72abff
(cherry picked from commit d91ecce584d7dedf194714a4d189ecfba6276f6c)
72abff
---
72abff
 man/sar.in  | 23 ++++++++++++++---------
72abff
 pr_stats.c  | 11 ++++++-----
72abff
 rd_stats.c  |  1 +
72abff
 rd_stats.h  |  1 +
72abff
 sa.h        |  5 +++++
72abff
 sa_common.c |  6 ++++++
72abff
 sar.c       |  5 +++--
72abff
 7 files changed, 36 insertions(+), 16 deletions(-)
72abff
72abff
diff --git a/man/sar.in b/man/sar.in
72abff
index 6d964b3..4ea6ca0 100644
72abff
--- a/man/sar.in
72abff
+++ b/man/sar.in
72abff
@@ -315,17 +315,22 @@ value is close to 100%.
72abff
 Set the ending time of the report. The default ending time is
72abff
 18:00:00. Hours must be given in 24-hour format.
72abff
 This option can be used when data are read from
72abff
-or written to a file (options
72abff
-.B -f
72abff
-or
72abff
-.B -o
72abff
-).
72abff
-.IP -F
72abff
+or written to a file (options -f or -o).
72abff
+.IP "-F [ MOUNT ]"
72abff
 Display statistics for currently mounted filesystems. Pseudo-filesystems are
72abff
-ignored. At the end of the report,
72abff
-.B sar
72abff
+ignored.  At the end of the report, 
72abff
+.B sar 
72abff
 will display a summary of all those filesystems.
72abff
-Note that filesystems statistics depend on sadc option "-S XDISK" to be collected.
72abff
+Note that filesystems statistics depend on
72abff
+.B sadc
72abff
+option
72abff
+.B "-S XDISK"
72abff
+to be collected.
72abff
+Use of the 
72abff
+.B MOUNT
72abff
+parameter keyword indicates that mountpoint will be reported instead of 
72abff
+filesystem device.
72abff
+
72abff
 The following values are displayed:
72abff
 
72abff
 .B MBfsfree
72abff
diff --git a/pr_stats.c b/pr_stats.c
72abff
index d1edb5b..5bee25f 100644
72abff
--- a/pr_stats.c
72abff
+++ b/pr_stats.c
72abff
@@ -2454,11 +2454,11 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di
72abff
 	int i, j;
72abff
 	struct stats_filesystem *sfc, *sfm;
72abff
 
72abff
-	
72abff
 	if (dis) {
72abff
 		printf("\n%-11s  MBfsfree  MBfsused   %%fsused  %%ufsused"
72abff
-		       "     Ifree     Iused    %%Iused FILESYSTEM\n",
72abff
-		       (dispavg ? _("Summary") : timestamp[!curr]));
72abff
+		       "     Ifree     Iused    %%Iused %s\n",
72abff
+		       (dispavg ? _("Summary:") : timestamp[!curr]),
72abff
+		       DISPLAY_MOUNT(a->opt_flags) ? _("MOUNTPOINT") : _("FILESYSTEM"));
72abff
 	}
72abff
 
72abff
 	for (i = 0; i < a->nr; i++) {
72abff
@@ -2482,8 +2482,9 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di
72abff
 		       sfc->f_files - sfc->f_ffree,
72abff
 		       sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
72abff
 				    : 0.0,
72abff
-		       sfc->fs_name);
72abff
-		
72abff
+
72abff
+		       DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name);
72abff
+
72abff
 		if (!dispavg) {
72abff
 			/* Save current filesystem in summary list */
72abff
 			for (j = 0; j < a->nr; j++) {
72abff
diff --git a/rd_stats.c b/rd_stats.c
72abff
index c3ef70f..24a98f7 100644
72abff
--- a/rd_stats.c
72abff
+++ b/rd_stats.c
72abff
@@ -1942,6 +1942,7 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr)
72abff
 			st_filesystem_i->f_files  = buf.f_files;
72abff
 			st_filesystem_i->f_ffree  = buf.f_ffree;
72abff
 			strcpy(st_filesystem_i->fs_name, fs_name);
72abff
+			strcpy(st_filesystem_i->mountp, mountp);
72abff
 		}
72abff
 	}
72abff
 
72abff
diff --git a/rd_stats.h b/rd_stats.h
72abff
index 279178f..d958104 100644
72abff
--- a/rd_stats.h
72abff
+++ b/rd_stats.h
72abff
@@ -531,6 +531,7 @@ struct stats_filesystem {
72abff
 	unsigned long long f_files		__attribute__ ((aligned (16)));
72abff
 	unsigned long long f_ffree		__attribute__ ((aligned (16)));
72abff
 	char 		   fs_name[MAX_FS_LEN]	__attribute__ ((aligned (16)));
72abff
+	char 		   mountp[MAX_FS_LEN]	__attribute__ ((aligned (16)));
72abff
 };
72abff
 
72abff
 #define STATS_FILESYSTEM_SIZE	(sizeof(struct stats_filesystem))
72abff
diff --git a/sa.h b/sa.h
72abff
index eb2a426..7d24f2d 100644
72abff
--- a/sa.h
72abff
+++ b/sa.h
72abff
@@ -129,6 +129,11 @@
72abff
 
72abff
 #define COLLECT_PARTITIONS(m)	(((m) & AO_F_DISK_PART)   == AO_F_DISK_PART)
72abff
 
72abff
+/* Output flags for option -F */
72abff
+#define AO_F_MOUNT		0x00000001
72abff
+
72abff
+#define DISPLAY_MOUNT(m)	(((m) & AO_F_MOUNT)       == AO_F_MOUNT)
72abff
+
72abff
 /*
72abff
  ***************************************************************************
72abff
  * Various keywords and constants.
72abff
diff --git a/sa_common.c b/sa_common.c
72abff
index 3ccf24b..2206e9f 100644
72abff
--- a/sa_common.c
72abff
+++ b/sa_common.c
72abff
@@ -1284,6 +1284,12 @@ int parse_sar_opt(char *argv[], int *opt, struct activity *act[],
72abff
 
72abff
 		case 'F':
72abff
 			SELECT_ACTIVITY(A_FILESYSTEM);
72abff
+			p = get_activity_position(act, A_FILESYSTEM);
72abff
+			if (!*(argv[*opt] + i + 1) && argv[*opt + 1] && !strcmp(argv[*opt + 1], "MOUNT")) {
72abff
+				(*opt)++;
72abff
+				act[p]->opt_flags |= AO_F_MOUNT;
72abff
+				return 0;
72abff
+			}
72abff
 			break;
72abff
 			
72abff
 		case 'H':
72abff
diff --git a/sar.c b/sar.c
72abff
index 2674810..5dfd915 100644
72abff
--- a/sar.c
72abff
+++ b/sar.c
72abff
@@ -107,7 +107,7 @@ void usage(char *progname)
72abff
 {
72abff
 	print_usage_title(stderr, progname);
72abff
 	fprintf(stderr, _("Options are:\n"
72abff
-			  "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n"
72abff
+			  "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F [ MOUNTS ] ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n"
72abff
 			  "[ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ]\n"
72abff
 			  "[ -I { <int> [,...] | SUM | ALL | XALL } ] [ -P { <cpu> [,...] | ALL } ]\n"
72abff
 			  "[ -m { <keyword> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ]\n"
72abff
@@ -132,7 +132,8 @@ void display_help(char *progname)
72abff
 	printf(_("\t-b\tI/O and transfer rate statistics\n"));
72abff
 	printf(_("\t-B\tPaging statistics\n"));
72abff
 	printf(_("\t-d\tBlock device statistics\n"));
72abff
-	printf(_("\t-F\tFilesystems statistics\n"));
72abff
+	printf(_("\t-F [ MOUNTS ]\n"));
72abff
+	printf(_("\t\tFilesystems statistics\n"));
72abff
 	printf(_("\t-H\tHugepages utilization statistics\n"));
72abff
 	printf(_("\t-I { <int> | SUM | ALL | XALL }\n"
72abff
 		 "\t\tInterrupts statistics\n"));
72abff
-- 
72abff
2.14.3
72abff