diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-01-23 04:54:44 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-01-30 06:34:38 -0500 |
commit | bc58ba9468d94d62c56ab9b47173583ec140b165 (patch) | |
tree | e31bee7a5001efdd40ed568151d5fdfa8b1a746a /block/blk-sysfs.c | |
parent | 7598909e3ee2a08726276d6415b69dadb52d0d76 (diff) |
block: add sysfs file for controlling io stats accounting
This allows us to turn off disk stat accounting completely, for the cases
where the 0.5-1% reduction in system time is important.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r-- | block/blk-sysfs.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index b538ab8dbbd1..e29ddfc73cf4 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -197,6 +197,27 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count) | |||
197 | return ret; | 197 | return ret; |
198 | } | 198 | } |
199 | 199 | ||
200 | static ssize_t queue_iostats_show(struct request_queue *q, char *page) | ||
201 | { | ||
202 | return queue_var_show(blk_queue_io_stat(q), page); | ||
203 | } | ||
204 | |||
205 | static ssize_t queue_iostats_store(struct request_queue *q, const char *page, | ||
206 | size_t count) | ||
207 | { | ||
208 | unsigned long stats; | ||
209 | ssize_t ret = queue_var_store(&stats, page, count); | ||
210 | |||
211 | spin_lock_irq(q->queue_lock); | ||
212 | if (stats) | ||
213 | queue_flag_set(QUEUE_FLAG_IO_STAT, q); | ||
214 | else | ||
215 | queue_flag_clear(QUEUE_FLAG_IO_STAT, q); | ||
216 | spin_unlock_irq(q->queue_lock); | ||
217 | |||
218 | return ret; | ||
219 | } | ||
220 | |||
200 | static struct queue_sysfs_entry queue_requests_entry = { | 221 | static struct queue_sysfs_entry queue_requests_entry = { |
201 | .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, | 222 | .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, |
202 | .show = queue_requests_show, | 223 | .show = queue_requests_show, |
@@ -249,6 +270,12 @@ static struct queue_sysfs_entry queue_rq_affinity_entry = { | |||
249 | .store = queue_rq_affinity_store, | 270 | .store = queue_rq_affinity_store, |
250 | }; | 271 | }; |
251 | 272 | ||
273 | static struct queue_sysfs_entry queue_iostats_entry = { | ||
274 | .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR }, | ||
275 | .show = queue_iostats_show, | ||
276 | .store = queue_iostats_store, | ||
277 | }; | ||
278 | |||
252 | static struct attribute *default_attrs[] = { | 279 | static struct attribute *default_attrs[] = { |
253 | &queue_requests_entry.attr, | 280 | &queue_requests_entry.attr, |
254 | &queue_ra_entry.attr, | 281 | &queue_ra_entry.attr, |
@@ -259,6 +286,7 @@ static struct attribute *default_attrs[] = { | |||
259 | &queue_nonrot_entry.attr, | 286 | &queue_nonrot_entry.attr, |
260 | &queue_nomerges_entry.attr, | 287 | &queue_nomerges_entry.attr, |
261 | &queue_rq_affinity_entry.attr, | 288 | &queue_rq_affinity_entry.attr, |
289 | &queue_iostats_entry.attr, | ||
262 | NULL, | 290 | NULL, |
263 | }; | 291 | }; |
264 | 292 | ||