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

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