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

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