All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Enable /proc/diskstats for /dev/ramX
@ 2012-11-19  7:16 Ryo Onodera
  2012-11-19  7:26 ` Ryo Onodera
  0 siblings, 1 reply; 4+ messages in thread
From: Ryo Onodera @ 2012-11-19  7:16 UTC (permalink / raw)
  To: Nick Piggin; +Cc: linux-kernel

Signed-off-by: Ryo Onodera <ryoqun@gmail.com>
---
 drivers/block/brd.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
 	sector_t sector;
 	int i;
 	int err = -EIO;
+	int cpu;
 
 	sector = bio->bi_sector;
 	if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
 	if (rw == READA)
 		rw = READ;
 
+	cpu = part_stat_lock();
+	part_stat_inc(cpu, &brd->brd_disk->part0, ios[rw]);
+	part_stat_add(cpu, &brd->brd_disk->part0, sectors[rw],
+					bio_sectors(bio));
+	part_stat_unlock();
+
 	bio_for_each_segment(bvec, bio, i) {
 		unsigned int len = bvec->bv_len;
 		err = brd_do_bvec(brd, bvec->bv_page, len,
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-23 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-19  7:16 [PATCH] Enable /proc/diskstats for /dev/ramX Ryo Onodera
2012-11-19  7:26 ` Ryo Onodera
2012-12-23 21:41   ` [PATCH] brd: enable diskstats Ryo Onodera
2012-12-23 21:47     ` Ryo Onodera

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.