[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH] Add I/O stats for DM devices



Got a request to add I/O statistics for DM devices, so they will show up
when running the iostat command, so I wrote up this patch. The code was
taken from the various MD personalities. As such, it only keeps track of
the number of reads/writes and the number of sectors read/written. It
doesn't keep track of any of the time-based measurements. See
struct disk_stats in include/linux/genhd.h for more details.

-- 
Kevin Corry
kevcorry us ibm com
http://www.ibm.com/linux/
http://evms.sourceforge.net/



Add I/O statistics for Device-Mapper devices. Only keeps track of count and
size of I/Os, not completion times. Patch is against 2.6.12.

--- diff/drivers/md/dm.c 2005-08-25 11:29:04.000000000 -0500
+++ source/drivers/md/dm.c 2005-08-25 11:26:49.000000000 -0500
@@ -570,6 +570,14 @@
 
  down_read(&md->lock);
 
+ if (bio_data_dir(bio) == WRITE) {
+  disk_stat_inc(dm_disk(md), writes);
+  disk_stat_add(dm_disk(md), write_sectors, bio_sectors(bio));
+ } else {
+  disk_stat_inc(dm_disk(md), reads);
+  disk_stat_add(dm_disk(md), read_sectors, bio_sectors(bio));
+ }
+
  /*
   * If we're suspended we have to queue
   * this io for later.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]