diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/aoe/aoe.h | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoeblk.c | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 14 |
3 files changed, 16 insertions, 0 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index d3b0e2ca151a..2e92cfb4997c 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -90,6 +90,7 @@ enum { | |||
90 | 90 | ||
91 | struct buf { | 91 | struct buf { |
92 | struct list_head bufs; | 92 | struct list_head bufs; |
93 | ulong start_time; /* for disk stats */ | ||
93 | ulong flags; | 94 | ulong flags; |
94 | ulong nframesout; | 95 | ulong nframesout; |
95 | char *bufaddr; | 96 | char *bufaddr; |
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index 63561b280bc5..a2735d975846 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c | |||
@@ -125,6 +125,7 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio) | |||
125 | } | 125 | } |
126 | memset(buf, 0, sizeof(*buf)); | 126 | memset(buf, 0, sizeof(*buf)); |
127 | INIT_LIST_HEAD(&buf->bufs); | 127 | INIT_LIST_HEAD(&buf->bufs); |
128 | buf->start_time = jiffies; | ||
128 | buf->bio = bio; | 129 | buf->bio = bio; |
129 | buf->resid = bio->bi_size; | 130 | buf->resid = bio->bi_size; |
130 | buf->sector = bio->bi_sector; | 131 | buf->sector = bio->bi_sector; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index f810bd6bf87f..60beb8db4612 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -456,6 +456,20 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
456 | if (buf) { | 456 | if (buf) { |
457 | buf->nframesout -= 1; | 457 | buf->nframesout -= 1; |
458 | if (buf->nframesout == 0 && buf->resid == 0) { | 458 | if (buf->nframesout == 0 && buf->resid == 0) { |
459 | unsigned long duration = jiffies - buf->start_time; | ||
460 | unsigned long n_sect = buf->bio->bi_size >> 9; | ||
461 | struct gendisk *disk = d->gd; | ||
462 | |||
463 | if (bio_data_dir(buf->bio) == WRITE) { | ||
464 | disk_stat_inc(disk, writes); | ||
465 | disk_stat_add(disk, write_ticks, duration); | ||
466 | disk_stat_add(disk, write_sectors, n_sect); | ||
467 | } else { | ||
468 | disk_stat_inc(disk, reads); | ||
469 | disk_stat_add(disk, read_ticks, duration); | ||
470 | disk_stat_add(disk, read_sectors, n_sect); | ||
471 | } | ||
472 | disk_stat_add(disk, io_ticks, duration); | ||
459 | n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; | 473 | n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; |
460 | bio_endio(buf->bio, buf->bio->bi_size, n); | 474 | bio_endio(buf->bio, buf->bio->bi_size, n); |
461 | mempool_free(buf, d->bufpool); | 475 | mempool_free(buf, d->bufpool); |