From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761017AbXEJKPU (ORCPT ); Thu, 10 May 2007 06:15:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758396AbXEJKOD (ORCPT ); Thu, 10 May 2007 06:14:03 -0400 Received: from mx1.redhat.com ([66.187.233.31]:56089 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758053AbXEJKOB (ORCPT ); Thu, 10 May 2007 06:14:01 -0400 Message-Id: <20070510101129.564688888@chello.nl> References: <20070510100839.621199408@chello.nl> User-Agent: quilt/0.46-1 Date: Thu, 10 May 2007 12:08:50 +0200 From: Peter Zijlstra To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: miklos@szeredi.hu, akpm@linux-foundation.org, neilb@suse.de, dgc@sgi.com, tomoki.sekiyama.qu@hitachi.com, a.p.zijlstra@chello.nl, nikita@clusterfs.com, trond.myklebust@fys.uio.no, yingchao.zhou@gmail.com Subject: [PATCH 11/15] mm: expose BDI statistics in sysfs. Content-Disposition: inline; filename=bdi_stat_sysfs.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Expose the per BDI stats in /sys/block//queue/* Signed-off-by: Peter Zijlstra --- block/ll_rw_blk.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) Index: linux-2.6/block/ll_rw_blk.c =================================================================== --- linux-2.6.orig/block/ll_rw_blk.c 2007-05-10 10:21:59.000000000 +0200 +++ linux-2.6/block/ll_rw_blk.c 2007-05-10 10:23:39.000000000 +0200 @@ -3978,6 +3978,23 @@ static ssize_t queue_max_hw_sectors_show return queue_var_show(max_hw_sectors_kb, (page)); } +static ssize_t queue_nr_reclaimable_show(struct request_queue *q, char *page) +{ + unsigned long long nr_reclaimable = + bdi_stat(&q->backing_dev_info, BDI_RECLAIMABLE); + + return sprintf(page, "%llu\n", + nr_reclaimable >> (PAGE_CACHE_SHIFT - 10)); +} + +static ssize_t queue_nr_writeback_show(struct request_queue *q, char *page) +{ + unsigned long long nr_writeback = + bdi_stat(&q->backing_dev_info, BDI_WRITEBACK); + + return sprintf(page, "%llu\n", + nr_writeback >> (PAGE_CACHE_SHIFT - 10)); +} static struct queue_sysfs_entry queue_requests_entry = { .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, @@ -4002,6 +4019,16 @@ static struct queue_sysfs_entry queue_ma .show = queue_max_hw_sectors_show, }; +static struct queue_sysfs_entry queue_reclaimable_entry = { + .attr = {.name = "reclaimable_kb", .mode = S_IRUGO }, + .show = queue_nr_reclaimable_show, +}; + +static struct queue_sysfs_entry queue_writeback_entry = { + .attr = {.name = "writeback_kb", .mode = S_IRUGO }, + .show = queue_nr_writeback_show, +}; + static struct queue_sysfs_entry queue_iosched_entry = { .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR }, .show = elv_iosched_show, @@ -4013,6 +4040,8 @@ static struct attribute *default_attrs[] &queue_ra_entry.attr, &queue_max_hw_sectors_entry.attr, &queue_max_sectors_entry.attr, + &queue_reclaimable_entry.attr, + &queue_writeback_entry.attr, &queue_iosched_entry.attr, NULL, }; --