tree 0d31149e2c52557555d35696e13d3d9baabc1eaa
parent e3b7df65e089f143b9228472b80fb96c495fb634
author [EMAIL PROTECTED] <[EMAIL PROTECTED]> Tue, 19 Apr 2005 12:00:22 -0700
committer Greg KH <[EMAIL PROTECTED]> Tue, 19 Apr 2005 12:00:22 -0700

[PATCH] aoe 11/12: add support for disk statistics

add support for disk statistics

Signed-off-by: Ed L. Cashin <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 block/aoe/aoe.h    |    1 +
 block/aoe/aoeblk.c |    1 +
 block/aoe/aoecmd.c |   14 ++++++++++++++
 3 files changed, 16 insertions(+)

Index: drivers/block/aoe/aoe.h
===================================================================
--- a2366a9a09aaa9063b3b4e41eab747fc0c8b29a5/drivers/block/aoe/aoe.h  
(mode:100644 sha1:d3b0e2ca151a88e1678d4d5e7fdbd2b642d571ed)
+++ 0d31149e2c52557555d35696e13d3d9baabc1eaa/drivers/block/aoe/aoe.h  
(mode:100644 sha1:2e92cfb4997cdaa4ca335f43af409033c0d4e9dd)
@@ -90,6 +90,7 @@
 
 struct buf {
        struct list_head bufs;
+       ulong start_time;       /* for disk stats */
        ulong flags;
        ulong nframesout;
        char *bufaddr;
Index: drivers/block/aoe/aoeblk.c
===================================================================
--- a2366a9a09aaa9063b3b4e41eab747fc0c8b29a5/drivers/block/aoe/aoeblk.c  
(mode:100644 sha1:63561b280bc5e7149b944b4daba1c6a8acbf303d)
+++ 0d31149e2c52557555d35696e13d3d9baabc1eaa/drivers/block/aoe/aoeblk.c  
(mode:100644 sha1:a2735d97584616972abad960697a3450e585864a)
@@ -125,6 +125,7 @@
        }
        memset(buf, 0, sizeof(*buf));
        INIT_LIST_HEAD(&buf->bufs);
+       buf->start_time = jiffies;
        buf->bio = bio;
        buf->resid = bio->bi_size;
        buf->sector = bio->bi_sector;
Index: drivers/block/aoe/aoecmd.c
===================================================================
--- a2366a9a09aaa9063b3b4e41eab747fc0c8b29a5/drivers/block/aoe/aoecmd.c  
(mode:100644 sha1:f810bd6bf87fc9f00284ad88f0222e07dab59591)
+++ 0d31149e2c52557555d35696e13d3d9baabc1eaa/drivers/block/aoe/aoecmd.c  
(mode:100644 sha1:60beb8db4612a452fddeaf5d876e62ce0742c1c4)
@@ -456,6 +456,20 @@
        if (buf) {
                buf->nframesout -= 1;
                if (buf->nframesout == 0 && buf->resid == 0) {
+                       unsigned long duration = jiffies - buf->start_time;
+                       unsigned long n_sect = buf->bio->bi_size >> 9;
+                       struct gendisk *disk = d->gd;
+
+                       if (bio_data_dir(buf->bio) == WRITE) {
+                               disk_stat_inc(disk, writes);
+                               disk_stat_add(disk, write_ticks, duration);
+                               disk_stat_add(disk, write_sectors, n_sect);
+                       } else {
+                               disk_stat_inc(disk, reads);
+                               disk_stat_add(disk, read_ticks, duration);
+                               disk_stat_add(disk, read_sectors, n_sect);
+                       }
+                       disk_stat_add(disk, io_ticks, duration);
                        n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
                        bio_endio(buf->bio, buf->bio->bi_size, n);
                        mempool_free(buf, d->bufpool);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to