From: ecashin@noserose.net
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.11] aoe [11/12]: add support for disk statistics
Date: Thu, 24 Mar 2005 07:30:02 -0800 [thread overview]
Message-ID: <1111678202.356@geode.he.net> (raw)
In-Reply-To: 20050317234641.GA7091@kroah.com
add support for disk statistics
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
diff -uprN a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
--- a/drivers/block/aoe/aoe.h 2005-03-10 12:19:54.000000000 -0500
+++ b/drivers/block/aoe/aoe.h 2005-03-10 12:20:02.000000000 -0500
@@ -91,6 +91,7 @@ enum {
struct buf {
struct list_head bufs;
+ ulong start_time; /* for disk stats */
ulong flags;
ulong nframesout;
char *bufaddr;
diff -uprN a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
--- a/drivers/block/aoe/aoeblk.c 2005-03-10 12:20:00.000000000 -0500
+++ b/drivers/block/aoe/aoeblk.c 2005-03-10 12:20:02.000000000 -0500
@@ -125,6 +125,7 @@ aoeblk_make_request(request_queue_t *q,
}
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;
diff -uprN a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
--- a/drivers/block/aoe/aoecmd.c 2005-03-10 12:19:27.000000000 -0500
+++ b/drivers/block/aoe/aoecmd.c 2005-03-10 12:20:02.000000000 -0500
@@ -456,6 +456,20 @@ aoecmd_ata_rsp(struct sk_buff *skb)
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);
--
Ed L. Cashin <ecashin@coraid.com>
next prev parent reply other threads:[~2005-03-24 15:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87mztbi79d.fsf@coraid.com>
2005-03-17 23:46 ` [PATCH 2.6.11] aoe [1/12]: remove too-low cap on minor number Greg KH
2005-03-18 20:13 ` Ed L Cashin
2005-03-18 20:14 ` [PATCH 2.6.11] aoe [4/12]: handle distros that have a udev rules file instead of dir Ed L. Cashin
2005-03-24 14:59 ` [PATCH 2.6.11] aoe [1/12]: remove too-low cap on minor number ecashin
2005-03-24 15:09 ` [PATCH 2.6.11] aoe [2/12]: allow multiple aoe devices with same MAC addr ecashin
2005-03-24 15:13 ` [PATCH 2.6.11] aoe [3/12]: update driver version to 6 ecashin
2005-03-24 15:15 ` [PATCH 2.6.11] aoe [4/12]: handle distros that have a udev rules file instead of dir ecashin
2005-03-24 15:17 ` [PATCH 2.6.11] aoe [5/12]: don't try to free null bufpool ecashin
2005-03-24 15:58 ` Arjan van de Ven
2005-03-24 17:04 ` ecashin
2005-03-24 17:17 ` Arjan van de Ven
2005-03-25 14:37 ` Jesper Juhl
2005-03-29 12:31 ` Jens Axboe
2005-03-24 15:19 ` [PATCH 2.6.11] aoe [6/12]: Alexey Dobriyan sparse cleanup ecashin
2005-03-24 15:21 ` [PATCH 2.6.11] aoe [7/12]: support configuration of AOE_PARTITIONS from Kconfig ecashin
2005-03-28 17:07 ` Christoph Hellwig
2005-03-29 16:06 ` Ed L Cashin
2005-03-29 16:25 ` Christoph Hellwig
2005-03-29 16:48 ` Ed L Cashin
2005-03-29 16:57 ` Christoph Hellwig
2005-04-07 18:28 ` Ed L Cashin
2005-04-07 18:49 ` Greg KH
2005-04-07 18:56 ` Ed L Cashin
2005-04-07 23:08 ` Greg KH
2005-04-08 13:54 ` Ed L Cashin
2005-03-24 15:23 ` [PATCH 2.6.11] aoe [8/12]: document env var for specifying number of partitions per dev ecashin
2005-03-24 15:25 ` [PATCH 2.6.11] aoe [9/12]: add note about the need for deadlock-free sk_buff allocation ecashin
2005-03-24 15:27 ` [PATCH 2.6.11] aoe [10/12]: Randy Dunlap: avoid warnings on sparc64 ecashin
2005-03-24 15:30 ` ecashin [this message]
2005-03-24 15:32 ` [PATCH 2.6.11] aoe [12/12]: send outgoing packets in order ecashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1111678202.356@geode.he.net \
--to=ecashin@noserose.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox