Blame SOURCES/0008-Filesystems-stats-Display-unmounted-filesystems-in-s.patch

9a8d55
From f9752adcd732441cc2d5604cb9b24ecfc29a6acb Mon Sep 17 00:00:00 2001
9a8d55
From: Sebastien GODARD <sysstat@orange.fr.fake>
9a8d55
Date: Mon, 20 May 2013 17:14:05 +0200
9a8d55
Subject: [PATCH] Filesystems stats: Display unmounted filesystems in summary
9a8d55
 list
9a8d55
9a8d55
This patch enables sar -F to display filesystems in its summary list (the
9a8d55
last stats displayed by sar) even if those filesystems have been
9a8d55
unmounted before the end of the report.
9a8d55
9a8d55
(cherry picked from commit c8b1f890f7fc242eceafc94ab3ba117247f3d577)
9a8d55
---
9a8d55
 pr_stats.c | 30 ++++++++++++++++++++++--------
9a8d55
 1 file changed, 22 insertions(+), 8 deletions(-)
9a8d55
9a8d55
diff --git a/pr_stats.c b/pr_stats.c
9a8d55
index 85a3a20..d1edb5b 100644
9a8d55
--- a/pr_stats.c
9a8d55
+++ b/pr_stats.c
9a8d55
@@ -2445,17 +2445,14 @@ __print_funct_t print_avg_pwr_usb_stats(struct activity *a, int prev, int curr,
9a8d55
  *
9a8d55
  * IN:
9a8d55
  * @a		Activity structure with statistics.
9a8d55
- * @prev	Index in array where stats used as reference are.
9a8d55
  * @curr	Index in array for current sample statistics.
9a8d55
- * @itv		Interval of time in jiffies.
9a8d55
  * @dispavg	TRUE if displaying average statistics.
9a8d55
  ***************************************************************************
9a8d55
  */
9a8d55
-__print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int curr,
9a8d55
-					    unsigned long long itv, int dispavg)
9a8d55
+__print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int dispavg)
9a8d55
 {
9a8d55
-	int i;
9a8d55
-	struct stats_filesystem *sfc;
9a8d55
+	int i, j;
9a8d55
+	struct stats_filesystem *sfc, *sfm;
9a8d55
 
9a8d55
 	
9a8d55
 	if (dis) {
9a8d55
@@ -2486,6 +2483,23 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int cu
9a8d55
 		       sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
9a8d55
 				    : 0.0,
9a8d55
 		       sfc->fs_name);
9a8d55
+		
9a8d55
+		if (!dispavg) {
9a8d55
+			/* Save current filesystem in summary list */
9a8d55
+			for (j = 0; j < a->nr; j++) {
9a8d55
+				sfm = (struct stats_filesystem *) ((char *) a->buf[2] + j * a->msize);
9a8d55
+				
9a8d55
+				if (!strcmp(sfm->fs_name, sfc->fs_name) ||
9a8d55
+				    !sfm->f_blocks) {
9a8d55
+					/*
9a8d55
+					 * Filesystem found in list (then save again its stats)
9a8d55
+					 * or free slot (end of list).
9a8d55
+					 */
9a8d55
+					*sfm = *sfc;
9a8d55
+					break;
9a8d55
+				}
9a8d55
+			}
9a8d55
+		}
9a8d55
 	}
9a8d55
 }
9a8d55
 
9a8d55
@@ -2503,7 +2517,7 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int cu
9a8d55
 __print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr,
9a8d55
 				       unsigned long long itv)
9a8d55
 {
9a8d55
-	stub_print_filesystem_stats(a, prev, curr, itv, FALSE);
9a8d55
+	stub_print_filesystem_stats(a, curr, FALSE);
9a8d55
 }
9a8d55
 
9a8d55
 /*
9a8d55
@@ -2520,5 +2534,5 @@ __print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr,
9a8d55
 __print_funct_t print_avg_filesystem_stats(struct activity *a, int prev, int curr,
9a8d55
 					   unsigned long long itv)
9a8d55
 {
9a8d55
-	stub_print_filesystem_stats(a, prev, curr, itv, TRUE);
9a8d55
+	stub_print_filesystem_stats(a, 2, TRUE);
9a8d55
 }
9a8d55
-- 
9a8d55
2.14.3
9a8d55