HotSaNIC diskio module diff

카테고리 없음 2011. 11. 9. 06:18 Posted by Relipmoc
diff -ur hotsanic-2.4/modules/diskio/platform/common.pm hotsanic-2.6/modules/diskio/platform/common.pm
--- hotsanic-2.4/modules/diskio/platform/common.pm	2004-02-27 10:23:49.000000000 +0100
+++ hotsanic-2.6/modules/diskio/platform/common.pm	2007-11-19 04:28:22.000000000 +0100
@@ -16,6 +16,7 @@
     my ($sysname, $nodename, $release, $version, $machine ) = uname;
     $MODARGS{KERNEL}="2.2" if $release =~ /^2\.[12]\./;
     $MODARGS{KERNEL}="2.4" if $release =~ /^2\.[34]\./;
+    $MODARGS{KERNEL}="2.6" if $release =~ /^2\.[56]\./;
     }
   return %MODARGS
   }
diff -ur hotsanic-2.4/modules/diskio/platform/linux.pm hotsanic-2.6/modules/diskio/platform/linux.pm
--- hotsanic-2.4/modules/diskio/platform/linux.pm	2004-02-29 16:29:36.000000000 +0100
+++ hotsanic-2.6/modules/diskio/platform/linux.pm	2007-11-20 03:40:58.000000000 +0100
@@ -23,6 +23,18 @@
       store_values($args{MODNAME},$num,$racc,$wacc,$rblk,$wblk,512);
       }
     }
+  elsif ($args{KERNEL} eq "2.6") {
+    open FILE,"/proc/diskstats";
+    while (<FILE>) {
+      my ($num1, $num2, undef, @diskstats) = split; 
+      # HACK
+      next unless (defined $num1 && ($num1 == 8 || $num1 == 253));
+      $num=$num1."_".$num2;
+      store_values($args{MODNAME},$num,$diskstats[0],$diskstats[1],$diskstats[2],$diskstats[3],512) if (scalar @diskstats == 4);
+      store_values($args{MODNAME},$num,$diskstats[0],$diskstats[2],$diskstats[4],$diskstats[6],512) if (scalar @diskstats == 11);
+    }
+    close FILE;
+  }
   elsif ($args{KERNEL} eq "2.2") {
   # disk 1494755 377215 221577 144318
   # disk_rio 564538 286941 151189 77490

댓글을 달아 주세요