aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNikanth Karthikesan <knikanth@suse.de>2009-09-11 03:18:54 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-09-14 02:24:52 -0400
commita9327cac440be4d8333bba975cbbf76045096275 (patch)
tree83fd5dc45dc925c5b4eb0264c3add96cfaa4cae6 /include
parent18d8217bc441630c3c5ec7416c5a65c69e8a0979 (diff)
Seperate read and write statistics of in_flight requests
Currently, there is a single in_flight counter measuring the number of requests in the request_queue. But some monitoring tools would like to know how many read requests and write requests are in progress. Split the current in_flight counter into two seperate counters for read and write. This information is exported as a sysfs attribute, as changing the currently available stat files would break the existing tools. Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/genhd.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 45fc320a53c6..44263cb27121 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -98,7 +98,7 @@ struct hd_struct {
98 int make_it_fail; 98 int make_it_fail;
99#endif 99#endif
100 unsigned long stamp; 100 unsigned long stamp;
101 int in_flight; 101 int in_flight[2];
102#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
103 struct disk_stats *dkstats; 103 struct disk_stats *dkstats;
104#else 104#else
@@ -322,18 +322,23 @@ static inline void free_part_stats(struct hd_struct *part)
322#define part_stat_sub(cpu, gendiskp, field, subnd) \ 322#define part_stat_sub(cpu, gendiskp, field, subnd) \
323 part_stat_add(cpu, gendiskp, field, -subnd) 323 part_stat_add(cpu, gendiskp, field, -subnd)
324 324
325static inline void part_inc_in_flight(struct hd_struct *part) 325static inline void part_inc_in_flight(struct hd_struct *part, int rw)
326{ 326{
327 part->in_flight++; 327 part->in_flight[rw]++;
328 if (part->partno) 328 if (part->partno)
329 part_to_disk(part)->part0.in_flight++; 329 part_to_disk(part)->part0.in_flight[rw]++;
330} 330}
331 331
332static inline void part_dec_in_flight(struct hd_struct *part) 332static inline void part_dec_in_flight(struct hd_struct *part, int rw)
333{ 333{
334 part->in_flight--; 334 part->in_flight[rw]--;
335 if (part->partno) 335 if (part->partno)
336 part_to_disk(part)->part0.in_flight--; 336 part_to_disk(part)->part0.in_flight[rw]--;
337}
338
339static inline int part_in_flight(struct hd_struct *part)
340{
341 return part->in_flight[0] + part->in_flight[1];
337} 342}
338 343
339/* block/blk-core.c */ 344/* block/blk-core.c */
@@ -546,6 +551,8 @@ extern ssize_t part_size_show(struct device *dev,
546 struct device_attribute *attr, char *buf); 551 struct device_attribute *attr, char *buf);
547extern ssize_t part_stat_show(struct device *dev, 552extern ssize_t part_stat_show(struct device *dev,
548 struct device_attribute *attr, char *buf); 553 struct device_attribute *attr, char *buf);
554extern ssize_t part_inflight_show(struct device *dev,
555 struct device_attribute *attr, char *buf);
549#ifdef CONFIG_FAIL_MAKE_REQUEST 556#ifdef CONFIG_FAIL_MAKE_REQUEST
550extern ssize_t part_fail_show(struct device *dev, 557extern ssize_t part_fail_show(struct device *dev,
551 struct device_attribute *attr, char *buf); 558 struct device_attribute *attr, char *buf);