[PATCH] cgget: -r option doesn't work well on kernel after 3.5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dave,

I found the option -r fails when it comes to blkio subsystem
on kernel after 3.5. This patch can fix the bug.

Thanks,
Zhang Xiaohe
--- ../crash/extensions/cgget.c	2013-03-12 16:38:05.709837000 +0800
+++ extensions/cgget.c	2013-03-12 16:16:18.130217000 +0800
@@ -3755,28 +3755,25 @@
 		}
 		/* there should be nothing to be displayed for reset_stats */
 		fprintf(fp, "%s.reset_stats: \n", group_list->subsys_str);
-		return;
-	}
-
-	if (blkio_offset_table.blkg_stats == -1)
+	} else if (STRUCT_EXISTS("blkio_cgroup")) {
+		for (plid = 0; plid <= BLKIO_POLICY_THROTL; plid++) {
+			if (plid == BLKIO_POLICY_PROP)
+				for (atid = 1; atid <= BLKIO_PROP_io_queued; atid++) {
+					blkio_read_map(subsys_addr, plid, atid,
+							group_list->subsys_str);
+				}
+			else
+				for (atid = BLKIO_THROTL_read_bps_device;
+					atid <= BLKIO_THROTL_io_serviced; atid++) {
+					blkio_read_map(subsys_addr, plid, atid,
+							group_list->subsys_str);
+				}
+		}
+		/* there should be nothing to be displayed for reset_stats */
+		fprintf(fp, "%s.reset_stats: \n", group_list->subsys_str);
+	} else if (blkio_offset_table.blkg_stats == -1)
 		/* for kernel version 2.6.33, 2.6.34 */
-		return blkio_print_param_old(subsys_addr);
-
-	for (plid = 0; plid <= BLKIO_POLICY_THROTL; plid++) {
-		if (plid == BLKIO_POLICY_PROP)
-			for (atid = 1; atid <= BLKIO_PROP_io_queued; atid++) {
-				blkio_read_map(subsys_addr, plid, atid,
-						group_list->subsys_str);
-			}
-		else
-			for (atid = BLKIO_THROTL_read_bps_device;
-				atid <= BLKIO_THROTL_io_serviced; atid++) {
-				blkio_read_map(subsys_addr, plid, atid,
-						group_list->subsys_str);
-			}
-	}
-	/* there should be nothing to be displayed for reset_stats */
-	fprintf(fp, "%s.reset_stats: \n", group_list->subsys_str);
+		blkio_print_param_old(subsys_addr);
 
 	/* second, output the needed param */
 	if (test_bit(blkio_subsys_id, variable_flag)) {
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux