]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] remove duplicated disk statistics
authorAndrew Morton <akpm@digeo.com>
Sun, 10 Nov 2002 10:02:25 +0000 (02:02 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Sun, 10 Nov 2002 10:02:25 +0000 (02:02 -0800)
This patch will break some userspace monitoring apps in the name of
having sane disk statistics in 2.6.x.

Patch from Rick Lindsley <ricklind@us.ibm.com>

In 2.5.46, there are now disk statistics being collected twice: once
for gendisk/hd_struct, and once for dkstat.  They are collecting the
same thing.  This patch removes dkstat, which also had the disadvantage
of being limited by DK_MAX_MAJOR and DK_MAX_DISK. (Those #defines are
removed too.)

In addition, this patch removes disk statistics from /proc/stat since
they are now available via sysfs and there seems to have been a general
preference in previous discussions to "clean up" /proc/stat.  Too many
disks being reported in /proc/stat also caused buffer overflows when
trying to print out the data.

The code in led.c from the parisc architecture has not apparently been
recompiled under recent versions of 2.5, since it references
kstat.dk_drive which doesn't exist in later versions.  Accordingly,
I've added an #ifdef 0 and a comment to that code so that it may at
least compile, albeit without one feature -- a step up from its state
now.  If it is preferable to keep the broken code in, that patch may
easily be excised from below.

drivers/block/ll_rw_blk.c
drivers/parisc/led.c
fs/proc/proc_misc.c
include/linux/blkdev.h

index b5399a8aab3abe99630c258b02fe8e3574a9c699..7698b794961dba42a606b18658df8455c859bcdf 100644 (file)
 #include <linux/completion.h>
 #include <linux/slab.h>
 
-/*
- * Disk stats 
- */
-struct disk_stat dkstat;
-
 /*
  * For the allocated request tables
  */
@@ -1412,19 +1407,6 @@ void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
 
        major = rq->rq_disk->major;
        index = rq->rq_disk->first_minor >> rq->rq_disk->minor_shift;
-
-       if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
-               return;
-
-       dkstat.drive[major][index] += new_io;
-       if (rw == READ) {
-               dkstat.drive_rio[major][index] += new_io;
-               dkstat.drive_rblk[major][index] += nr_sectors;
-       } else if (rw == WRITE) {
-               dkstat.drive_wio[major][index] += new_io;
-               dkstat.drive_wblk[major][index] += nr_sectors;
-       } else
-               printk(KERN_ERR "drive_stat_acct: cmd not R/W?\n");
 }
 
 /*
index d57179c449088978f840eb24342bab21f301d402..3e2e0afd6e3a00564f4e42a9933d9a55de91a6c9 100644 (file)
@@ -404,6 +404,14 @@ static void led_get_diskio_stats(int addvalue)
        int major, disk, total;
        
        total = 0;
+#ifdef 0
+       /*
+        * this section will no longer work in 2.5, as we no longer
+        * have either kstat.dk_drive nor DK_MAX_*.  It can probably
+        * be rewritten to use the per-disk statistics now kept in the
+        * gendisk, but since I have no HP machines to test it on, I'm
+        * not really up to that.  ricklind@us.ibm.com 11/7/02
+        */
        for (major = 0; major < DK_MAX_MAJOR; major++) {
            for (disk = 0; disk < DK_MAX_DISK; disk++)
                total += dkstat.drive[major][disk];
@@ -417,6 +425,7 @@ static void led_get_diskio_stats(int addvalue)
            } else
                led_diskio_counter += CALC_ADD(total, diskio_max, addvalue);
        }
+#endif
        
        diskio_total_last += total; 
 }
index 18a39634aba8fdd3e4c4e94c984708d1537a9154..3f1db05f544526593e8af066d530fd29530ea043 100644 (file)
@@ -330,7 +330,6 @@ static int kstat_read_proc(char *page, char **start, off_t off,
        extern unsigned long total_forks;
        unsigned long jif = jiffies;
        unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0;
-       int major, disk;
 
        for (i = 0 ; i < NR_CPUS; i++) {
                int j;
@@ -370,26 +369,6 @@ static int kstat_read_proc(char *page, char **start, off_t off,
                len += sprintf(page + len, " %u", kstat_irqs(i));
 #endif
 
-       len += sprintf(page + len, "\ndisk_io: ");
-
-       for (major = 0; major < DK_MAX_MAJOR; major++) {
-               for (disk = 0; disk < DK_MAX_DISK; disk++) {
-                       int active = dkstat.drive[major][disk] +
-                               dkstat.drive_rblk[major][disk] +
-                               dkstat.drive_wblk[major][disk];
-                       if (active)
-                               len += sprintf(page + len,
-                                       "(%u,%u):(%u,%u,%u,%u,%u) ",
-                                       major, disk,
-                                       dkstat.drive[major][disk],
-                                       dkstat.drive_rio[major][disk],
-                                       dkstat.drive_rblk[major][disk],
-                                       dkstat.drive_wio[major][disk],
-                                       dkstat.drive_wblk[major][disk]
-                       );
-               }
-       }
-
        len += sprintf(page + len,
                "\nctxt %lu\n"
                "btime %lu\n"
index 95b7c2e03a2ae466bfb0186965e1f9c3919d8cd9..a3927e6b6deefe7e85f2862dd9fb8d4121e7c076 100644 (file)
 
 #include <asm/scatterlist.h>
 
-/*
- * Disk stats ...
- */
-
-#define DK_MAX_MAJOR 16
-#define DK_MAX_DISK 16
-struct disk_stat {
-        unsigned int drive[DK_MAX_MAJOR][DK_MAX_DISK];
-        unsigned int drive_rio[DK_MAX_MAJOR][DK_MAX_DISK];
-        unsigned int drive_wio[DK_MAX_MAJOR][DK_MAX_DISK];
-        unsigned int drive_rblk[DK_MAX_MAJOR][DK_MAX_DISK];
-        unsigned int drive_wblk[DK_MAX_MAJOR][DK_MAX_DISK];
-};
-extern struct disk_stat dkstat;
-
 struct request_queue;
 typedef struct request_queue request_queue_t;
 struct elevator_s;