Package: sysstat
Version: 6.1.3-1
Severity: normal
Tags: patch

Hi,

getting iostat of one partition fails.
eg.

<<<
[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3$ ./iostat -p /dev/hda1
Linux 2.6.15-1-686 (sd033)      25/07/06

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          10.86    0.64   35.55    0.72    0.00   52.23

          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read     
Blk_wrtn
[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3$
>>>

(but running 'iostat -p /dev/hda' gives full output).
A patch to fix this issue is attached.

Behaviour after the patch:
<<<
[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3-patched$ ./iostat -p /dev/hda1
Linux 2.6.15-1-686 (sd033)      07/25/06

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          10.86    0.64   35.55    0.72    0.00   52.23

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
hda1              0.00         0.00         0.00       7993       9460

[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3-patched$ 
>>>

-- 
Toni Timonen
040-5111863,GPG 0x7984A4FD
--- sysstat-6.1.3/iostat.c      2006-05-24 16:24:07.000000000 +0300
+++ sysstat-6.1.3-patched/iostat.c      2006-07-25 15:14:22.000000000 +0300
@@ -577,6 +577,17 @@
       if (ok && st_dev_list_i->disp_part)
         /* Also read stats for its partitions */
         read_sysfs_dlist_part_stat(curr, st_dev_list_i->dev_name);
+      else {
+       char *parent=strdup(st_dev_list_i->dev_name);
+       char *p=strpbrk(parent,DIGITS);
+       if(p) {
+               *p=0;
+               sprintf(filename,"%s/%s/%s/%s",
+                       SYSFS_BLOCK,parent,st_dev_list_i->dev_name,S_STAT);
+               
read_sysfs_file_stat(curr,filename,st_dev_list_i->dev_name,DT_PARTITION);
+       }
+       free(parent);
+      }
    }
 
    /* Free structures corresponding to unregistered devices */

Reply via email to