diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-01-23 10:54:44 +0100 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-01-30 12:34:38 +0100 |
commit | bc58ba9468d94d62c56ab9b47173583ec140b165 (patch) | |
tree | e31bee7a5001efdd40ed568151d5fdfa8b1a746a /block/blk-sysfs.c | |
parent | 7598909e3ee2a08726276d6415b69dadb52d0d76 (diff) | |
download | op-kernel-dev-bc58ba9468d94d62c56ab9b47173583ec140b165.zip op-kernel-dev-bc58ba9468d94d62c56ab9b47173583ec140b165.tar.gz |
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 b538ab8..e29ddfc 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) return ret; } +static ssize_t queue_iostats_show(struct request_queue *q, char *page) +{ + return queue_var_show(blk_queue_io_stat(q), page); +} + +static ssize_t queue_iostats_store(struct request_queue *q, const char *page, + size_t count) +{ + unsigned long stats; + ssize_t ret = queue_var_store(&stats, page, count); + + spin_lock_irq(q->queue_lock); + if (stats) + queue_flag_set(QUEUE_FLAG_IO_STAT, q); + else + queue_flag_clear(QUEUE_FLAG_IO_STAT, q); + spin_unlock_irq(q->queue_lock); + + return ret; +} + static struct queue_sysfs_entry queue_requests_entry = { .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, .show = queue_requests_show, @@ -249,6 +270,12 @@ static struct queue_sysfs_entry queue_rq_affinity_entry = { .store = queue_rq_affinity_store, }; +static struct queue_sysfs_entry queue_iostats_entry = { + .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR }, + .show = queue_iostats_show, + .store = queue_iostats_store, +}; + static struct attribute *default_attrs[] = { &queue_requests_entry.attr, &queue_ra_entry.attr, @@ -259,6 +286,7 @@ static struct attribute *default_attrs[] = { &queue_nonrot_entry.attr, &queue_nomerges_entry.attr, &queue_rq_affinity_entry.attr, + &queue_iostats_entry.attr, NULL, }; |